Home Page > > Details

Computing Science CMPT 361 Fall 2019

Assignment #1 (20 marks)

Due October 9, Wednesday, at 11:59 pm.

Problem 1 (16 marks): Tetris meets Falling Fruits

Using OpenGL, you will implement a simple interactive game that combines some features

from Tetris and some from Falling Fruits. Any visual flair that you wish to add to the

appearance of your game will be judged by the grader and may be credited at their discretion.

(The Falling Fruits game is similar to Tetris. A web search will find you several versions of it.)

Your game window consists of a 20x10 square grid of appropriate size, e.g., so that the window

will fit in the screen comfortably. Different fruits are represented by squares of different colors.

You program should have five different fruits with color coding specified in figure (b). Each

time, four fruits (chosen randomly with repetitions from the five types of fruit) fall from the

top of the screen. As indicated in the figure (c), these fruits are arranged in a I, S, L, or T

shaped Tetris tile, which has a pivot of rotation indicated by a black dot (always on the fruit

indicated by the letter c). The T shape is not pictured but has squares (0,0), (-1, 0), (1, 0), and

(0, -1) with a pivot center at (0,0). Also, the L and S shapes should come in left- and righthanded

versions (left-hand versions are shown—flip horizontally to get the right-hand

versions). We will not use the 2x2 square Tetris tile.

Grape Apple Banana Pear Orange

Purple Red Yellow Green Orange

(b) Use squares of different colors to represent

different fruits. This table shows the color coding of

fruits.

(a) The screen of the falling fruit game.

Computing Science CMPT 361 Fall 2019

(c) The first column shows the “base” I, S, and L shapes; the other columns show the shapes when

rotated.

You are advised to complete this problem in several steps:

(a) [4 marks] Tile and grid rendering and tile downward movement

Set up the game window with grid lines. At each time, randomly select a Tetris tile consisting

of four fruits and drop it from the top of the game window. The starting position and

orientation are chosen randomly. You can control the speed of its movement to suit your

game playing. Movement of the tiles will be aligned with the grids and at uniform speed. For

this step, the tiles can drop straight through the bottom. After one tile disappears, a new tile

is dropped.

(b) [2 marks] Stack-up

In this step, the tiles will stack up on top of each other and the bottom of the game window

will offer ground support. When any square of a falling tile is stopped, the entire tile stops

(this is the Tetris rule for stacking, not the Falling Fruits one).

(c) [6 marks] Key stroke interaction and tile movements

The four arrow keys will be used to move the dropping fruit array. A pressing of the “up” key

rotates the tile counterclockwise about its pivot, 90° at a time. The “left” and “right” key

presses result in lateral movements of the array, one grid square at a time. The “down” key

accelerates the downward movement. Pressing any of the arrow keys should not slow the

downward movement of a tile.

At no time should you allow a tile to collide with any existing tiles or the border of the game

window.

(d) [4 marks] Additional game logic

1) When three of the same fruit are consecutive in a row, column, or diagonal, they will be

removed and the fruit directly above them will be moved down one row for each tile removed.

2) When a row is completely filled, it is removed and the tiles above it will be moved one row

down.

Game terminates when a new tile piece cannot be fit within the game window. Press ‘q’ to

quit and ‘r’ to restart.

Computing Science CMPT 361 Fall 2019

Instructor: Tom Shermer Simon Fraser University

Note that the above steps build on top of each other, in order. You need not submit individual

programs to correspond to these steps. If you can implement all the required parts, a single,

complete program is sufficient.

Although the marks have all been alloted for functionality above, the grader may also deduct

marks for sloppy or confusing code, or for failure to follow laboratory procedure (e.g. not

handing in the files specified).

If you’d like to extend this mini-project, here are some suggestions:

• Add extra keyboard commands, such as ‘p’ to toggle ‘pause mode’.

• Make each fruit have its own shape. This could be a simple iconic shape chosen from

a 3x3 or 4x4 subgrid, or a complex shape derived from an image file. Make the shapes

as visually distinct as possible.

• Add a fancy border around the playing grid, possibly with a name for the game written

above or below.

• Implement a method of scoring based on the fruits eliminated. Display the score.

• Keep a list of high scores that is displayed when the game finishes.

• Have the game speed up as the score gets higher.

• etc.

You may earn full marks without implementing any of these or other extensions.

Problem 2 (4 marks): Rigid-body transformations

Place your answers to the following, along with your work, in a pdf file named matrix.pdf.

Suppose you are given a 3D transformation Φ specified by a matrix M of the following form.

where the upper 3 by 3 submatrix 𝑅 of 𝑀 is orthonormal, i.e., 𝑅𝑇 = 𝑅−1.

1. [1 mark] What is the inverse of M? Note that you should not use brute force or a

package such as Maple or Matlab to answer this question.

2. [1 mark] Let V = P2 - P1 be a vector in 3-dimensional real (Euclidean) space, where P1

and P2 are points in that space. Is it the case that Φ is linear in 3D? In other words,

does Φ(P2 - P1) = Φ(P2) - Φ(P1) ?

3. [2 marks] Prove that the transformation Φ preserves lengths, angles, and the area of

triangles in 3D.

Computing Science CMPT 361 Fall 2019

Submission: In a zip file, include:

• All source code,

• a Makefile to make the executable called FruitTetris (the make command should be

simply “make”),

• a README file that documents any steps not completed, additional features, and any

extra instructions for your TA,

• and your matrix.pdf

and submit this zip file via CourSys.

Contact Us(Ghostwriter Service)

- QQ：99515681
- WeChat：codinghelp
- Email：99515681@qq.com
- Work Time：8:00-23:00

- Ghostwriter Dataset Assignment,Help Wi... 2019-11-21
- Cache Comparisons Assignmentghostwrite... 2019-11-21
- Programming Assignmenthelp With ,Ghost... 2019-11-21
- Data Programming Assignmentghostwriter... 2019-11-21
- Cricos 00213J Assignmenthelp With ,Gho... 2019-11-21
- Help With R Hw2 Assignment,Ghostwriter... 2019-11-21
- Tcss 380 Assignmentghostwriter ,Help W... 2019-11-21
- Ghostwriter Program Assignment,Java Pr... 2019-11-21
- Csci-1200 Assignmenthelp With ,Data St... 2019-11-21
- Ghostwriter Tunedit Data Assignment,He... 2019-11-21
- Csci 370 Assignmentghostwriter ,Help W... 2019-11-21
- Ghostwriter Comp 1010 Assignment,Progr... 2019-11-21
- Wisccompsci200 Assignmenthelp With ,Ja... 2019-11-21
- 4Cosc001w Assignmenthelp With ,Python ... 2019-11-20
- Ghostwriter Csc 230 Assignment,Help Wi... 2019-11-20
- Cmpt 361 Assignmentghostwriter ,Help W... 2019-11-20
- Help With Cs5783 Assignment,Ghostwrite... 2019-11-20
- B365 Assignmenthelp With ,Ghostwriter ... 2019-11-20
- Inft 3033 Assignmenthelp With ,Ghostwr... 2019-11-20
- Cs610-101 Assignmentghostwriter ,Progr... 2019-11-20

Contact Us - Email：99515681@qq.com WeChat：codinghelp

© 2014 www.asgnhelp.com

Programming Assignment Help！