Modulo Three
This little application gives several options for finding the remainder of division by 3:
- ModuloThreeFSM: API library implements the ‘mod-three’ procedure. Available methods:
- getters and setters for states, alphabet, initial state, final state and transitions object
- parseInput(): method that returns the remainder of division by 3 of the input binary string
- nextState(): a method that returns the next state of the FSM depending on the passed state and the incoming value
- easy: converts a string to a number and returns the remainder after division by 3
- standart: implement a state transition algorithm to implement the‘mod-three’ procedure
- advanced: hardcoded version of finite automaton (FA) is a 5-tuple
To run it localy
- Clone GitHub repo Modulo Three
cd mod-3-fsm
npm install
ts-node ./src/run.ts 10011
or any other valid binary string
To run tests
- Clone GitHub repo Modulo Three
cd mod-3-fsm
npm install
npm run test:all
Result of the last command
Test each version separately
You can also run tests separately for each option:
- ModuloThreeFSM:
npm run test:api
- easy:
npm run test:easy
- standart:
npm run test:std
- advanced:
npm run test:adv