Grid Game Controls

Your goal is to extinguish all three fires by dropping the object on them. After extinguishing a fire, you must pick up the object again to extinguish the next fire.

Prompts Used to Generate This Application:

write an application with html and javascript in a single index.html file. the application draws an 10x10 grid with a player positioned at 9,9, facing a random cardinal direction. the player should have an arrow centered on it. the player can move forward one cell at a time or turn 90 degrees to the left or right. make it so that I can control the player with my left, right and up arrow keys. the application should also expose functions to the developer console for movement; moveForward(), turnLeft(), and turnRight().

now add an object to the grid at a random location, represented by a solid circle. the player can pick up the object when facing it. use the spacebar for that action. The player can also drop an object they are carrying with the spacebar, which places it in the cell in front of the player. expose these actions with drop() and pick() functions as well.

change the player's representation to show that they are carrying an object. surround the grid with numbers showing the coordinates of the cells. expose a function moveObjectTo(x, y). this function should efficiently move the player to the current location of the object, pick up the object, and drop it at x,y. also allow this functionality to be performed with the enter key, where the user is prompted for the x,y coordinates to move the object to.

please fix the moveObjectTo function. it does not pick up the object. keep in mind that the player needs to be facing the object to pick it up. It cannot pick up the object if it is on top of it.

add some text to describe the keys and commands

Add some text under the grid that shows the prompts I gave you to generate this application. Include this prompt as well.

make it so that the prompt text at the bottom is wrapped, instead of a horizontally scrolling section.

finally, let's make this into an actual simple game. the grid should also contain three randomly positioned "fires". the fire is represented by a red cell. the player can put the fires out by dropping the object on the cell that contains the fire. the player wins after putting out all three fires. the game restarts three seconds later.

the object should not be consumed by the fire

the player must pick the object up again, after dropping it on a fire