Question: Write a web page that enables the user to play the game of 15. Theres a 4-by-4 board (implemented as an HTML5 table) for a

Write a web page that enables the user to play the game of 15. Theres a 4-by-4 board (implemented as an HTML5 table) for a total of 16 slots. One of the slots is empty. The other slots are occupied by 15 tiles, randomly numbered from 1 through 15. Any tile next to the currently empty slot can be moved into the currently empty slot by clicking on the tile. Your program should create the board with the tiles out of order. The users goal is to arrange the tiles in sequential order row by row. Using the DOM and the click event, write a script that allows the user to swap the positions of the open position and an adjacent tile. [Hint: The click event should be specified for each table cell.]

For Full Points

Create a web page that enables the user to play the game of 15 with the following implementation specifications:

The initial tile arrangement will be random, including random location for the initial "blank area" (i.e., space location)

Use a 2-D array that stores the initial board configuration.

Use a 1-D array that stores the tiles that were selected while generating the solution.

Provide a "New Game" button that generates a new game configuration (i.e., randomize tile locations, reinitialize all data structures).

Provide an "Undo" button that removes the last move (i.e., must also remove the entry from the 1-D data structure; deactivate the button when returned to the original configuration).

Once winning configuration has been completed, output the initial configuration (i.e., 2-D array) and the solution (i.e., 1-D array)

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!