Follow the instructions and write the program: After years of planning, you're finally ready to host the
Fantastic news! We've Found the answer you've been seeking!
Question:
Follow the instructions and write the program:
Transcribed Image Text:
After years of planning, you're finally ready to host the Tic-Tac-Toe world championships. Everything had been going great until you made a terrible discovery: the judges, who determine which player has won the game, have been taking bribes! There's not enough time to train new ones, so you opt for a backup plan: you'll create a piece of code that analyzes the board and tells the players if anyone makes a row. A Tic-Tac-Toe board looks like the following. Every square can be empty, filled with an X, or filled with an O (capital letter 'o'). Player X has won if they have three X's in a row. Player O wins if they can do the same with the O's. A row can be horizontal, vertical, or diagonal. Can you write the new judging code and salvage the competition? For our lab, we just make a similar situation. Input The input consists of three lines each with 3 characters. Each line represents a horizontal row on the board. Each character in a line represents a column. This means you have 3 rows and 3 columns, just like a normal Tic-Tac-Toe board. Each square in the board contains either an X, O (that's a capital letter, not a number), or E. X and O represent markings made by the players while E represents an empty square. Output If player X makes a row, you should print out the character X and clarify what kind of row? (Horizontal, vertical, or diagonal). If player O makes a row, you should print out the character O, and clarify what kind of row? (Horizontal, vertical, or diagonal). If both make succeed in placing their marks in a horizontal, vertical, or diagonal row, print out the result one by one. After years of planning, you're finally ready to host the Tic-Tac-Toe world championships. Everything had been going great until you made a terrible discovery: the judges, who determine which player has won the game, have been taking bribes! There's not enough time to train new ones, so you opt for a backup plan: you'll create a piece of code that analyzes the board and tells the players if anyone makes a row. A Tic-Tac-Toe board looks like the following. Every square can be empty, filled with an X, or filled with an O (capital letter 'o'). Player X has won if they have three X's in a row. Player O wins if they can do the same with the O's. A row can be horizontal, vertical, or diagonal. Can you write the new judging code and salvage the competition? For our lab, we just make a similar situation. Input The input consists of three lines each with 3 characters. Each line represents a horizontal row on the board. Each character in a line represents a column. This means you have 3 rows and 3 columns, just like a normal Tic-Tac-Toe board. Each square in the board contains either an X, O (that's a capital letter, not a number), or E. X and O represent markings made by the players while E represents an empty square. Output If player X makes a row, you should print out the character X and clarify what kind of row? (Horizontal, vertical, or diagonal). If player O makes a row, you should print out the character O, and clarify what kind of row? (Horizontal, vertical, or diagonal). If both make succeed in placing their marks in a horizontal, vertical, or diagonal row, print out the result one by one.
Expert Answer:
Answer rating: 100% (QA)
Heres a stepbystep explanation of how to do it First you need to take input for the TicTacToe board ... View the full answer
Related Book For
A Concise Introduction to Logic
ISBN: 978-1305958098
13th edition
Authors: Patrick J. Hurley, Lori Watson
Posted Date:
Students also viewed these programming questions
-
The four blocks shown in the figure above are released from the same height. Blocks B, C, and D are each released from rest, and block A is initially moving horizontally with a speed v. Blocks A and...
-
Planning is one of the most important management functions in any business. A front office managers first step in planning should involve determine the departments goals. Planning also includes...
-
Googles ease of use and superior search results have propelled the search engine to its num- ber one status, ousting the early dominance of competitors such as WebCrawler and Infos- eek. Even later...
-
Elmira, Inc had $20,000,000 of bonds outstanding on Dec 31, 2018. The ten year bonds were issued on Jan 1, 2012 for $21,000,000. Elmira can call the bonds at 102% any time after Jan 1, 2018. At the...
-
A horizontal pipe discharges at point A a stream of water into a reservoir. Express the radius of curvature of the stream at point B in terms of the magnitudes of the velocities vA andvB.
-
Write a function to convert Farenheit to Celsius.
-
Consider the inspection described in Example 2.11. Six parts are selected randomly without replacement from a bin of 50 parts. The bin contains 3 defective parts and 47 nondefective parts. Let \(A\)...
-
Mountain Drycleaners started 2018 with total assets of $19,000 and total liabilities of $14,000. At the end of 2018, Mountain's total assets stood at $12,000 and total liabilities were $9,000....
-
On January 1, 2023, Sarasota Corporation granted its president a share appreciation rights (SARS) package covering employment over a three-year period. The package was based on SARS increases for...
-
White & Becker Tools (W&B) requires 2,000 electric motors next month for its product line of weed trimmers. Each motor is composed of three components: a coil, a shaft, and housing. W&B has the...
-
1. Watch the video: https://youtu.be/2YFdN7cw_cU How will China's Belt and Road initiative impact Uzbekistan? 3 Reply to following questions. I. What will Uzbekistan gain from BRI II. What are the...
-
(a) Explain the meaning of money (2 marks). (b) Discuss the qualities of good money to be used in the economy for exchange of goods and services (15 marks). (c) Discuss the circumstances in which a...
-
1. (a) By the use of deposit of 20,000 Kshs and 10% required reserve, explain the process of credit creation by commercial bank in Kenya (10 marks). (b) Differentiate between open cheque and crossed...
-
(a) Discuss the Four (4) causes of demand push inflation (8 marks). (b) Explain the factors that determine money supply in the economy of Kenya (7 marks).
-
(a) Explain how the value of money depends on the price level (15 marks).
-
(a) Discuss the advantages and disadvantages of a monetary system (10 marks). (b) Briefly explain transaction demand for money (5 marks). QUESTION THREE By the help of Fisher's Equation of exchange...
-
Calculate the number of oxygen atoms in 29.34 g of sodium sulfate,Na 2 SO 4 . A. 1.244 10 23 O atoms B. 4.976 10 23 O atoms C. 2.409 10 24 O atoms D. 2.915 10 24 O atoms E. 1.166 10 25 O atoms
-
To help you become familiar with the accounting standards, this case is designed to take you to the FASBs Web site and have you access various publications. Access the FASBs Web site at...
-
1. Some intelligible statements are true statements, because all unintelligible statements are meaningless statements and some false statements are meaningful statements. 2. Some people who do not...
-
All dry martinis are dangerous concoctions. Therefore, it is false that some dry martinis are not dangerous concoctions. Use the modern square of opposition to determine whether the following...
-
If parents are told that their unborn child has TaySachs disease, then if they go ahead with the birth, then they are responsible for their childs pain and suffering. Therefore, if parents are not...
-
You have been asked to consult for an entrepreneur who is assembling investors for a new professional sport league. A critical decision for the league will be whether to organize under a...
-
Does a company share its risk by issuing equity or debt?
-
How are the features of a convertible bond similar to both debt and equity?
Study smarter with the SolutionInn App