Question
Tic-tac-toe, also called noughts and crosses (in the BritishCommonwealth countries), X's and O's (in Ireland) and X and 0 (inIndia) is a pencil-and-paper game for
"Tic-tac-toe, also called noughts and crosses (in the BritishCommonwealth countries), X's and O's (in Ireland) and X and 0 (inIndia) is a pencil-and-paper game for two players, X and O, whotake turns marking the spaces in a 3×3 grid. The X player usuallygoes first. The player who succeeds in placing three respectivemarks in a horizontal, vertical, or diagonal row wins the game."(Wikipedia)
Create a basic tic-tac-toe game for the console. The game shouldwork as follows:
1. Output a board in the following format:
1 2 31 | | ---+---+---2 | | ---+---+---3 | |
No other board format will be accepted. You must number the rowsand columns, not each box.
2. Ask the user for a row and column number.
3. Put the appropriate symbol for that player (X or O) in thespecified spot.
4. Repeat for the next player until someone has won thegame.
5. If someone has won, announce which player won and exit.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started