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 the initial configuration is randomized (enemies, treasure, the player, and the goal are placed at random spots in the grid world) and the player accumulates points when they enter spots that contain treasure ('$').
To randomize the placement of enemies, treasure, goal, and the player in the gridworld, clear those characters from the initialization of `world` in `playGame`. Declare and define a new function with this signature: `void placeEntity(char world[ROWS][COLS], char entity, int count)`, which should randomly place the `count` number of the given`entity` char in empty spots in `world`. Call this function from `playGame` for each of the four entities (enemies, treasure, the goal, and the player). E.g., calling `placeEntity(world, '&', 4);` will place four enemies on the board. Note that we only want 1 goal and 1 player.
You should track points by updating the `updateWorld` function and signature so that it takes a new pass-by-reference parameter that is the accumulated points in the game and update it according to whether the player's updated coordinates put them in a spot with a '$'. Update the `playGame` function to keep track of the points and display them each time the world is printed and again at the end of the game.
You should not add any global variables to the program; pass data using parameters only.
Here are the specs:
// Specifications checklist for PA 6.1: Gridword with random layout and points
// 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
// 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
// [ ] a player earns points when they enter a treasure's position
// [ ] the current number of points is displayed after each move and at the end of the game
// [ ] points are updated in the `updateWorld` function
// [ ] data is passed between `playGame` and `updateWorld` using parameters, not global variables
// [ ] the JavaDoc of the `updateWord` function is updated according to the new function signature
// [ ] a function with the signature `void placeEntity(char world[ROWS][COLS], char entity, int count)`
// is declared and defined
// [ ] the function includes a JavaDoc
// [ ] the function works as expected (randomly places `count` number of `entity` chars in empty
// spots in `world`
// [ ] the function is invoked correctly for each entity (enemies, treasure, goal, and player) in
If you are working with a partner, both of you must submit individually.