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]
-
Kirby, Inc., one of the largest home improvement retailers, reported the following information (adapted) in its comparative financial statements for the fiscal year ended January 31, 2015:...
-
What are three things you can learn from taking a Corporate Social Responsibility?
-
FRAUD PREVENTION AND DETERRENCE IN ACTION Assume the following facts: thirty-day collection period. The invoice is used to post-sales to the accounting system. Checks are received in the mailroom and...
-
The comparative balance sheet of Green Earth Lawn and Garden Inc. for December 31, 2008 and 2009, is as follows: Dec. 31, 2009 Dec. 31, 2008 Assets The income statement for the year ended December...
-
A 250 kg beam is raised through 25 m at a constant velocity by a crane. a) Draw an FBD for the beam. b) Determine the work done by the crane on the beam. c) Determine the work done by gravity on the...
-
The founder of Frenza asks us to assist her in accounting and analysis of the corporations bonds, which have an annual contract rate of 8%. She wants to know the business and accounting implications...
-
Vx? +8 - V10 - x Evaluate : lim Vx? +3 - V5 -1 X-1
-
ABC Company and XYZ Company need to raise funds to pay for capital improvements at their manufacturing plants. ABC Company is a well-established firm with an excellent credit rating in the debt...
-
Jennifer McAfee recently received her university Masters degree and has decided to enter the mortgage brokerage business. Rather than work for someone else, she has decided to open her own shop. Her...
-
SlapShot plc has a fixed cost associated with buying and selling marketable securities of 100. The interest rate is currently 0.021 per cent per day, and the firm has estimated that the standard...
-
Saint-Michel SA needs a total of 54,000 in cash during the year for transactions and other purposes. Whenever cash runs low, it sells off 20,000 in securities and transfers the cash in. The interest...
-
TByrne Ltd is currently holding 700,000 in cash. It projects that over the next year its cash outflows will exceed cash inflows by 360,000 per month. How much of the current cash holding should be...
-
A company reports on the cash basis. During the company's first year of business, it had sales on account of $1,000,000, inventory purchases on account of $400,000, and other expenses of $200,000. At...
-
Suppose the S&P 500 futures price is 1000, = 30%, r = 5%, = 5%, T = 1, and n = 3. a. What are the prices of European calls and puts for K = $1000? Why do you find the prices to be equal? b. What...
-
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:...
-
The random variables \(x\) and \(y\) are Gaussian with mean value 0 and variance 1 . Their covariance may be 0 or some know positive value \(r>0\). Show that the best choice between these...
-
A random variable \(x\) is distributed according to the Cauchy distribution, The parameter \(m\) can take on either of two values, \(m_{0}\) or \(m_{1}\), where \(m_{0} P(x) = = m (m + x)
-
Derive Eqs. (9.105) and (9.106). Equation 9.105 Equation 9.106 SNRDD-PIN rn Prec 2hvRb = (nrno)/2,
Study smarter with the SolutionInn App