This assignment may be submitted for full credit until Wednesday, October 14th at 11:59pm. Late submissions will be accepted for one week past the regular submission deadline but will receive a 20pt penalty.

computer science

Description

Submission Guidelines

This assignment may be submitted for full credit until Wednesday, October 14th at 11:59pm. Late submissions will be accepted for one week past the regular submission deadline but will receive a 20pt penalty. Submit your work as a single HTML file.  It is strongly recommended to submit your assignment early, in case problems arise with the submission process.

Assignment

For this assignment, you will write a tic-tac-toe application in HTML and JavaScript, using an HTML <canvas> tag. The game will be played "hot seat" where players take turns using the same device.

 

Requirements:

1)     The canvas should be 600px tall and wide, with the gameplay area occupying most of the canvas.

a.     The X's and O's may be drawn using polygons or large-font text

b.     The grid should be drawn using polygons, specifically long, thin rectangles

2)     Before & between games, the canvas will show an "attract mode" screen showing a blank 3x3 grid in the canvas

3)     Additional HTML components:

a.     Two <input> tags, appropriately labeled, where the players can enter their names

b.     An appropriately-label HTML <button> that starts the game

4)     Gameplay:

a.     Players will be randomly assigned to X and O, with X moving first

b.     Players will take turns placing X's and O's by clicking on open grid squares

c.     Text written on the canvas will indicate which player's turn by name and X or O, e.g., if it's Joe's turn and Joe is X, the text would read "Joe (X) to move"

d.     Invalid moves should not be permitted but no game action is required when a player clicks on an unavailable square

5)     After each player's move, the game will check whether the game has ended

a.     After a victory, a line will be drawn through every winning sequence of X's or O's – note that a winning move might make more than one winning sequence – and congratulatory text will appear on the canvas, e.g, if Joe wins, it might read "Joe wins!"

b.     If the grid is filled without a winner, the text "tie game" will appear on the canvas

c.     In either case, a timer will start - after five seconds, the canvas will return to attract mode with the players' names retained in the input tags

Evaluation

Your assignment will be graded according to whether the game plays correctly, with all the required elements present, functional, and with correct formats & appearances. Any page or gameplay elements not specified are not required.


Related Questions in computer science category