(Solved) : Noughts Crosses Must Use Functions Modularize Work Logical Way Use Exception Handling Nece Q41343567 . . .

NOUGHTS AND CROSSES You must use functions to modularize yourwork in a logical way. You should use exception handling wherenecessary as well.

50 points off for programs that crash on expected input.

In this two player game, each player takes it in turn to place achosen mark “symbol” (for example: X or O) into one of the emptyspaces in a grid by choosing the number of row and column of thatempty space. The first player who gets three of his/her symbols ina line horizontally, vertically or diagonally wins the game. If thewhole grid was populated by the two player’s symbols, there will beno winner.

You’ll need to use a two dimensional list in this program topresent the grid, let the size of the grid to be 4×4. The grid willbe initialized with underscores ‘_’ for all the 16 values as shownbelow.

1 2 3 4

————-

1| _ _ _ _

2| _ _ _ _

3| _ _ _ _

4| _ _ _ _

At the beginning, let each player enter his/her name and themark (symbol) he/she choose to play with. After that, they willtake turns to choose the location in the grid to place his/hersymbol.

Details:

After each player choose the position to put his/her symbol. Thefollowing need to be checked.

1- Has the location been populated or not? If yes, ask theplayer to choose another location.

2- If the location has not been populated, check if the currentplayer is a winner or not.

3- The game will be kept going until one of the players win oruntil the grid will be fully populated by the symbols of the 2players.

4- At the beginning of the game and after each player completeentering his/her name and symbol, the empty grid should beprinted.

5- At the end of each player turn, the new grid need to beprinted.

Technical requirements:

1- Create a function to check if a player is winner or not.

2- The project must have a two dimensional list initialized asshown previously.

3- Exception handling must be involved in the project.

4- No need to ask the players if they want to play again

5- Make sure to choose conventional names for the variables,functions and list.

Output sample

Enter Player 1 name: Adam

Enter Player 2 name: Ali

Enter Player 1 symbol: x

Enter Player 2 symbol: o

_ _ _ _

_ _ _ _

_ _ _ _

_ _ _ _

Adam’s turn:

Enter the row number [1 to 4]1

Enter the column number [1 to 4]1

x _ _ _

_ _ _ _

_ _ _ _

_ _ _ _

Ali’s turn:

Enter the row number [1 to 4]2

Enter the column number [1 to 4]2

x _ _ _

_ o _ _

_ _ _ _

_ _ _ _

Adam’s turn:

Enter the row number [1 to 4]3

Enter the column number [1 to 4]3

x _ _ _

_ o _ _

_ _ x _

_ _ _ _

Ali’s turn:

Enter the row number [1 to 4]4

Enter the column number [1 to 4]4

x _ _

_ _ o _

_ _ _ x

_ _ _ _ o

Adam’s turn:

Enter the row number [1 to 4] 2

Enter the column number [1 to 4] 2

The chosen location is populated, please try again.

Enter the row number [1 to 4]2

Enter the column number [1 to 4]1

x _ _ _

x o _ _

_ _ x _

_ _ _ o

Ali’s turn:

Enter the row number [1 to 4]1

Enter the column number [1 to 4]2

x o _ _

x o __

_ _ x _

_ _ _ o

Adam’s turn:

Enter the row number [1 to 4]1

Enter the column number [1 to 4]3

x o x _

x o _ _

_ _ x _

_ _ _ o

Ali’s turn:

Enter the row number [1 to 4]1

Enter the column number [1 to 4]4

x o x o

x o _ _

_ _ x _

_ _ _ o

Adam’s turn:

Enter the row number [1 to 4]2

Enter the column number [1 to 4]4

x o x o

x o _ x

_ _ x _

_ _ _ o

Ali’s turn:

Enter the row number [1 to 4]2

Enter the column number [1 to 4]3

x o x o

x o o x

_ _ x _

_ _ _ o

Adam’s turn:

Enter the row number [1 to 4]3

Enter the column number [1 to 4]2

x o x o

x o o x

_ x x _

_ _ _ o

Ali’s turn: Enter the row number [1 to 4]3

Enter the column number [1 to 4]1

x o x o

x o o x

o x x _

_ _ _ o

Adam’s turn:

Enter the row number [1 to 4]4

Enter the column number [1 to 4]1

x o x o

x o o x

o x x _

x _ _ o

Ali’s turn:

Enter the row number [1 to 4]4

Enter the column number [1 to 4]2

x o x o

x o o x

o x x _

x o _ o

Adam’s turn:

Enter the row number [1 to 4]3

Enter the column number [1 to 4]4

Adam is a wiener

x o x o

x o o x

o x x x

x o _ o

Expert Answer


Answer to NOUGHTS AND CROSSES You must use functions to modularize your work in a logical way. You should use exception handling w…