Giter Site home page Giter Site logo

anagram-kata's Introduction

Anagrams Kata

The anagrams kata is a beginners kata.

It's purpose is to get acquinted how this works.

Make the solution as well readable as possible

Since the kata is not about showing how smart you are, but about learning to do the solution as well as possible, I give you a hint on how you can determine if two words are anagrams.

Two words are anagrams if they have the same "signature"

const generateSignature = (word) => {
    // only working for non accentuated, non heavy metal umlauted languages, e.g. english
    word = word.replace(/\W/g, '');
    return word.toLowerCase().split('').sort().join('')
};

Task

  1. Try this kata as a NodeJS commandline programm.
  2. Dont install any external modules, but use the default
  3. Create a terminal programm that reads in a list of words and prints out all anagrams.
    Two words are considered anagrams if they contain the same letters in the same amount. Casing (lowercase/uppercase) should be ignored.
    Skip/delete non letter characters like a '
  4. Output all anagrams line by line comma seperated like this: stow, swot, tows, twos

additionals

if you got time, add these features to it

  1. add tests for your functions/classes/methods I already set up the testing with jasemine so you can run all tests wit npm run test
  2. Make the programm take the wordfile as a commandline argument.
  3. Make the programm output only anagramms that have more than 5 annagrammatic words
  4. Make the programm take another commandline parameter, that is the number of annagrammatic words that are the minimum to get printed
  5. add a counter to the output (how many annagrammatic words per line)
  6. add a counter as last row, how many annagram lines were printed

Discuss

  • what was the most cumbersome in this kata? in nodejs?
  • how much effort was it to put some additionals in?
  • how much did you have to change existing functions/classes/methods/signatures to fit in more/other functionality?

anagram-kata's People

Watchers

James Cloos avatar dominikschopper avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.