CSE5APG : Build a Naughts and Crosses Game - IT Assignment Help

Download Solution Order New Solution
Assignment Task:

Task:

Assignment description

The Assignment 2 will test your understanding and ability to apply what you have learnt throughout the lectures. Python basics Data structures Function OOP Exception Handling Naughts and Crosses game (aka Tic-Tac-Toe) is a well-known and very simple two-player game. The game consists of a playing grid (3x3 or higher) and two players. The playing grid has a set of squares. The squares will be filled by the players. The two players are known as the Naughts player which will be 1 detonated as ”O” and the Crosses player which will be denoted as ”X”. The playing rules are : The Naughts player plays with ”O”. The Crosses player plays with ”X”. Players take turns by placing ”O” or ”X” on the playing grid square. Only one player can play at a time- either ”O” or ”X”. The player makes their selection by entering the location of grid square they want to go (the square they want to fill). If any of the two players have filled a grid square, then the other player and the same player cannot filled that square. If any player gets three of their marks (”O” or ”X”.) on the board in a row, column or one of the two diagonals, this player will be the winner. When the playing grid square fills up with neither player winning, the game terminates with no winner. 3 Steps you must complete Please see and run attached code: test.py . You need to convert test.py into a new code using: function, OOP and exception handling. The code should ask the user to key-in the size of playing grid (e.g., 3x3, 6x6, ..etc). For example, current grid and final should be printed using function. In addition, invalid input should be handled. You need to develop three main classes: Board, Player, GameState. Each class must be implemented and tested. It is expected that your program can accept various grid sizes, so all input should be set automatically based on the gird size. You must use the same names for classes (Board, Player, GameState) and functions. The main steps are: 1. Once you run the program, the user will be prompted with a menu.

2. The user will need to enter their choice.

3. The choice will be to either begin the game, or quit.

4. If the user enters an invalid choice, the user should be prompted appropriately letting them choose once more.

5. The program should not end unless the user chooses otherwise. 2 6. If the user begins the game, the game will be terminated if one player win the game or all playing grid square have been filled up with neither player winning.

3.1 Main Menu In the main menu, the user will be prompt with a menu consisting two choices. Begin the game Quit the game This will menu will be printed out to the screen. Pseudo Code print ("introduction message") print ("choices for the user")

3.2 User enter choice The user will enter their choice. Which will result in the following. Begin game should prompt with The game has begun then return to the main menu. The quit game, should break out of the loop and stop the program. Pseudo Code userinput = input("ask user to input")

 3.3 Check User Input The users choice should be checked to see if it is valid. If not then throws a custom error. Pseudo Code if invalid input: raise InputValidError()

3.4 Throw custom error if user input is invalid Please implement a custom error. This custom error should be caught be a try catch error. 3 Pseudo Code class InvalidInputError(Exception): pass 4 Overview of flow of code Pseudo Code # 1. Prompt the user with the main menu while True: # 2. Infinite loop until user exits. if check if user quits: # 2.

if the user quits, break out of loop elif is choice valid: # execute users choice # back to main menu else: raise InvalidError() 5 Classes Information The Assignment 2 will consist of developing three main classes: Board, Player, GameState. Note Helper classes can be designed to support the 3 main classes. These classes will not be graded. These support classes do not have to be tested.

The above IT Assignment has been solved by our  IT Assignment  Experts at My Uni Paper. Our Assignment Writing Experts are efficient to provide a fresh solution to this question. We are serving more than 10000+ Students in Australia, UK & US by helping them to score HD in their academics. Our experts are well trained to follow all marking rubrics & referencing style.

Be it a used or new solution, the quality of the work submitted by our assignment experts remains unhampered. You may continue to expect the same or even better quality with the used and new assignment solution files respectively. There’s one thing to be noticed that you could choose one between the two and acquire considered worthy of the highest distinction.

Get It Done! Today

Country
Applicable Time Zone is AEST [Sydney, NSW] (GMT+11)
+

Every Assignment. Every Solution. Instantly. Deadline Ahead? Grab Your Sample Now.