PA 6.2: Gridworld with moving enemies
- Due Apr 6, 2021 by 11:59pm
- Points 10
- Submitting a file upload
- File Types cpp
- Available after Mar 23, 2021 at 2pm
When completing this programming assignment, you may work with up to one other person. No groups of more than two are permitted.
Complete and extend gridworld from Lab 6: Arrays & Vectors II so that as the player moves throughout the world, the enemies approach the player (that is, all enemies should all take one step closer to the player's position on each move the player makes). If an enemy enters a treasure spot, the treasure should disappear. You should create a new function that moves the enemy positions in `world`. All necessary data should be passed using parameters—no global variables.
Here are the specs:
// Name:
// Date:
// Partner:
//
// Specifications checklist for PA 6.2 Gridworld with moving enemies
//
// General specs:
// [ ] the header includes your name and anyone you worked with
// [ ] the header includes this specifications checklist with all completed
// specifications checked off: [x]
// [ ] the code is indented properly (inside of every block, code is indented
// one more tab)
// [ ] each chunk of code that "hangs together" (works toward a higher level goal):
// [ ] includes a brief, useful comment above it
// [ ] is separated from the next chunk by a blank line
// [ ] there are no really long lines of code or comments (if you have long
// lines, split them across multiple shorter lines)
// [ ] identifiers are well named
// [ ] the program compiles
// [ ] the program runs without crashing or hanging
// [ ] all output and prompts look clean (correct spelling, capitalization,
// nothing squished)
// [ ] all prompts make it clear what data the user is expected to enter and in
// what format and work as expected
// [ ] the header includes your name and anyone you worked with
//
// Specific specs:
// [ ] all TODOs from Lab 6 are completed successfully:
// [ ] the grid world is displayed after each move in the format described in the `printWorld` JavaDoc
// [ ] the player is only prompted for valid moves
// [ ] invalid move selections cause the player to be reprompted
// [ ] the player's position in `world` is updated according to their move
// [ ] the player's previous position is erased
// [ ] the game is won when the player reaches the goal location
// [ ] the game is lost when the player enters an enemy's position
// [ ] on each move the player makes, the positions of all the enemies steps one closer to the players updated position
// [ ] treasure should disappear if "captured" by an enemy
// [ ] if an enemy "captures" the player, the player loses
// [ ] the code to do this is located in a dedicated function that is called from `playGame`
// [ ] the function has a properly formatted JavaDoc
If you are working with a partner, both of you must submit individually.