You will be programming up a simplified scoring system for the board game Go. Go is...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
You will be programming up a simplified scoring system for the board game Go. Go is an abstract strategy game where two players compete to surround as much of a board with their colored pieces as possible. At the end of the game, each players score is the sum of how many pieces they still have on the board with how much empty space their pieces surround. Your program will need to: Read in and store a completed Go game board from a file Mark all of the empty spaces on the board with the symbol of the player's piece that controls them Sum the total scores and display them to the user. Additional Specifications For this assignment, you must use recursion to "color" the board with the player that owns that territory. No other functions are required to be recursive. You also must create and call at least four individual functions. All other design decisions are up to you. Details The program starts by asking the user for the filename that contains the go board, and reads in the file. The program will paint the board with player ownership and then tally the final score. Reading in and Creating the Board For this assignment, you will be reading in a file representing the completed Go game. The board may be any size The board will always be rectangular . The board will consist of: o plus sign (+) for an empty space o the letter O, for a white piece o the letter X, for a black piece Reading in and Creating the Board For this assignment, you will be reading in a file representing the completed Go game. The board may be any size • The board will always be rectangular • The board will consist of: o plus sign (+) for an empty space o the letter O, for a white piece o the letter X, for a black piece Displaying the Board The board should be displayed to the user once it is loaded in, then again after it has been painted. • The board's initial display should be how it was stored in the file . We recommend that you use a 2d list to store the contents of the file Determining Territory Ownership A set of empty spaces is "owned" by a player in Go if the only pieces surrounding that set of spaces are the pieces of that player. Displaying the Board The board should be displayed to the user once it is loaded in, then again after it has been painted. • The board's initial display should be how it was stored in the file . We recommend that you use a 2d list to store the contents of the file Determining Territory Ownership A set of empty spaces is "owned" by a player in Go if the only pieces surrounding that set of spaces are the pieces of that player. Here is a board that has been divided roughly in half by a wall of the two players: ++++XO+++ ++++XO+++ ++++XO+++ ++++XO+++ +++XO++++ +++XO++++ +++XO++++ +++XO++++ +++XO++++ All of the empty spaces (represented by +) on the left are surrounded only by X (black) pieces. They will be counted for X. All of the spaces on the right are surrounded by O, and will be counted for O. Note that the edge of the board counts for no one, and should not affect the computation of territory ownership. You must write a recursive function that computes the owner of a particular point on the board. You will call this function on each point of the board and then paint the board such that empty spaces are replaced with the symbol representing the owner of that space. See the next page for an example of the above board after it has been "painted". XXXXX0000 XXXXX0000 XXXXX0000 XXXXX0000 XXXX00000 XXXX00000 XXXX00000 XXXX00000 XXXX00000 Recall that the board can be any rectangular dimensions, so your code MUST NOT rely on particular board dimensions for scoring Recall that the board can be any rectangular dimensions, so your code MUST NOT rely on particular board dimensions for scoring. Some notes: • Diagonals do not count for the purposes of counting neighbors We will NOT give you an example where a territory has two owners or no owners. (Such a scenario would mean that either game isn't over, or there is a neutral zone which is a computational problem well beyond the scope of this project) • A note to players of Go: We are not computing life or death (we assume players have done this for us) and we are using Chinese scoring, not Japanese. Things You DO NOT need to worry about 1. The board will not have gaps in the boundaries: ++++XO+++ ++++XO+++ ++++XO+++ ++++XO+++ +++++++++ Things You DO NOT need to worry about 1. The board will not have gaps in the boundaries: ++++XO+++ ++++XO+++ ++++XO+++ ++++XO+++ +++++++++ Printing the scores After you have marked all of the empty spaces with whomever owns them, you must print the scores. The score can be calculated by counting the numbers of X's and O's and reporting them to the user. See the sample outputs for details. Additional Information and Examples For more information, download the sample output files available. You can download all of the boards used and their sample output by using the following command: cp /afs/umbc.edu/users/b/e/benj1/pub/ cs201/proj3/board* . You are also highly encouraged to make your own test boards - you can create and share these with your classmates if you want as well. You will be programming up a simplified scoring system for the board game Go. Go is an abstract strategy game where two players compete to surround as much of a board with their colored pieces as possible. At the end of the game, each players score is the sum of how many pieces they still have on the board with how much empty space their pieces surround. Your program will need to: Read in and store a completed Go game board from a file Mark all of the empty spaces on the board with the symbol of the player's piece that controls them Sum the total scores and display them to the user. Additional Specifications For this assignment, you must use recursion to "color" the board with the player that owns that territory. No other functions are required to be recursive. You also must create and call at least four individual functions. All other design decisions are up to you. Details The program starts by asking the user for the filename that contains the go board, and reads in the file. The program will paint the board with player ownership and then tally the final score. Reading in and Creating the Board For this assignment, you will be reading in a file representing the completed Go game. The board may be any size The board will always be rectangular . The board will consist of: o plus sign (+) for an empty space o the letter O, for a white piece o the letter X, for a black piece Reading in and Creating the Board For this assignment, you will be reading in a file representing the completed Go game. The board may be any size • The board will always be rectangular • The board will consist of: o plus sign (+) for an empty space o the letter O, for a white piece o the letter X, for a black piece Displaying the Board The board should be displayed to the user once it is loaded in, then again after it has been painted. • The board's initial display should be how it was stored in the file . We recommend that you use a 2d list to store the contents of the file Determining Territory Ownership A set of empty spaces is "owned" by a player in Go if the only pieces surrounding that set of spaces are the pieces of that player. Displaying the Board The board should be displayed to the user once it is loaded in, then again after it has been painted. • The board's initial display should be how it was stored in the file . We recommend that you use a 2d list to store the contents of the file Determining Territory Ownership A set of empty spaces is "owned" by a player in Go if the only pieces surrounding that set of spaces are the pieces of that player. Here is a board that has been divided roughly in half by a wall of the two players: ++++XO+++ ++++XO+++ ++++XO+++ ++++XO+++ +++XO++++ +++XO++++ +++XO++++ +++XO++++ +++XO++++ All of the empty spaces (represented by +) on the left are surrounded only by X (black) pieces. They will be counted for X. All of the spaces on the right are surrounded by O, and will be counted for O. Note that the edge of the board counts for no one, and should not affect the computation of territory ownership. You must write a recursive function that computes the owner of a particular point on the board. You will call this function on each point of the board and then paint the board such that empty spaces are replaced with the symbol representing the owner of that space. See the next page for an example of the above board after it has been "painted". XXXXX0000 XXXXX0000 XXXXX0000 XXXXX0000 XXXX00000 XXXX00000 XXXX00000 XXXX00000 XXXX00000 Recall that the board can be any rectangular dimensions, so your code MUST NOT rely on particular board dimensions for scoring Recall that the board can be any rectangular dimensions, so your code MUST NOT rely on particular board dimensions for scoring. Some notes: • Diagonals do not count for the purposes of counting neighbors We will NOT give you an example where a territory has two owners or no owners. (Such a scenario would mean that either game isn't over, or there is a neutral zone which is a computational problem well beyond the scope of this project) • A note to players of Go: We are not computing life or death (we assume players have done this for us) and we are using Chinese scoring, not Japanese. Things You DO NOT need to worry about 1. The board will not have gaps in the boundaries: ++++XO+++ ++++XO+++ ++++XO+++ ++++XO+++ +++++++++ Things You DO NOT need to worry about 1. The board will not have gaps in the boundaries: ++++XO+++ ++++XO+++ ++++XO+++ ++++XO+++ +++++++++ Printing the scores After you have marked all of the empty spaces with whomever owns them, you must print the scores. The score can be calculated by counting the numbers of X's and O's and reporting them to the user. See the sample outputs for details. Additional Information and Examples For more information, download the sample output files available. You can download all of the boards used and their sample output by using the following command: cp /afs/umbc.edu/users/b/e/benj1/pub/ cs201/proj3/board* . You are also highly encouraged to make your own test boards - you can create and share these with your classmates if you want as well.
Expert Answer:
Answer rating: 100% (QA)
Explanation f open gotxt Board t freadline While t boardappe... View the full answer
Related Book For
Stats Data and Models
ISBN: 978-0321986498
4th edition
Authors: Richard D. De Veaux, Paul D. Velleman, David E. Bock
Posted Date:
Students also viewed these programming questions
-
For the board game described in Exercise 3, how will you combine components to model a trial? What is the response variable? Exercise 3 Playing a board game", you are stuck in jail until you roll...
-
Two players compete against each other in a game of chance where Player A wins with probability 1/ 3 and Player B wins with probability 2/ 3. Every time Player A loses he must pay Player B $ 1, while...
-
The file P08_05.xlsx contains salary data on all NFL players in each of the years 2002 to 2009. Because this file contains all players for each of these years, you can calculate the population mean...
-
Use the remainder term to estimate the maximum error in the following approximations on the given interval. Error bounds are not unique. In (1 + x) = x - x/2; [-0.2, 0.2]
-
In Problem 14.8 on page 584, you used land area of a property and age of a house to predict appraised value (stored in GlenCove). Use the results from that problem. a. At the 0.05 level of...
-
Thornton Publications established the following standard price and costs for a hardcover picture book that the company produces: Standard price and variable costs Sales price Materials cost Labor...
-
How does use of a separate payroll checking account improve control?
-
Laura sells mushrooms and strawberries to tourists. If Laura spends the morning collecting only mushrooms, she picks 8 pints; if she spends the morning picking strawberries, she collects 6 pints. If...
-
5 . From the choice of the simple moving average, weighted moving average, exponential smoothing, and regression analysis, which forecasting technique would you consider the most accurate? Why? ( 2 0...
-
Lane Stevens is to retire from the partnership of Stevens and Associates as of March 31, the end of the current fiscal year. After closing the accounts, the capital balances of the partners are as...
-
Assume that as the HR manager, you have decided to prepare some guidelines for supervisors to use when they have to discipline employees. Gather the information needed, using Internet resources such...
-
An unrecorded check issued during the last week of the year would most likely be discovered by the auditor when the a. Check register for the next month is reviewed. b. Bank confirmation is reviewed....
-
When scheduling the audit work, the auditor should consider confirming accounts receivable balances at an interim date if a. Internal control structure policies and procedures for the existence...
-
In the confirmation of accounts receivable the auditor would most likely a. Require confirmation of all receivables from agencies of the federal government. b. Seek to obtain positive confirmations...
-
Which items appear on the Bank side of a bank reconciliation? a. Outstanding checks b. Deposits in transit c. Both a and \(b\) d. None of the above
-
Karen Sommers Travel Agency purchased land for \($90,000\) cash on December 10, 2008. At December 31, 2008, the land's value has increased to \($93,000.\) What amount should be reported for land on...
-
John has a utility function given by the expression U(x)= E(r) - 0.5A(s^2). Where E(r) is the expected return on an asset and s is the standard deviation of returns on that asset. John has the...
-
The time to assemble the first unit on a production line is 10 hours. The learning rate is 0.94. Approximately how long will it take for the seventh unit to be assembled? The number of hours needed...
-
An airline's public relations department says that the airline rarely loses passengers' luggage. It further claims that on those occasions when luggage is lost, 90% is recovered and delivered to its...
-
A consumer magazine plans to poll car owners to see if they are happy enough with their vehicles that they would purchase the same model again. They'll randomly select 450 owners of American-made...
-
A survey of students in a large Introductory Statistics class asked about their birth order (1 = oldest or only child) and which college of the university they were enrolled in. Here are the data:...
-
What does the operating-cash-flow-to-capital-expenditures ratio measure?
-
Clair, Inc., earned \(\$ 4.50\) per share of common stock in the current year and paid dividends of \(\$ 2.34\) per share. The most recent market price per share of the common stock is \(\$ 46.80\)....
-
What are two inherent limitations of financial statement data?
Study smarter with the SolutionInn App