tic tac toe in c language
The task is broken down into a number of subtasks/parts (not all of which need to be
completed to pass) that should be completed as separate elements of the coursework:
1. Using Object-oriented Design and Object-oriented Programming methods and
techniques, design and implement a C++ “player” class, so that each of the two players
of the game could be instantiated in their own object.
· The class needs to have appropriate attributes (data/variable members) for
recording/storing player data. The class should store the player's symbol (nought
or cross), as well as the player's choices (values between 1 and 9, using the
mapping described in the background information – this should be recorded in an
array of 5 values).
· The class needs to have appropriate methods (function members) for
initialisation and for receiving/returning data. The class interface should allow for
recording the player's moves (for this a counter attribute, i.e. a dedicated
variable, may be required), as well as a method for checking the win condition if
any combination of three game choices (entries in the array) results in a sum of
15 (these should be entries that are not ‘0' to prevent combinations of fewer
than 3 choices, for example 9 and 6 or 8 and 7, adding up to 15).
Completing this subtask is essential for achieving a pass mark.
2. Using the magic square mapping (described above) as an internal representation for the
game grid, create a console-based two player implementation of the game Tic-Tac-Toe
as a “hotseat” game (with both players taking turns, playing on the same computer – see
[url removed, login to view]). The game program
should instantiate two player objects (using the player class created in part 1), record the
two players' choices and end the game when one of the players wins or if there is a draw
(if no player has won after a total of 9 player selections).
3. Write a short report evaluating your work (possibly in the style of a post-mortem – see
[url removed, login to view]), critically reflecting on your work and stating
what worked well, what did not work (and why) and what you would do differently if you
had to do it again. This report should be no less than 2 pages and up to 4 pages in