Toy Robot Challenge — a Java 21 CLI that places and moves a robot on a 5×5 table.
mvn compile exec:javaEnter commands one per line (Robot Challenge spec). End input with a blank line.
PLACE 0,0,NORTH
MOVE
REPORT
Expected output: 0,1,NORTH
Non-interactive example:
printf 'PLACE 0,0,NORTH\nMOVE\nREPORT\n\n' | mvn -q compile exec:javamvn compile exec:java -Dexec.args="commands.txt"The file is read line-by-line until the first blank line (same rule as stdin). If no argument is given, the app reads from stdin.
mvn test
# Tests run: 78, Failures: 0, Errors: 0, Skipped: 0flowchart LR
Input[stdin or file] --> Parser[CommandParser]
Parser --> CLI[TextInputInterface]
CLI --> Simulator[RobotSimulator]
Simulator --> Table[Table 5x5]
Table --> Robot[Robot state]
Simulator --> Output[REPORT output]
| Layer | Package | Responsibility |
|---|---|---|
| CLI | com.andywong.cli |
Parse command lines, read input, print REPORT |
| Application | com.andywong.application |
Apply spec semantics (ignore invalid moves/placements) |
| Domain | com.andywong.domain |
Table bounds, robot state, directions |
Main entry point: com.andywong.cli.TextInputInterface
Phases are tracked in docs/REFACTOR_ROADMAP.md. Summary:
| Phase | Focus | Status |
|---|---|---|
| 1 | Build tooling, parsing, test isolation | Done — PR #2 |
| 2 | Spec-aligned behavior, integration tests, file input | Done — PRs #4–#6 |
| 3 | Clean architecture (no singletons, layered packages) | Done — PRs #8–#12 |
| 4 | Polish (CI, edge-case tests, hardening) | Done — PRs #14–#17 |
| Slice | Change |
|---|---|
| 4a | GitHub Actions CI (mvn test on push/PR) |
| 4b | Parameterized edge-case tests (edges, corners, re-PLACE) |
| 4d | README polish and CI badge |
| 4c | CommandParseException and error-handling docs |
- Java 21
- Maven 3.8+
- JUnit 5
- Refactor roadmap — full phase plan and acceptance criteria
- Historical notes — pre–Phase 1 issues and root causes
- Error handling — which layers throw vs. ignore
- AGENTS.md — notes for cloud agents (stdin, main class, test count)
- Robot Challenge spec — official requirements