This is a Java maze/pathfinding game project. The player controls a sewer diver who must first find a hidden ring, then escape the sewer before running out of steps while collecting as many coins as possible.
The project includes graph traversal, shortest-path search, a custom priority queue implementation, GUI assets, and JUnit tests for graph/data structure behavior.
- Maze-based exploration game
- Two-phase objective:
- seek the hidden ring
- escape before steps run out while collecting coins
- Graph-based maze representation
- Shortest-path computation for weighted directed graphs
- Custom priority queue interface and implementation
- Pathfinding logic for safe exit routes
- Coin collection strategy during escape
- Optional graphical interface
- Command-line options for seeds, repeated runs, and no-graphics mode
- JUnit tests for shortest paths and priority queue behavior
- Java
- Java Swing
- JUnit 5
java-sewer-maze-pathfinder/
├── README.md
├── .gitignore
├── src/
│ ├── cms/
│ ├── datastructures/
│ ├── diver/
│ ├── game/
│ ├── graph/
│ └── gui/
├── tests/
│ └── graph/
└── res/
Make sure Java is installed.
Compile the source files:
javac -d out $(find src -name "*.java")Run the game:
java -cp out game.MainBy default, the game runs with the graphical interface enabled.
To run in terminal/no-graphics mode:
java -cp out game.Main --nographicsTo run the game with a fixed random seed:
java -cp out game.Main -s 12345This is useful for reproducing the same maze.
To run multiple games in a row:
java -cp out game.Main -n 10 --nographicsThis prints the average score across multiple runs.
--help Show usage information
--nographics Run without the graphical interface
-s <seed> Run with a specific random seed
-n <runs> Run multiple games
java -cp out game.Main
java -cp out game.Main --nographics
java -cp out game.Main -s 12345
java -cp out game.Main -n 10 --nographicsThe main player strategy is implemented in:
src/diver/McDiver.java
This class implements the SewerDiver interface and defines behavior for both phases of the game:
seek: explores the maze to find the ringscram: escapes the sewer while trying to collect coins
The shortest-path logic is implemented in:
src/graph/ShortestPaths.java
The priority queue implementation is in:
src/datastructures/SlowPQueue.java
This project includes JUnit tests in:
tests/graph/
The tests cover:
- priority queue behavior
- shortest-path computation
- graph path reconstruction
If using IntelliJ, mark src/ as the source root and tests/ as the test root, then run the test classes in tests/graph/.
This project was completed as part of Cornell University CS 2110.
The course staff provided the overall project framework, including the game engine, GUI, maze representation, resource files, interfaces, and much of the surrounding support code.
My main implementation work focused on the pathfinding and algorithmic components, including:
- implementing the pathfinding logic used by the sewer diver
- writing the
seekstrategy to locate the hidden ring - writing the
scramstrategy to escape before running out of steps - using graph traversal to explore the maze
- using shortest-path logic to plan safe routes
- using priority queue behavior for pathfinding support
- reasoning about when to collect coins versus when to prioritize reaching the exit
The main file containing my work is:
src/diver/McDiver.java
The rest of the project structure was provided as assignment scaffolding by Cornell University, CS2110.