首页 > > 详细

C辅导Nim的游戏 Assignment 讲解C、C语言讲解留学生

ntroduction
Requirement
Assignment 3
Due Date
The assignment is due at 3PM Wednesday October 12 th 2016 and should be completed in pairs.
Context
Nim is a game played between two players. 21 objects (matches, coins, or lollies) are placed in
front of the players and, having decided who will go first, each player removes one, two, or three
objects in alternating turns. The goal is to force the other player to remove the final object — the
player to remove the final object is the loser!
This assignment uses many data structures (trees, linked-lists, and stacks) to implement a human-
versus-computer version of the game. The game will be text only. The computer will choose its
move by creating a game tree. A game tree consists of all the possible states of the game and the
computer determines the outcome of particular choices to guide which choice is the best. The state
of the game is defined as comprising how many objects remain in the game and how good (or bad)
the outcome looks (an int from -9 to +9). Each node of the game tree has children that indicate
the states of the game that follow from the state of the parent for each possible move, i.e. there are
likely to be three children for each node, one with one additional object removed, one with two, and
one with three.
2/4
A sample run of the game is shown below.
The project contains many files. All required files are present. Your task is simply to complete the
functions within the program files which have been declared but for which the function bodies are
missing.
Program Style
Your program should follow the following coding conventions:
 const variable identifiers should be used as much as possible, should be written all in
upper case and should be declared before all other variables;
 Variable identifiers should start with a lower case letter;
 Every if and if-else statement should have a block of code (i.e. collections of lines
surrounded by { and }) for both the if part and the else part (if used);
 Every loop should have a block of code;
 The keyword continue should not be used;
 The keyword break should only be used as part of a switch statement;
 Opening and closing braces of a block should be aligned;
 All code within a block should be aligned and indented 1 tab stop (or 4 spaces) from the
braces marking this block;
 Commenting:
o There should be a block of header comment which includes at least
 file name
 student names
 student identity numbers
 a statement of the purpose of the program
 date
o Each variable declaration should be commented
o There should be a comment identifying groups of statements that do various parts of
the task
3/4
o Comments should describe the strategy of the code and should not simply translate
the C into English
What and how to submit
What to submit
Paper submission
 A signed cover page (blanks can be collected from the ICT Reception/Help Desk or from
the ICT web site at
);
 A landscape-orientation print-out of the three ‘.c’ source code files for the program. Your
assignment will not be marked unless these are present; and
 A statement from each person indicating what proportion of the work was theirs. If the
work was done equally, then each person should claim 50% of the effort. It is expected that
this will be the case and this will be assumed if no statement is submitted. If, however, one
person has done very little, then this should be stated. A reason why this is the case should
be given. For example, if one student does 80% of the work because their partner did not
turn up to meetings, complete work by the agreed time, etc. then this should be stated. If
one student does 30% of the work because the other student simply went off and did it all by
themselves and without consultation then this should be stated.
Electronic submission
 You should submit the entire Visual Studio project folder.
How to submit
Paper submission
 Firmly staple together all of the required documents (with the signed cover page on top) and
place them in the appropriate submissions box near the ICT Discipline Help Desk.
Electronic submission
 Go to your home directory on alacritas (M:). You will find there a directory (folder) called
kit107submit (If you do not have this folder, please contact the ICT Discipline Help
desk.)
 Copy your entire Visual Studio project folder (Assig3) into this directory. Open the folder
to see that the files have been copied.
 If you want to resubmit, open the kit107submit folder, remove the old version and copy
in the new version.
4/4
Marking scheme
Task/Topic Maximum
mark
Program operates as specified
node.c correctly completed 6
stack.c correctly completed 6
gameState.c correctly completed 7
tNode.c correctly completed 14
gameTree.c correctly completed 31
Program Style
Does not unnecessarily repeat tests or have other redundant/confusing code 8
Uses correctly the C naming conventions 8
Alignment of code and use of white space makes code readable 8
Always uses blocks in branch and loop constructs 8
Meaningful identifiers 8
Variables declared at the top of functions 8
Each variable declaration is commented 8
Comments within the code indicate the purpose of sections of code (but DO NOT just duplicate
what the code says)
8
Plagiarism and Cheating:
Practical assignments are used by the School of Engineering and ICT for students to both reinforce
and demonstrate their understanding of material which has been presented in class. They have a
role both for assessment and for learning. It is a requirement that work you hand in for assessment
is substantially your own.
Working with others
One effective way to grasp principles and concepts is to discuss the issues with your peers and/or
friends. You are encouraged to do this. We also encourage you to discuss aspects of practical
assignments with others. However, once you have clarified the principles, your pair must express
them in writing or electronically entirely by yourselves. In other words you must develop the
algorithm to solve the problem and write the program which implements this algorithm with your
partner and no one else (other than staff).
Cheating
 Cheating occurs if you claim work as your own when it is substantially the work of someone
else.
 Cheating is an offence under the Ordinance of Student Discipline within the University.
Furthermore, the ICT profession has ethical standards in which cheating has no place.
 Cheating involves two or more parties.
o If you allow written work, computer listings, or electronic version of your code to be
borrowed or copied by another student you are an equal partner in the act of
cheating.
o You should be careful to ensure that your work is not left in a situation where it may
be stolen by others.
 Where there is a reasonable cause to believe that a case of cheating has occurred, this will
be brought to the attention of the unit lecturer. If the lecturer considers that there is evidence
of cheating, then no marks will be given to any of the students involved. The case will be
referred to the Head of School for consideration of further action.
Julian Dermoudy, September 21 st 2016.

 

联系我们
  • QQ:99515681
  • 邮箱:99515681@qq.com
  • 工作时间:8:00-21:00
  • 微信:codinghelp
热点标签

联系我们 - QQ: 99515681 微信:codinghelp
程序辅导网!