Sie sind auf Seite 1von 4

Assignment for UCCD 1004 Programming Concept and

Practices
Instructions:
1. This is a individual assignment.
2. This assignment due date is on week 12 Friday (18-August-2017).
3. Submission can be done by handing in your report and source code (printed) to the Lecturer
or sliding in my office (under the door).
4. Late submission without any valid reason is not acceptable. A penalty of 5% (out of 100%)
will be deducted from the assignment score.
5. No plagiarism is allowed. There are many solitaire source codes that can be your reference,
but you are not allowed to copy directly and submit their code.
6. The output of this assignment is a report and the source code printed on A4 paper with
simple binding (forget about the comb binding, just staple it will do).
7. Print out this as the assignment and attach your report and source code (both soft and
hard copy) for your submission.

Student ID :
Student Name :
Programme:
(IA/IB/CS/CN/CT
)

This assignment is my own work, or my groups own unique group assignment. I acknowledge that
copying someone elses assignment, or part of it, is wrong, and that submitting identical work to
others constitutes a form of plagiarism.

I have not allowed, nor will I in the future allow, anyone to copy my work with the intention of
passing it off as their own work.

(Signature)

_____________________________

Name:

Date:
Introduction

You are being asked to create a 5x5 tic tac toe game in C++. A normal tic tac toe is a game that
involves two players. The board is divided into 3x3 tiles, and each player takes turn to make a move
by drawing their own symbol. One player uses the cross (x) and the other uses circle (o). The first
player that makes the combination of 3 in vertical, or horizontal or diagonal ways wins the game.

The table below shows that the circle player (O) wins the game.

O O O
X O
X X

A 5x5 tic tac toe has the same winning condition, but the number of tile is larger. The table below
shows that the circle player (O) wins the game again.

O X
O X
O X
O X
O

Here is the instruction for creating the game.

1. Use a 2D array (or 1D array if you know how to solve) to represent the board. First, name all
tile with a number. When a player makes a move, he/she chooses based on the number. If
the tile has number instead of O or X, it will fill up with O or X based on the players
symbol. Otherwise, it is not a valid move. For example, if the board is empty and X player
chooses 25, the follow result will show.

1 2 3 4 5 6 7 8 9 10
6 7 8 9 10 11 12 13 14 15
11 12 13 14 15 16 17 18 19 20
16 17 18 19 20 21 22 23 24 X
21 22 23 24 25
1 2 3 4 5
2. A function to check for valid move as stated in 1.

3. A function to check for winning condition.

4. It is suitable to create a function to draw the board on the screen because you are going to
display the tile repeatedly throughout the entire game.

5. Use global variable in a meaningful way. If a variable is used only in 3 or less functions, you
should consider pass by value or pass by reference. Inconsistency in code will be penalized
(i.e. using global variable at the same time pass the variable to functions)

6. DO NOT USE GOTO command. ZERO MARK will be awarded if you do so.
The marking scheme for this assignment is as follows:

No. Criteria Score / Total


1 A main function that initialize the game (includes all declaration of /5
necessary variables, structures, array, etc. As well as shuffling the
deck)
2 A function that check for end game status. /5
3 A function that check whether a move is valid. /5
4 A function that draws the board in command prompt just like the /5
figure in instruction 1.
5 Show the total time the player used to play the game at the end. /5
6 Coding style, this includes commenting and description of your /5
code in C++.
The total score for assignment is 30% and will be converted to 10% that contribute to the final
grade for this course.

Das könnte Ihnen auch gefallen