Code Dungeon (© 2017 Arjun Nair) is programming game where the user is tasked with coding a robot that can solve auto-generated mazes given only a 3x3 radar of the blocks directly around and below it.
The player is tasked with programming a class that sits within the robot package and is a child of the abstract Robot class. It inherits the public Response getResponse(boolean[][] radar) method, which the program uses to determine the robot's next move. The radar, a 3x3 array, represents the traversability of the blocks directly surrounding and below the robot.
The program will loop through the 3x3 array of tiles around and under the robot, inputting the following radar into your robot by calling the public Response getResponse(boolean[][] radar) method.
boolean[][] radar = {{false, true, false}, {false, true, true}, {false, true, false}};Thus, the player must code an algorithm that can adjust for the robot's previous radar inputs and make a logical decision of where to move next dependent on the current understanding of the overall map. The ultimate goal of the game is for the player's robot to find the checkpoint, a chest, with 100% efficiency on any hard mode map, demonstrating a solid understanding of mathematics, visualization, and computer science.
public class SillyBot extends Robot { public Response getResponse(boolean[][] radar) { if(radar[0][1]) return new Move(Direction.UP); return new Move(Direction.DOWN); } }Levels are automatically generated by the computer corresponding to their difficulty level, ensuring that hardcoding through a level is impossible. Thus, your robot's solving algorithm must be generalized to find the chest checkpoint in the most efficient manner for every possible situation within a difficulty setting.
On easy difficulty, the user's robot must navigate through a relatively straightforward path with no branching in order to secure 100% efficiency. It's usually either a hit or miss with this one, as robots given such simple maps usually either succeed flawlessly, loop around part of the path forever, or fall into the pit.
On normal difficulty, the user's robot must explore a branching path in order to locate the checkpoint. Because stepping on a tile more times than necessary deducts from the robot's overall efficiency, it is necessary to collect, store, and access data from previous radars in order to find the best move so that efficiency isn't deducted.
On hard difficulty, the user's robot must explore a branching path with rickety bridges scattered across the map which break upon one use of the bridge, making it necessary for the robot to repair the bridge if it wants to traverse the area.
For more information, use the javadocs in the CodeDungeon\docs\docs folder. This elementary information should be enough to construct your robot's responses; however, there are supplementary methods offered in the API.
Directions:
Direction.UP Direction.DOWN Direction.LEFT Direction.RIGHTResponses:
return new Move(Direction d) //Moves robot in desired direction if possible, otherwise deducts from efficiency but does nothing. return new RepairBridge(Direction d) //Repairs bridge in desired direction if possible, otherwise deducts from efficiency but does nothing.Download all the files, import them into a Java IDE, and run the public static void main(String[] args) method in the Code Dungeon/codedungeon/Main.java file. In order to insert your robot into the game, place the .java file in the Code Dungeon/robot folder and add uploadedRobots.add(new YourRobotClassName()); to the uploadRobots() method in the Code Dungeon/robot/Robot.java file.




