This kata is about implementing a CodinGame exercise called Bender, Episode 1
The instructions can be found at the following location and are the sole property of CodinGame: https://www.codingame.com/ide/puzzle/bender-episode-1
- IntelliJ (Community edition is enough) is recommended as it features much more reliable Annotation Processor support compared to Eclipse.
- JDK should be at least JDK 8.
Once project opened, you will have to enable annotation processor support: https://immutables.github.io/apt.html#intellij-idea
- Ensuring that code and Javadoc for dependencies are downloaded will help for quick reference in hints.
- Check Build project automatically box in Preferences
- You can run all tests of a package by right clicking the package and run tests.
- Enable Toggle auto-test icon in any test tab of Run Tool Window
Switch to kata
branch to work on code without implementation.
You are free to look at proposed solution in master
branch if you feel stuck.
src/main/java/practicalimmutability/kata/robot
contains the kata.src/test/java/practicalimmutability/kata/robot
contains the tests for the kata.
Here tests will already be available and you'll mostly have to implement the body of the methods. There's a number of hints and links pointing to Vavr code to help you (Ctrl + Click or Cmd + Click).
Satisfy existing tests to complete implementation.
- Complete
Direction
implementation - Complete
Position
implementation - Complete
Tile
implementation - Complete
CityMap
implementation - Complete
Robot
implementation - Complete
Scene
implementation- Use
instanceof
or pattern matching - Keep visitor pattern implementation for later
- Use
- Optionally start playing with
RobotApp
application to help visualize what happens - Complete
SceneTracking
implementation - Complete
TrackedScene
implementation - Play with
RobotApp
application to help visualize what happens
Now implement the following features with your own tests.
- Display either the directions or a loop diagnosis following the last steps of CodingGame instructions
- Try adding class invariant on
CityMap
such as- Presence of exactly one start
- Presence of exactly one booth
- Absence of teleporters or presence of exactly 2 teleporters
- Allow presence of 2 or more teleporters
- Each teleporter will chain to the next teleporter.
- Last teleporter will chain to the first one.
- Order of teleporter should be determined by
y
thenx
coordinate. - This semantic will preserve the behavior of scenarios involving 2 teleporters.
- Modify
Tile
andScene
implementation to use visitor pattern