Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

C++ In this lab you are going to explore visualizing a grid-based Wumpus World u

ID: 670647 • Letter: C

Question

C++

In this lab you are going to explore visualizing a grid-based Wumpus World using ASCII art. We will build this program incrementally.

You need to take as input from the user the number of columns and rows. You also need to check if the inputs are within the accepted range of 2 to 9 inclusive. If the column size is invalid, output an error message: "Column size is illegal!" and similarly for the row size. For valid sizes, you then output the grid.

You need to add the user into the grid. We will use '*' to represent the user. The user's starting location should be random. You will output this location in the form "User location: (i, j)". When you display the grid, you should output '*' in the user's location. In this lab, we will use a fixed seed value of 13 for the random generator.

Generate a random location on the grid for the wumpus. The user and the wumpus cannot start at the same location. You will output this location in the form "Wumpus location: (i, j)". For output, use 'W' to represent the wumpus' location.

The last part of Wumpus World is adding in a pit. Create a random starting location for the pit. Again, ensure that the pit, the wumpus and the user are not starting on the same spot. You will output this location in the form "Pit location: (i, j)". For output, use 'o' to represent the pit.

Explanation / Answer

the goal for an agent who has ventured into the wumpus-environment is to find the gold in as few steps as possible without falling into a pit or being eaten by the wumpus and leaave the cave to enjoy the new found fortune. To be able to survive in the environment an agent gets percepts from the environment. Those precepts tell an agent about its immediate surroundings and can be taken as a basis for the actions an agent takes.

to be able to measure an agent's ability to fulfill this goal the following scheme for awarding a score to the agent is used:
- the agent starts its quest for gold with a score of zero points. ( @ position 1,1 that is upper left of map)
-for every action an agent takes its score is decreased by one point
- finding the gold is worth one thousand points.
- if an agent dies, its final score is minus ten thousand points.
- if an agent leaves the cave its final score is the amount of points he had when leaving the cave.

objects
- wumpus - a beast that eats anyone that enters its room.
- agent- the player that traverses the cave in search of gold and while trying to kill the wumpus.
- pits-bottomless pit that will trap anyone who enters the room except for the wumpus.

actions

there are 6 possible actions:
- a simple move forward.
- a simple turn left 90 degrees.
- a simple turn right 90 degrees.
- the action Grab can be used to pick up gold when in the same room as gold.
- the action shoot can be used to fire an arrow in a straight line in the current direction the agent is facing. the arrow continues until it hit and kills the wumpus or hits a wall.
- the action Climb can be used to climb out of the cave but only when in the initial start position.

Senses

there are five senses, each only gives out bit of information:
- in the square containing the wumpus and in the directly(not diagonal) adjacent squares, the agent will perceive a stench.

- in the squares directly adjacent to a pit, the agent will perceive a breeze.
- in the square where gold is, the agent will perceive a Glitter.
- when the agent walks into a wall, the agent will perceive a Bump.
- when the wumpus is killed, it emits a Scream that can be perceived anywhere in the cave.

assignment:
write a program that will attempt to solve the wumpus world problem:

1. user will enter the dimensions of the cave (the algorithm trying to solve the problem should not know the dimensions of the cave)

2. user will enter the locations of the pits(0-n), wumpus (0 or 1) and gold( 0 or 1) (the algorithm trying to solve the problem should not know the locations)

3. the program will need to complete the game with the highest number of points possible.

4. the program should display it's moves and senses(breeze, stench, etc...) and keep track of the score