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:
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?
-
Starting with ethyne, outline syntheses of each of the following. You may use any other needed reagents, and you need not show the synthesis of compounds prepared in earlier parts of this problem....
-
Refer to the Journal of Consumer Research (March 2003) study of how people attempt to influence the choices of others. Exercise 3.27 (p. 122). Recall that students selected three portable grill...
-
Mix and yield variances Engine-Kare Company makes engine care products for con- sumers and commercial users. One product, Noc-Free, is a particularly effective product for freeing sticky valves and...
-
At the start of calendar year 2012, Central Citys records showed the following accounts relative to prior year property taxes: Property taxes delinquent............ 52,000 Allowance for uncollectible...
-
12. [-/2 Points] DETAILS SCOLALG7 1.7.021. Solve the linear inequality. Express the solution using interval notation. 3 x -= > 4 Graph the solution set. Use the tools to enter your answer. NO...
-
The following salaried employees of Mountain Stone Brewery in Fort Collins, Colorado, are paid semimonthly. Some employees have union dues or garnishments deducted from their pay. You do not need to...
-
Entries for Issuing Bonds and Amortizing Premium by Straight-Line Method Smiley Corporation wholesales repair products to equipment manufacturers. On April 1, 20Y1, Smiley issued $4,800,000 of...
-
The executives at Aspire Foods took your recommendations and decided to develop a snack product targeted towards the active children and their parents. To keep costs down they decided to make the...
-
Extinguishment of Bonds Prior to Maturity On December 1, Year 1, Cone Company issued its 10%, $610,000 face value bonds for $710,000, plus accrued interest. Interest is payable on November 1 and May...
-
It is recommended to start by reviewing the 2019 file as an example to see what was done in the previous year. Similar work should be completed for 2020. 2. The client was unable to prepare bank...
-
Imagine that you will receive NOK 500 every year forever, but that the first payment will come in two years. What required return must you use for the present value (today) of this to be NOK 12,000?...
-
1. How has the study of media effects evolved over the past 100 years? 2. How do we determine when material is obscene or not? 3.How have newer media changed the way we study media effects? 4.What...
-
Business Course #Return to course My Subscriptions Jalisa Stew Finish attempt... eBook Print Question 2 Not complete Marked out of 10.00 P Flag question Product Cost Flows Complete the following...
-
What are the typical record-at-a-time operations for accessing a file? Which of these depend on the current file record?
-
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...
-
Why are relationships so important?
-
What is the difference between public relations and advocacy?
-
Explain the meaning of the terms, learning before doing, learning while doing, and learning after doing. Is one more important than the others?
Study smarter with the SolutionInn App