logo Use CA10RAM to get 10%* Discount.
Order Nowlogo
(5/5)

Noughts and Crosses In this two player game, each player takes it in turn to place a chosen mark “symbol” (for example: X or O)

INSTRUCTIONS TO CANDIDATES
ANSWER ALL QUESTIONS

NOUGHTS AND CROSSES

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


You’ll need to use a two dimensional list in this program to present the grid, let the size of the grid to be 4x4. The grid will be initialized with underscores ‘_’ for all the 16 values as shown below.



1  2  3  4

-------------

1|   _  _  _ _

2|   _  _  _ _

3|   _  _  _ _

4|   _  _  _ _


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

Details:

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

1- Has the location been populated or not? If yes, ask the player to choose another location. 2- If the location has not been populated, check if the current player is a winner or not.

  • The game will be kept going until one of the players win or until the grid will be fully populated by the symbols of the 2 players

  • At the beginning of the game and after each player complete entering his/her name and symbol, the empty grid should be printed

  • At the end of each player turn, the new grid need to be printed




Technical requirements:

  • Create a function to check if a player is winner or

 

  • The project must have a two dimensional list initialized as shown previously. 3- Exception handling must be involved in the

  • No need to ask the players if they want to play again

  • Make sure to choose conventional names for the variables, functions and




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 _ _

_ _ _ _

_ _ _ _

(5/5)
Attachments:

Related Questions

. Introgramming & Unix Fall 2018, CRN 44882, Oakland University Homework Assignment 6 - Using Arrays and Functions in C

DescriptionIn this final assignment, the students will demonstrate their ability to apply two ma

. The standard path finding involves finding the (shortest) path from an origin to a destination, typically on a map. This is an

Path finding involves finding a path from A to B. Typically we want the path to have certain properties,such as being the shortest or to avoid going t

. Develop a program to emulate a purchase transaction at a retail store. This program will have two classes, a LineItem class and a Transaction class. The LineItem class will represent an individual

Develop a program to emulate a purchase transaction at a retail store. Thisprogram will have two classes, a LineItem class and a Transaction class. Th

. SeaPort Project series For this set of projects for the course, we wish to simulate some of the aspects of a number of Sea Ports. Here are the classes and their instance variables we wish to define:

1 Project 1 Introduction - the SeaPort Project series For this set of projects for the course, we wish to simulate some of the aspects of a number of

. Project 2 Introduction - the SeaPort Project series For this set of projects for the course, we wish to simulate some of the aspects of a number of Sea Ports. Here are the classes and their instance variables we wish to define:

1 Project 2 Introduction - the SeaPort Project series For this set of projects for the course, we wish to simulate some of the aspects of a number of

Ask This Question To Be Solved By Our ExpertsGet A+ Grade Solution Guaranteed

expert
Um e HaniScience

841 Answers

Hire Me
expert
Muhammad Ali HaiderFinance

845 Answers

Hire Me
expert
Husnain SaeedComputer science

995 Answers

Hire Me
expert
Atharva PatilComputer science

502 Answers

Hire Me

Get Free Quote!

383 Experts Online