1. Homepage
  2. Programming
  3. COMP2017 Systems Programming - Assignment 1: Game Controller Gomoku

COMP2017 Systems Programming - Assignment 1: Game Controller Gomoku

Engage in a Conversation
AustraliaUniversity of SydneyCOMP2017Systems ProgrammingGame ControllerGomokuMistC

Task description CourseNana.COM

In this assignment, we will develop a game controller that accommodates a two-player board game called Gomoku1 in the Mist. The controller should be programmed in the C programming language without using dynamic memory. And always ensure that no memory errors occur. CourseNana.COM

subcategory. As with any assignment, make sure that your work is your own , and that you do not share your code or solutions with other students. CourseNana.COM

Before attempting this assignment it would be a good idea to familiarise yourself with arrays, standard I/O and C strings. In particular, you may find the following functions helpful: CourseNana.COM

    fscanf() CourseNana.COM

    fgets() CourseNana.COM

Rules of the Game CourseNana.COM

Gomoku or Five in a Row is played on a 19×19 Go board (See Figure 1). The game starts with an empty board, and players Black and White alternate to place a stone of their colour on a grid point. Black goes first. The goal of the game is to create a line of five or more stones of your own colour, either horizontally, vertically or diagonally. The first player to achieve that goal wins (See Figure 2. If neither player creates five in a row when the board is full, then the game is a draw. The game finishes when a player wins, a player resigns or they draw. CourseNana.COM

You are encouraged to ask questions on Ed . Make sure your question post is of "Question" post type and is under "Assignment" category"A1" subcategory "Debugging"/"Spec"/"General" sub- CourseNana.COM

Gomoku in the Mist is a new game based on Gomoku. It inherits all the rules from Gomoku and it introduces a game component called Mist. Mist blocks the visibility of both players and it covers the whole board except a 7 × 7 square hole (See Figure 3). Players can only see through the hole that is not covered by the Mist, however, the placement of stone is not blocked by the Mist at all. If the centre of the hole is so close to the border of the board that the hole cannot fit into the board, simply ignore the part that cannot fit. CourseNana.COM

Initially, the hole of the Mist locates at the centre of the board before the first move. The Mist (hole) changes after every placement of a stone. The position of hole depends on the previous placement of a stone. If a numerical coordinate system is used, the following rules apply: CourseNana.COM

% is the modulo operator. CourseNana.COM

xmist =1+(5x2 +3xstone +4)%19, stone CourseNana.COM

ymist =1+(4y2 +2ystone 4)%19. stone CourseNana.COM

 (xmist, ymist) denotes the position of the hole’s centre, and (xstone, ystone) denotes the position of the previous placed stone. CourseNana.COM

To denote position on the board, a coordinate <C><R> can be specified. While it is natural to utilise a 19 × 19 purely numerical coordinate system, the Go style system is preferred. In particular, for a Go coordinate <C><R>, <C> is a column character ranging from A (the first English upper letter) to S (the nineteenth English upper letter); <R> is a row number ranging from 1 to 19. CourseNana.COM

Functionalities of the Game Controller CourseNana.COM

The Game Controller is a command prompt that supports the following commands: CourseNana.COM

who
term
resign
view
place <C><R> history
CourseNana.COM

Note that a new game should be automatically started when the game controller is launched, and the game controller should terminate when a game is finished or the controller is forced to terminate. CourseNana.COM

In a numerical coordinate system, columns are denoted by numbers instead of characters. In particu- lar, the n-th English upper letter is equivalent to a number n. E.g. Column character A is equivalent to column number 1. See the numerical numbering in Figure 1. CourseNana.COM

Commands are case-sensitive and whitespace-sensitive. The game controller will reject unspecified commands or known commands with unspecified trailing whitespaces or parameters. The only com- mand that accepts a parameter is place and it can only be supplied with one parameter. The game controller should output Invalid! if it rejects the user input. CourseNana.COM

numerical: CourseNana.COM

19 . . . . . . . . . . . . . . . . . . . 18 . . . . . . . . . . . . . . . . . . . 17 . . . . . . . . . . . . . . . . . . . 16 . . . . . . . . . . . . . . . . . . . 15 . . . . . . . . . . . . . . . . . . . 14 . . . . . . . . . . . . . . . . . . . 13 . . . . . . . . . . . . . . . . . . . 12 . . . . . . . . . . . . . . . . . . . 11 . . . . . . . . . . . . . . . . . . . 10 . . . . . . . . . . . . . . . . . . . 9 ................... 8 ................... 7 ................... 6 ................... 5 ................... 4 ................... 3 ................... 2 ................... 1 ................... CourseNana.COM

ABCDEFGHIJKLMNOPQRS 1 2 3 4 5 6 7 8 9 ................... CourseNana.COM

Figure 1: An ASCII art of the Go board grid points with axes numbering CourseNana.COM

19 # # # # # . . . . . . . . . . . . . . 18 o o o o . . . . . . . . . . . . . . . 17 . . . . . . . . . . . . . . . . . . . 16 . . . . . . . . . . . . . . . . . . . 15 . . . . . . . . . . . . . . . . . . . 14 . . . . . . . . . . . . . . . . . . . 13 . . . . . . . . . . . . . . . . . . . 12 . . . . . . . . . . . . . . . . . . . 11 . . . . . . . . . . . . . . . . . . . 10 . . . . . . . . . . . . . . . . . . . 9 ................... 8 ................... 7 ................... 6 ................... 5 ................... 4 ................... 3 ................... 2 ................... 1 ................... CourseNana.COM

ABCDEFGHIJKLMNOPQRS
Figure 2: An ASCII art of the Go board when Black stone wins, where #, o ,. represents Black CourseNana.COM

stone, White stone and no stone (empty).
Systems Programming Page
3 of 13 CourseNana.COM

19 @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ 18 @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ 17 @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ 16 @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ 15 @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ 14 @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ 13 @ @ @ @ @ @ . . . . . . . @ @ @ @ @ @ 12 @ @ @ @ @ @ . . . . . . . @ @ @ @ @ @ 11 @ @ @ @ @ @ . . . . . . . @ @ @ @ @ @ 10 @ @ @ @ @ @ . . . A . . . @ @ @ @ @ @ 9 @@@@@@.......@@@@@@ 8 @@@@@@.......@@@@@@ 7 @@@@@@.......@@@@@@ 6 @@@@@@@@@@@@@@@@@@@ 5 @@@@@@@@@@@@@@@@@@@ 4 @@@@@@@@@@@@@@@@@@@ 3 @@@@@@@@@@@@@@@@@@@ 2 @@@@@@@@@@@@@@@@@@@ 1 @@@@@@@@@@@@@@@@@@@ CourseNana.COM

ABCDEFGHIJKLMNOPQRS
Figure 3: An ASCII art of the Go board covered by the Mist except the 7 × 7 hole, where @,.,A CourseNana.COM

represents the Mist, the hole and the centre of the hole. who CourseNana.COM

who command can be executed to show who is the current player. One character will be displayed, either B for Black stone or W for White stone. CourseNana.COM

This command can be executed at any time. CourseNana.COM

term CourseNana.COM

term command forces the controller to terminate with exit code 1. This command can be executed at any time. This command will suppress history moves messages and the exit message. CourseNana.COM

resign CourseNana.COM

resign command can be executed by a player to resign from the game. This command will cause the current player to end the game and lose. The other player will win the game. This command can be executed at any time. CourseNana.COM

1234567 CourseNana.COM

8 91011121314 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 CourseNana.COM

Figure 4: An ASCII art of the 7×7 hole in Figure 3, where the numbers represent the output ordering of the hole in view. CourseNana.COM

view CourseNana.COM

view command can be executed by a player to view the current board. The controller will respond with a one-line output, consisting of two strings separated by a comma. CourseNana.COM

The first string denotes the centre coordinate of the 7 ×7 hole that is not covered by the Mist. CourseNana.COM

The second string denotes the status of grid points in the hole. That is, whether each point is occu- pied by a black stone, a white stone, not occupied or off-board. This string is the concatenation of rows’ status , and each row starts with CourseNana.COM

the lowest column (from A to S ).
#, o ,.,x denotes black, white, empty and off-board. CourseNana.COM

If the hole is partially off-board, then the grid points that are off-board should be represented by x. See Example 4. CourseNana.COM

This command can be executed at any time. CourseNana.COM

place <C><R> CourseNana.COM

place command can be executed by a player to place a stone on the Go board according to the Go coordinate <C><R>. If the placement is successful, the controller will not respond with any output and silently alternate the player. However, if the given placement is invalid, then it will CourseNana.COM

<C><R>. In particular, a one-line output formed by a sequence of the Go coordinates. For example, if Black first places a stone at A1, then White at B2, followed by Black at C3 and finally White at D4, the history requested at this point should read A1B2C3D4. This command can be executed at any time. CourseNana.COM

 (from the greatest row number 19 to the least row number 1) CourseNana.COM

See Figure 4. CourseNana.COM

End game conditions CourseNana.COM

A winner is decided when that player achieves a line of five stones with the same colour, either horizontally, vertically or diagonally, or the opposing player has resigned the game. A message will be displayed CourseNana.COM

[Black|White] wins! CourseNana.COM

The game will also end when no more stones can be placed A message will be displayed CourseNana.COM

Wow, a tie!
At the end of the game, the history command should be called silently to display all the moves. Finally, an exit message will be provided
Thank you for playing!
The controller will terminate with exit code 0 if a player wins or there is a tie.
term command will not lead to the end game. CourseNana.COM

Submission details CourseNana.COM

You are encouraged to submit multiple times, but only your last submission before the deadline will be marked. CourseNana.COM

Writing your own test cases CourseNana.COM

We have provided you with some test cases but these do not test all the functionality described in the assignment. It is important that you thoroughly test your code by writing your own test cases. CourseNana.COM

You should place all of your test cases in the tests/ directory. Ensure that each test case has the .in input file along with a corresponding .out output file. We recommend that the names of your test cases are descriptive so that you know what each is testing, e.g. basic-game.in and tie- condition.in. Please note that test case files must be located in tests/ directory and follow the above naming convention. Otherwise, they will NOT be marked. CourseNana.COM

Get in Touch with Our Experts

WeChat (微信) WeChat (微信)
Whatsapp WhatsApp
Australia代写,University of Sydney代写,COMP2017代写,Systems Programming代写,Game Controller代写,Gomoku代写,Mist代写,C代写,Australia代编,University of Sydney代编,COMP2017代编,Systems Programming代编,Game Controller代编,Gomoku代编,Mist代编,C代编,Australia代考,University of Sydney代考,COMP2017代考,Systems Programming代考,Game Controller代考,Gomoku代考,Mist代考,C代考,Australiahelp,University of Sydneyhelp,COMP2017help,Systems Programminghelp,Game Controllerhelp,Gomokuhelp,Misthelp,Chelp,Australia作业代写,University of Sydney作业代写,COMP2017作业代写,Systems Programming作业代写,Game Controller作业代写,Gomoku作业代写,Mist作业代写,C作业代写,Australia编程代写,University of Sydney编程代写,COMP2017编程代写,Systems Programming编程代写,Game Controller编程代写,Gomoku编程代写,Mist编程代写,C编程代写,Australiaprogramming help,University of Sydneyprogramming help,COMP2017programming help,Systems Programmingprogramming help,Game Controllerprogramming help,Gomokuprogramming help,Mistprogramming help,Cprogramming help,Australiaassignment help,University of Sydneyassignment help,COMP2017assignment help,Systems Programmingassignment help,Game Controllerassignment help,Gomokuassignment help,Mistassignment help,Cassignment help,Australiasolution,University of Sydneysolution,COMP2017solution,Systems Programmingsolution,Game Controllersolution,Gomokusolution,Mistsolution,Csolution,