Starting from:

$30

Assignment 3: Simplified Tetris Game

Assignment 3: Simplified Tetris Game

This assignment is done individually or by a group of two students.
In this assignment, you will use Javascript and html to implement a simplified Tetris game.
The simplified Tetris game consists of a 2D grid and 4 types of rectangle pieces. The rectangle pieces fall, one at a
time, onto the grid. Users can move the rectangle pieces to the left and right as they fall. Once an entire row is
formed, the row collapses. The game ends when the stack of rectangle pieces reaches the top of the canvas and no
new rectangle pieces are able to enter.
In this assignment, you will create a canvas, which is a 2D grid. The height of the canvas is 240 and the width is
180. You will implement the following four rectangle piece (which are different from the tetrimino pieces in the
standard Tetris game):
Size: 20*20 Size: 40(L)*20(W) size: 60(L)*20(W) size:80(L)*20(W)
The rectangle pieces will appear randomly. You can use Math.random() and Math.floor() to randomly generate an
integer between 1 and 4, which is used to determine which rectangle piece will appear next:
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/random
You will also create two buttons (left and right) to control the movement of the rectangle pieces. The rectangle
pieces can be moved to two directions: left and right, by 20 unless it hits a wall or another rectangle pieces.
Submission guideline
• Please hand in your source code electronically. The file name should be tetris.html.
• Write a README file (text file, do not submit a .doc file) which contains
▪ Names and email address of group members.
▪ (optional) anything special about your submission that the TA should take note of.
• Place tetris.html and README under one directory with a unique name (such as p3-[userid] for
assignment 3, e.g. p3-pyang).
• Tar the contents of this directory using the following command.
tar –cvf [directory_name].tar [directory_name]
E.g. tar -cvf p3-pyang.tar p3-pyang/
• Use mycourses to upload the tared file you created above.
Grading guideline
Readme, correct file names: 4’
Correctness: 96

More products