Welcome to Assignment Heroes

Computer Science homework help

Computer Science homework help.  
Objective: The main objective of this assignment is checking the students’ ability to work with ADTs. In this week’s assignment, you will be writing the interface of an ADT in order to conform to the requirements of a larger application.
Description: You have been tasked with implementing a program that can read chess games from a file and detect whether the initial moves (opening) matches any of the stored openings (also read from a file). Note that the program does not compile successfully as it is missing ADT definitions which you will implement.
 
For example, the position in Figure 1, which corresponds to the first 5 moves, is called the “Italian Game”.
 
Figure 1
 
 
You must utilize 2 ADTs (Opening, Game) for the tasks described in next section.
Opening must have the following attributes:

  • String Name
  • String moves[6]: The actual moves (i.e. e4, e5, f4 or e4, e5, Nf3, Bb5) Note that some slots in the array can be empty if there are fewer than six moves in an opening
  • String Official number of times opening has been played in tournaments (the string datatype is used as the values can be larger than the int data type allows)
  • Double Percentage of White’s victory in this opening
  • Double Percentage of Draw in this opening
  • Double Percentage of Black’s victory in this opening

 
Game must have the following attributes:

  • Char outcome – specifies the outcome of the game (B for Black winning, D for draw, W for white winning.
  • int numMoves – specifies the number of moves in the game
  • String array Moves

 
You have been provided with skeleton code for the tasks below. The functions are:
 
GetString: To retrieve a filename from the user
GetNumOpenings: return number of openings from file
Menu: function that based on user input, either prints openings, detects an opening given a game file, or exits.
 
 
 
 
 
 
 
 
Task 1
 

  1. Create the two ADTs. You must include accessor functions, mutator functions, constructors. Depending on your implementation you might also need a user-defined destructor.

 

  1. Then implement the function ReadOpenings, which must read a list of openings from the file “openings.txt” and store them in an array of type Opening.

 
 
Task 2
Implement the function PrintOpenings. The expected output is illustrated in Figure 2.
 
 
 
The format of the file can be seen in Figure 3.
Figure 3
Note: You can read more about the notation used to represent a move at
https://en.wikipedia.org/wiki/Chess_notation
 
 
 
Task 3
 
You must successfully load the contents of a game file to the Game ADT’s member variables.
You have two options:

  1. Create a member function of the Game ADT to read the moves of a game, and then store them in the ADTs corresponding array
  2. Load the game’s moves to the ADT’s array, by utilizing the constructor. To do so, you can pass the file’s name as a parameter to a user-defined constructor.

 
Task 4
Implement the function DetectOpening. This function must prompt for a game’s filename to be inserted, so that a game’s moves are available. Then the game’s moves must be compared against the known openings. If an opening is detected, you must print it to the screen along with the win percentages (white win, draw, black win) in the following manner:
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
Output
 
 
 
 
 
 
 
 

Computer Science homework help

Solution:

15% off for this assignment.

Our Prices Start at $11.99. As Our First Client, Use Coupon Code GET15 to claim 15% Discount This Month!!

Why US?

100% Confidentiality

Information about customers is confidential and never disclosed to third parties.

Timely Delivery

No missed deadlines – 97% of assignments are completed in time.

Original Writing

We complete all papers from scratch. You can get a plagiarism report.

Money Back

If you are convinced that our writer has not followed your requirements, feel free to ask for a refund.