联系方式

  • QQ:99515681
  • 邮箱:99515681@qq.com
  • 工作时间:8:00-23:00
  • 微信:codinghelp

您当前位置:首页 >> C/C++编程C/C++编程

日期:2021-04-25 05:17

Problem-Solving Task 2 (Connect-Four)

Starting with the initial code provided, complete the implementation of the game connectfour.

Introduction

Connect-four is a two-player connection board game, in which players choose a colour and then

take turns dropping coloured tokens into a 7-column, 6-row vertically suspended grid. The goal is

to 'connect four' of your own tokens in a straight line - either horizontally, vertically, or diagonally.

A partial C# implementation of connect-four has been provided to you via Blackboard. Your task

is to complete several pre-defined methods that will allow the game to be played against the

computer. The computer's artificial intelligence has already been written, so your focus will only

be on the player, the user interface, and various methods for dropping tokens and winning the

game. Unit tests have been written for some of the methods so that you can easily test the

correctness of your solution. You must complete this assignment using the initial code given (you

may not start from scratch).

How to complete the assignment

1. Download the initial code from Blackboard, and add it to an existing, empty C# console

application. Overwrite any existing files with the new files from Blackboard.

2. Press F5 to run the program. You should see the unit test output below. If you need help

getting this running, ask for help on Slack or during a tutorial ASAP.

=== Category: A: DisplayCells method ===

Test 1/3: Empty grid - standard size

? NotImplementedException: The method or operation is not implemented.

Test 2/3: Empty grids - other sizes

? NotImplementedException: The method or operation is not implemented.

Test 3/3: Non-empty grids - multiple sizes

? NotImplementedException: The method or operation is not implemented.

==> 0/3 <==

=== Category: B: DropToken method ===

Test 1/4: Dropping a single token

? NotImplementedException: The method or operation is not implemented.

Test 2/4: Dropping many random tokens

? NotImplementedException: The method or operation is not implemented.

Test 3/4: Invalid token exception

? NotImplementedException: The method or operation is not implemented.

Test 4/4: Filling up column exception

? NotImplementedException: The method or operation is not implemented.

==> 0/4 <==

2021/4/23 ConnectFour-Spec

https://blackboard.qut.edu.au/bbcswebdav/pid-9218098-dt-content-rid-38159482_1/courses/ITD121_2113TP1/ConnectFour-Spec%281%29%282… 2/3

3. Start work by completing the unit tested methods. In order from easiest to hardest, these

are:

1. DisplayCells

2. DropToken

3. GetWinner

Each method contains comments that explain the purpose of the method and how they

should operate. If you would like a more detailed explanation, see the initial code

explanation video below.

4. Once you have finished the unit tested methods, complete the final method that allows the

player to perform their turn.

1. PlayerTurn

5. If you have completed the methods and pass all the unit tests, test your solution by playing

it!

Plagiarism and the internet

Above all: Do not share your work with other students.

Connect-four is a game that has been implemented many times in many different programming

languages, and it is easy to find some of these implementations on the internet. Most of the time,

these solutions will not be helpful, because the problem-solving task is designed with very specific

methods that most sources will not translate well to. If you do look at other implementations of

connect-four, it is critical that you follow the advice below:

Do not paste code into your solution directly. It is likely that this will not be helpful anyway,

as you will need to understand and adapt the code to fit the methods for this problemsolving

task.

If you find an online source of code that you would like help understanding, ask your tutor.

If you adapt code from an online source:

You MUST reference it by pasting the source details (e.g. URL) into a C# code comment.

You should understand how it works and be able to explain it unassisted. If you do not

understand an online implementation, it may be better to leave it and develop that part

on your own.

Marking Sheet

You MUST use the initial code provided and complete the unit-tested methods. You may

NOT reject the initial code to develop a solution from scratch.

=== Category: C: GetWinner method ===

Test 1/4: No winners

? NotImplementedException: The method or operation is not implemented.

Test 2/4: Horizontal winners

? NotImplementedException: The method or operation is not implemented.

Test 3/4: Vertical winners

? NotImplementedException: The method or operation is not implemented.

Test 4/4: Diagonal winners

? NotImplementedException: The method or operation is not implemented.

==> 0/4 <==

Press ENTER to continue

2021/4/23 ConnectFour-Spec

https://blackboard.qut.edu.au/bbcswebdav/pid-9218098-dt-content-rid-38159482_1/courses/ITD121_2113TP1/ConnectFour-Spec%281%29%282… 3/3

Criteria Marks Possible Marks Awarded

DisplayCells method 3 (based on unit tests passed)

DropToken method 3 (based on unit tests passed)

GetWinner method

1.25 for horizontal win detection

1.25 for vertical win detection

0.5 for diagonal win detection

PlayerTurn method 1 (based on whether the game is playable)

Criteria Marks

Possible

Marks

Awarded

Variable naming conventions (camelCase) not followed or

variable names poor -0.25

Method naming conventions (PascalCase) not followed or

method names poor -0.25

Line lengths too long -0.25

Inconsistent formatting conventions (curly braces,

indentation etc.) -0.25

Comments lacking -0.25

Hard-coded solutions that are functional but highly

repetitive

-0.25

Because this assignment is unit-tested, and many of the method signatures and required

variables have already been defined for you, your final mark is initially determined by whether

your solution is functional.

However, if your code is of poor quality, you may lose marks according to the code quality section

below.

Functionality (10 marks)

Code quality (subtracted from functionality)


版权所有:留学生编程辅导网 2020 All Rights Reserved 联系方式:QQ:99515681 微信:codinghelp 电子信箱:99515681@qq.com
免责声明:本站部分内容从网络整理而来,只供参考!如有版权问题可联系本站删除。 站长地图

python代写
微信客服:codinghelp