I've added one more feature to this game. It stores the current state in a session, so whenever we create a new game we can update the racers position and check the current state.
If we specify the names of the racers in the first row then this means it is a new game. (e.g. racer1,racer2) If we don't specify the names of the racers then this means that this input is an update to the current game.
The output always gives the actual result. If one of the horses wins (reaches 220 yars), the game does not take more updates.
Could be done in the future:
- The code's main functions are tested, but some more unit tests should be added.
- Also some htmlunit tests could be added.
- The validation of the input should be done on the client's side (JavaScript) as well. The client side should be tested as well (e.g. with Jasmine).
- The client side could have some design.
- Some refactors could be done to have a better architecture (detailed specification needed).
- A new race should be generated by some RaceFactory later.
- Java
- Gradle
- Preferred IDE/Text editor
- Internet connection
$ ./gradlew test
: run tests$ ./gradlew build
: builds the project$ java -jar build/libs/horse-racing-0.1.0.jar
: runs the server
Point your browser to http://localhost:8080/horse-racing to read the wording of the exercise.