Question 4 Tic-tac-toe (also known as noughts and crosses) is a game for two players, X...
Fantastic news! We've Found the answer you've been seeking!
Question:
![image text in transcribed](https://dsd5zvtm8ll6.cloudfront.net/questions/2024/01/65b749387cd6e_64765b74937bdbb8.jpg)
Transcribed Image Text:
Question 4 Tic-tac-toe (also known as noughts and crosses) is a game for two players, X and O, who take turns marking the spaces in a 3x3 grid. The player who succeeds in placing three of their marks in a horizontal, vertical, or diagonal row wins the game. The game ends in a draw if neither player is able to achieve a winning row after all spaces in the grid have been filled. The following example game, as illustrated in Wikipedia, is won by the first player, X: 96 TX qX X X X X # ax OLX Figure 2: Tic-tac-toe a) Provide the complete source code for a Tic-tac-toe game which allows two players to play on against each other. 10 hea Int pt *pt The game must be played in the console. You need to allow each player to take their turn by having them input the position at which they will make their mark, and you must display the updated game grid after each turn. Output a message when the game is over indicating who won, or if the game was a draw. Your solution must be object-oriented and you should separate the presentation layer from the game logic. b) Provide a set of unit tests which verify that your solution works correctly. (20 marks) (18 marks) [Total Marks 38] Question 4 Tic-tac-toe (also known as noughts and crosses) is a game for two players, X and O, who take turns marking the spaces in a 3x3 grid. The player who succeeds in placing three of their marks in a horizontal, vertical, or diagonal row wins the game. The game ends in a draw if neither player is able to achieve a winning row after all spaces in the grid have been filled. The following example game, as illustrated in Wikipedia, is won by the first player, X: 96 TX qX X X X X # ax OLX Figure 2: Tic-tac-toe a) Provide the complete source code for a Tic-tac-toe game which allows two players to play on against each other. 10 hea Int pt *pt The game must be played in the console. You need to allow each player to take their turn by having them input the position at which they will make their mark, and you must display the updated game grid after each turn. Output a message when the game is over indicating who won, or if the game was a draw. Your solution must be object-oriented and you should separate the presentation layer from the game logic. b) Provide a set of unit tests which verify that your solution works correctly. (20 marks) (18 marks) [Total Marks 38]
Expert Answer:
Answer rating: 100% (QA)
Question 4a python class Player def initself mark selfmark mark def mak... View the full answer
Related Book For
Posted Date:
Students also viewed these programming questions
-
Assume a loan and property with the following characteristics: Property value: $300,000; Down payment: $50,000; Loan type: Hybrid 5/25 payment option ARM; Initial rate: 4% annual; Fully-indexed rate:...
-
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...
-
What are some Marketing Strategies for Delivering Objectives Polestar (Car company) has used or using?
-
A sample of nitrogen gas was collected over water at 20. o C and a total pressure of 1.00 atm. A total volume of 2.50 10 2 mL was collected. What mass of nitrogen was collected? (At 20. o C the...
-
List four government sectors in your country that use database systems.
-
Capital losses shown in financial accounts are deducted while reconciling costing profits with financial profits.
-
Vandre Oil Company, which prepares financial statements on a calendar-year basis, purchased new drilling equipment on July 1, 2012, using check numbers 1035 and 1036. The check totals are shown here,...
-
How much money should be deposited at age 5 in order to withdraw $50000 at the end of each year for 16 years if the first withdrawal is made at age 20. The account earns 9.5% compounded quarterly....
-
The following cross tabulation shows the average speed of the 25 winners by year of the Daytona 500 automobile race (The 2013 World Almanac). a. Calculate the row percentages. b. W hat is the...
-
how do you teach naval expeditionary operations to marines
-
Question: 9. Purchases and sales during a recent period for Bottineau Inc. were Purchases During the Period Sales During the Period 1st purchase 1,500 units x $ 4 1st sale 700 units x $13 2nd...
-
# The following is a partial relative frequency distribution of consumer preferences for four products-A, B, C, and D. Required: Determine the relative frequency for Product B: Relative Frequency...
-
Domino Company's operating percentages were as follows: Revenues 100% Cost of goods sold Variable 50% Fixed 10% 60% Gross profit 40% Other operating expenses Variable 20% Fixed 15% 35% Operating...
-
Marcus Stewart, the production manager at Galvin Company, purchased a cutting machine for the company last year. Six months after the purchase of the cutting machine, Stewart learned about a new...
-
The TechTeach Company produces and sells 7,000 modular computer desks per year at a selling price of $750 each. Its current production equipment, purchased for $1,950,000 and with a 5-year useful...
-
Problem 16-11 (Algo) Net operating loss carryback and carryforward; multiple differences (L016-3, 16-5, 16-7) Fore Farms reported a pretax operating loss of $152 million for financial reporting...
-
Suppose that the laptop of Prob. 2.16 is placed in an insulating briefcase with a fully charged battery, but it does not go into sleep mode, and the battery discharges as if the laptop were in use....
-
Several years ago, Revnon Co. acquired a 60% interest in Aumets Inc. at book value. During 2012 and 2013, intragroup sales of merchandise amounted to $120,000 and $180,000. On December 31, 2012, and...
-
The statement of financial position of Column Ltd. in Belize dollars, at December 31, 2013, was as follows: On January 1, 2011, Centaur acquired all the shares in Column, giving in exchange 50,000...
-
Campbell Ltd. invested in a joint venture by providing cash of $160,000. Campbell obtained a 22% interest in the joint venture based on its contribution. During the year, the joint venture earned...
-
In addition to a tragic loss of life, the terrorist attacks in the United States on September 11, 2001, severely disrupted the nations commercial, financial, and transportation activities. The effect...
-
In establishing new rules for segment reporting, the FASB considered exempting companies from pro viding segment disclosures if such disclosure would result in competitive harm for the company. The...
-
Some firms experience material seasonal variations in revenues. U.S. GAAP requires firms to disclose the seasonal nature of their activities in their interim financial statements. Search the FASBs...
![Mobile App Logo](https://dsd5zvtm8ll6.cloudfront.net/includes/images/mobile/finalLogo.png)
Study smarter with the SolutionInn App