Question: using Java to complete following assignment Run Away! Run Away is a text-based game where the player must outrun a killer rabbit to survive. The
using Java to complete following assignment
Run Away!
Run Away is a text-based game where the player must outrun a killer rabbit to survive.
The Board
- The board is made up of a 5x5 grid of rooms.
- The player always starts randomly in 1 of the 5 rooms on the far left.
- The Rabbit always starts in the center.
- As the Rabbit moves, he leaves behind a fiery trail that is deadly to the player.
Below is a picture 4 turns into the game.
| (Fire) | (Fire) | |||
| (Fire) | (Fire) | Rabbit | ||
| Player |
The Rules
- Each round, both the Rabbit and the player get to move 1 room (not diagonally).
- The Rabbit moves according to the following algorithm:
- If on the same row, move 1 column towards player.
- If on the same column, move 1 row towards player.
- If on a different column and row choose row or column move with 50% random probability.
- The player may choose to move either North, West, South, East, or stay put. To move, the user types W, A, S, or D and then hits Enter. To stay put, the user simply hits Enter. If the player tries to leave the grid she bumps into a wall (staying put).
- If, at the end of the round, the player ends up on the Rabbit or on the fiery trail, she dies.
- If the player survives 15 turns, she wins.
Sample Game 1
Welcome to the Rabbit Cave! You Will Die, Unless You Outrun the Rabbit! Commands: WASD to Move, Q to Quit. . . . . . . . . . . P . R . . . . . . . . . . . . Enter Cmd: q Bye.
Sample Game 2
Welcome to the Rabbit Cave! You Will Die, Unless You Outrun the Rabbit! Commands: WASD to Move, Q to Quit. . . . . . . . . . . . . R . . . . . . . P . . . . Enter Cmd: d . . . . . . . . . . . . * . . . . R . . . P . . . Enter Cmd: d . . . . . . . . . . . . * . . . R * . . . . P . . Enter Cmd: d . . . . . . . . . . . . * . . . * * . . . R . P . Enter Cmd: d . . . . . . . . . . . . * . . . * * . . . * R . P Enter Cmd: d You bump into a wall. . . . . . . . . . . . . * . . . * * . . . * * R P Enter Cmd: w . . . . . . . . . . . . * . . . * * . P . * * * R Enter Cmd: w . . . . . . . . . . . . * . P . * * . R . * * * * Enter Cmd: w . . . . . . . . . P . . * . R . * * . * . * * * * Enter Cmd: a . . . . . . . . P R . . * . * . * * . * . * * * * Enter Cmd: a . . . . . . . P R * . . * . * . * * . * . * * * * Enter Cmd: a . . . . . . P R * * . . * . * . * * . * . * * * * Enter Cmd: a . . . . . P R * * * . . * . * . * * . * . * * * * Enter Cmd: s . . . . . R * * * * P . * . * . * * . * . * * * * Enter Cmd: s . . . . . * * * * * R . * . * P * * . * . * * * * Enter Cmd: s You escape and vow to return with the Holy Hand Grenade! You Win! Game Over.
Sample Game 3
Welcome to the Rabbit Cave! You Will Die, Unless You Outrun the Rabbit! Commands: WASD to Move, Q to Quit. . . . . . . . . . . . . R . . . . . . . P . . . . Enter Cmd: w . . . . . . . . . . . . * . . P . R . . . . . . . Enter Cmd: d The Rabbit Ate You! You Lose! Game Over.
Sample Game 4
Welcome to the Rabbit Cave! You Will Die, Unless You Outrun the Rabbit! Commands: WASD to Move, Q to Quit. . . . . . . . . . . . . R . . P . . . . . . . . . Enter Cmd: d . . . . . . . . . . . R * . . . P . . . . . . . . Enter Cmd: d . . . . . . . . . . . * * . . . R P . . . . . . . Enter Cmd: w You Died in the Rabbit's Flames! You Lose! Game Over.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
