achanos
12-11-2010, 11:58 AM
This is an assignment for my college. It is the following : I just want the JavaScript part.
Write a java script program that will utilize events, functions, and random number generation to simulate the following game:
• The game is presented as a square table with 9 pictures embedded inside a form. These pictures
are pieces of a complete car picture.
• The pictures are named 1.jpg, 2.jpg … 9.jpg.
• The game begins by clicking on a Start button
• Once the Start button is clicked the pictures in the table will be randomly rearranged.
• You win the game by rearranging the pictures in an ordered manner so as the complete picture of
the car will be produced.
• This is accomplished by clicking two pictures to swap them. This step will be repeated until the
table is rearranged.
• The two clicked pictures must be adjacent horizontally or vertically but not diagonally. If the user
clicks on two diagonally adjacent pictures then nothing will happen.
• The game must be completed within a certain amount of time for example 30 seconds.
• You can create three levels of difficulty depending on the time given to solve it. For example a
beginner is given 60 seconds, an intermediate user is given 45 seconds and an advanced user is
given 30 seconds to complete it.
Write a program that will implement the game in a presentable manner using the techniques learned in class.
Write a java script program that will utilize events, functions, and random number generation to simulate the following game:
• The game is presented as a square table with 9 pictures embedded inside a form. These pictures
are pieces of a complete car picture.
• The pictures are named 1.jpg, 2.jpg … 9.jpg.
• The game begins by clicking on a Start button
• Once the Start button is clicked the pictures in the table will be randomly rearranged.
• You win the game by rearranging the pictures in an ordered manner so as the complete picture of
the car will be produced.
• This is accomplished by clicking two pictures to swap them. This step will be repeated until the
table is rearranged.
• The two clicked pictures must be adjacent horizontally or vertically but not diagonally. If the user
clicks on two diagonally adjacent pictures then nothing will happen.
• The game must be completed within a certain amount of time for example 30 seconds.
• You can create three levels of difficulty depending on the time given to solve it. For example a
beginner is given 60 seconds, an intermediate user is given 45 seconds and an advanced user is
given 30 seconds to complete it.
Write a program that will implement the game in a presentable manner using the techniques learned in class.