Project #6: Lion's Den
Escape the Lion's Den with the power of recursion and OOP
DESCRIPTION
Requirements
Write a program that allows the user to escape a den of Lions
This project must read a map from a file into a 2D Array and be written in an object oriented style.
STEP BY STEP
Part A - Tour The Code
Take some time to read over everything that's in the project
Make sure you understand what each part of the program is trying to do
Part B - Accessor Methods
Look for accessor methods with "fix me." You'll find these in: Player, Lion, and Den
Carefully implement these methods. Think about edge cases and efficiency.
For example, consider boolean canMoveToCell(int row, int col)
Can I move to a position that is out of the bounds of the array?
Can I move into a wall?
Does the order of these two checks matter?
Can I use another accessor method I just wrote to avoid code duplication?
Part C - Den - Display
Implement this method and make sure everything is displaying properly
Part D - Moving the Player
Complete the player's move method
Make sure you call it in Den's update() method
The valid input options are n s e and w. Do not change the control scheme.
Suggested process:
Basic version moves without thinking about obstacles. Test it.
Then worry about walls. Moving into a wall should just do nothing.
Then handle special cases:
If the player moved onto an exit, the player wins the game
If the player moved into a lion, the player loses the game
Test this! Make sure your conditions are all handled correctly before moving on.
Part E - Moving the Lions
Now you can implement the lion's move method.
Lion's cannot move into walls
Lions cannot move into each other
If a lion enters the player's space, the player loses the game.
Part F - Testing
This is a complex program with a lot of moving parts
Try and break it before submitting it.
EXTRA CREDIT IDEAS (+10%)
Additional Danger
Consider adding an additional enemy type that has a different behavior from lions.
Make sure you reduce the number of Lions accordingly. Your game shouldn't be too hard to beat.
It must represent additional complexity in your coding and not just be a copy/paste or simpler version of the same class.
Good Examples:
Jaguar moves toward the player, rather than moving randomly
Giant Frog moves two spaces at a time, leaping over obstacles
Boar only moves every other turn. When it moves, it moves an entire row or column - stopping at a wall.
Bad Examples:
Ghost Lion is a normal lion but can go through walls (this is just the lion but with bugs)
Cheetah is a normal lion but it moves twice per round (this is a single line of code)