Skip to end of metadata
Go to start of metadata

This week's project is implement the game hunt the wumpus.

The Graph class adds edges to the vertices, returns the total number of vertices, and implements a single-source shortest-path algorithm. 

(the shortest path algorithm) 

The Vertex class has the following features:

1. return the compass opposite of a direction

2. connect Vertex other via Direction dir

3. return the neighbor at the Direction dir

4. return all the neighbors

5. return and set the cost

6. return and set the mark

7. print out the number of neighbors, the cost, and the marked flag

8. compare the cost of the given Vertex 

9. check and set the room to visible

10. draw the room in black; if the wumpus is near by, draw the room in red 

Hunter class 

1. check and set the status of the hunter

2. return Hunter's current location

3. update its location after moving

4. draw a hunter

Wumpus class  

1. check and set the status of the wumpus

2. return Wumpus's current location

3. draw the wumpus

4. set the wumpus to visible 

HuntTheWumpus class simulates the game. The user needs to specify the size of the grid (within the size of the landscape 20*30) and the type of grid(1 = regular; 2 = irregular). 

1. checkBounds method returns true if the new vertex is within the boundaries of the grid

2. vList method returns the list of added vertices on the grid

3. setUpGame method initialize the game

4. setupUI method sets up the UI controls 

5. iterate implements one iteration of the game

6. killWumpus method specfies the rules 

7. the control class sets up the user interaction. The user press the four arrow keys to move the hunter. If the user wants to shot the arrow, he or she needs to press the space key first and then press the arrow key.

My first extension is draw a figure to represent the hunter. If the hunter is alive, it's blue. Otherwise, it's red. If the wumpus is alive, it's green. Otherwise, it's black.

My second extension is adding a replay button.

My third extension is generate a random graph and guarantee a path, so each game is different.

(regular grid)

(irregular grid)

I got help from Joseph, Vivek, Bilal, Dale, and Stephanie.