Answered step by step
Verified Expert Solution
Question
1 Approved Answer
You will be programming up a simplified scoring system for the board game Go. Go is an abstract strategy game where two players compete
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.
Step by Step Solution
★★★★★
3.38 Rating (154 Votes )
There are 3 Steps involved in it
Step: 1
Explanation f open gotxt Board t freadline While t boardappe...Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started