Hunt The Wunpus Overview
The program designs and implements a controller that uses a refactored version of the room mazes from our previous assignment as a model to implement a text-based version and Graphical User Interface of Hunt The Wumpus game. It uses abstraction wherever applicable and minimizes code repetition.
List Of Features
-
The program exposes all game settings through menus. These settings include maze size, number of walls, number of players (1 or 2), and difficulty (specified as number of superbats, pits, etc).
-
The program provides an option for restarting the game as the same game.
-
The program allows the maze to to be bigger than the area allocated to it on the screen providing the ability to scroll the view (10X10) maze.
-
The program allows the player to move through the maze using a mouse click in addition to the keyboard arrow keys. A click on an invalid space in the game would not advance the player.
-
The program provides an option for two-players where players take turns making moves or shooting arrows as they race to be the first to kill the Wumpus.
-
The GUI provides a clear indication of the results of each action a player takes as well as whose turn it is.
-
A player wins by slaying the Wumpus
-
A player loses by falling into a bottomless pit, being eaten by the Wumpus, or running out of arrows.
How to Run
The jar file HWTGUI.jar can be found in res folder. Use the following command to run the jar file for text-based version:
java -jar HTWGUI.jar --text
Use the following command to run the jar file for text-based version
java -jar HTWGUI.jar --gui
[Note: TO RUN THE GUI VERSION, PLACE THE jar FILE OUTSIDE THE res FOLDER AND RUN IT.]
How to Use the Program
For Text-Based Version
The user needs to add the configuration details of the maze initially
-
Enter the type of Maze when prompted by the program. (W for Wrapped and U for Unwrapped maze)
-
Then enter the number of rows, columns and remaining walls respectively.Enter each number followed by a space. (ex : 3 3 3)
-
The program then prompts the user to add the number of bats, pits and arrows. Enter the details in the exact order. (ex : 3 4 3)
Once the configuration details are added, the user can proceed to play the game.
-
The user selects a starting position from a list of available rooms. Invalid position will throw an exception.
-
The user is then provided with a list of positions to move to. The user can either move to any of the position or shoot an arrow.(M/S)
-
If the user decides to Move, then User can choose from a list of possible positions to move to.
-
If the user decides to shoot an arrow, the user should provide the number of caves the arrow should traverse. Then the user is prompted to enter the cave through which the arrow needs to be aimed.
-
The program ends if the user slays the Wumpus or if the user is terminated (by falling into a pit,running out of arrows or getting eaten by a wumpus).
For GUI-Based Version
-
The user is first introduced to the game menu where the user can start the game, read the rules of the game and quit the game.
-
The user can select the maze type, player mode and change maze settings from the menu bar.
-
The player can use the arrow keys to navigate through the maze using the keyboard.
-
To navigate using the mouse, the player should click on a valid room to move to.
Description Of Example Run
TextExample Runs
-
Example Run 1 -
i) The example run shows the player being transported by a Super-Bat. The player also ducks the bat in multiple locations. The Super-Bat finally drops the player in a cave containing a pit.
-
Example Run 2 -
i) The example run shows the player losing by falling into a pit.
-
Example Run 3 -
i) The example run shows the player being eaten by a Wumpus.
-
Example Run 4 -
i) The example run shows the player killing the Wumpus.
GUI-Example Runs
- The example 1 run shows the player losing by falling into a pit.
- The example 2 run shows the player being eaten by a Wumpus. It also displays the scrollpane on the panel.
- The example 3 run shows the player killing the Wumpus.
- The example 4 run shows the grid in two player-mode.
Assumptions
-
If a bat and a Wumpus are in the same location, then the bat picks up the player 50% of the time before the Wumpus can eat it.
-
If no inputs are given by the user then the program sets default values.
-
The number of bats or pits cannot be greater than the number of rooms.