Skip to content

Match the rows from 1-15 to win the game. Using HTML, CSS, Javascript

Notifications You must be signed in to change notification settings

bsewp045/FifteenPuzzle

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Assignment Write a web page that enables the user to play the game of 15. There is a 4-by-4 board (implemented as an HTML 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. Requirements

  1. Your program should create a board with the tiles out of order. The user’s goal is to arrange the tiles in sequential order row by row. Using the DOM and the onclick event, write a script that allows the user to swap the positions of the open position and an adjacent tile. [Hint: The onclick event should be specified for each table cell.]
  2. Your program should determine when the game is over, and then prompt the user to determine whether to play again. If so, scramble the numbers using the Math.random method.
  3. Your program should allow a user quit the current game and start a new game (create a “New Game” button for it).
    1. Your program should allow a user create a simple game with only one tire out of position so that a user can solve the puzzle with one move (create a “Simple Game” button for it).
    1. Your program should count the number of moves a user has already made in the current game.
    1. Your program should record the amount of time a user has already spent on the current game.
    1. Your program must work in both Internet Explorer and Google Chrome.
    1. Your program must be written in JavaScript. You are not allowed to use any JavaScript library such as jQuery.

About

Match the rows from 1-15 to win the game. Using HTML, CSS, Javascript

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 64.7%
  • HTML 25.3%
  • CSS 10.0%