board game

Project Specification

In this project, you are going to develop a board game which scores by aligning five or more balls of the same color horizontally or vertically. In this game, we have an 8*8 board and balls of 6 distinct colors: green,blue,orange,red,purpleandcyan. Initiallytheboardisemptyexceptfor3randomlygenerated balls. To “randomly generate” a ball, you should:

  •   Generate a ball with a random color.
  •   Place the ball in a random position that is unoccupied.

    The game interface is as follows (the “highest score” is used to record a player’s best score in history):

    Through the course of the game, the following steps are taken:

  1. The player picks and moves a ball to a valid new position on the board. A position is “valid” if

     The position is not occupied by another ball.

     There is a path of empty cells from the old position to the new position .

  2. If a scoring alignment is made, remove all the balls in the alignment, add the same amount to

    the player’s score and go back to step 1. Otherwise, go to step 3.

Score 0

Highest Score

0

A “scoring alignment” is a horizontal or vertical line of at least 5 balls of the same color. E.g., if the player makes a horizontal line of 5 green balls, all these 5 balls are removed from the board and 5 is added to his score.

3. Randomly generate 3 new balls on the board. If the board is not full, go back to step 1. Otherwise, the game is over.

Some examples of the game:

1. A sample scoring alignment: a vertical line of 5 green balls. In this case, the 5 balls should be removed from the board, and the player should get a score of 5.

Score 0

Highest Score

120

  1. Placements of balls that do NOT score. In these cases, no balls are removed from the board.
  2. Invalid attempts to move a ball: (a) to an occupied position (b) to a position that is unreachable .

(a) (b)

Some further notes about the program:

1. When the player first pick ball A and then pick a position that is occupied ball B, you can assume thattheplayerhasa changeofmindandre-picksballB.

Score 0

Highest Score

120

  1. When a ball is moved from one position to another, the program should choose the shortest path to make the move.
  2. When the program generates new balls on the board, it should check if the new balls result in a scoring alignment.
  3. Some animation is required. For example, when a ball is generated, picked, moved or remov ed from the board, animation or special effect should be made to represent the action.
  4. The program should design an interface that provides as good user experience as possible.

System Requirements

Your program should be written solely in three of the technol ogies: html, css and javascript. Further, no image file is allowed.

Documentation

You have to maintain two documents during the course of this project: a software design specification and a test report. It is recommended that you write the software design specification before coding and write the test report while features of the program are tested.

The templates of the two documents are available on ispace.

Grading

The full mark for the project is 100 and it consists of:

 Correctness – 50’
o All the required features are provided.
o All functions of the program run smoothly and correctly, including

 Ballgeneration
 Ballselectionandmovement  Alignmentdetection
 Scoring

o The program does not crash in any case.

o No memory leak is found.  User-friendliness – 10’

o The program should provide an interface that is as friendly to the users as possible.  Code–20’

o Reasonable data structures are used.
o Efficient algorithms are applied.
o The code is neat.
o Comments are provided which explain every coding block.

 Documentation – 20’
o The software design specification and the test report are written in compliance with the

templates.

Important Dates

November 30: Software design specification submission – a first version of the software design specification should be submitted to iSpace (Later, you may modify this document while you develop your program).

December 20: Project deadline – all the code (html, css and javascript files. Please name the main page of the project “main.html”) and the two documents (a final version of the software design specification and a test report) should be put into a zip file named with your student id (e.g.: i330003099.zip) and submitted to iSpace.