Learning Goal: I’m working on a c++ project and need an explanation and answer to help me learn.Check that you have the following files:(provided starter code in attachments) cards.cpp, cards.h // These files should contain your implementation of the binary search tree to store a list of cards
(provided starter code in attachments) main.cpp // This file should read in the cards of the two players from input files and put everything together to play the game.
Text files used for testing
Create the following files:ultility.cpp, ultility.h // These files should contain any other classes that you need to implement your game,
tests.cpp // These files should contain test code for all the classes and methods you used in your game. We recommend at least 5 test cases for each public member function. While the test file will not be evaluated, there is an expectation that you will produce test code that causes failues when seeking help from TAs/ULAs. Course staff is asked to refrain from debugging student code or pointing out program bugs. So having test code available is important to enable the coure staff to help you more effectively.
Makefile // Write your own makefile that generates two executables- the first should be called game (expected output for game is described later). The second should be called tests and must RUN (not just compile) all the test code to unit test your classes and methods
The gameAlice and Bob are playing a game a bit like Go Fish, although neither of them is very good at it. The players are dealt two sets of cards which are provided in two separate files as inputs to your program. Although the cards in each player’s hand is unique, duplicates exist in the other player’s hand.Once you have the sets of cards, the game begins. Alice and Bob take turns playing the game. Alice iterates forward through her hand in increasing order of the card values (see next section on how cards are ordered), checking whether Bob has that card. Once a matching card is found, your program should print the line “Alice picked matching card “. The card should then be removed from both players hands.The process then repeats, except this time, Bob looks through his cards starting with the largest card and working towards the smallest card. This means that while the first card Alice finds should be the first shared card (in order), the first card Bob finds should be the last shared card (in order). The game ends once they do not have any cards in common and you should print out the final hands of both players. Note that players do not draw any new cards during this process.The ordering of cards is described in the next section.Card orderingThe ordering of cards is determined first by its suit and then by the value:The ordering least to greatest is: clubs, diamonds, spades, hearts. Thus a club of any value is less than a diamond of any value.
The ordering within each suit is determined by the value from least to greatest as follows: ace, 2, 3, . . . 10, jack, queen, king.
Based on the above two rules, the correct ordering ofh 9, c k, s 3, c a, h j, d 3would bec a, c k, d 3, s 3, h 9, h jYour approachAt the start of the program, you will read in Alice and Bob’s starting hands from two files. The names of these files are provided as command line arguments with Alice’s file in argv and Bob’s in argv. The starter code opens the files for you as ifstream objects, which you can treat much like cin. You should read Alice and Bob’s cards into two binary search trees. You must implement the binary search trees yourself. Don’t worry about balancing the binary search trees (though you can try and optimize this if you like). Your binary search tree class should obey the card ordering rules given above. While implementing this, you may find it helpful to overload the operators ==, <, and > on your card class so that you can easily choose which branches to go down on your binary tree. Note that you need to correctly handle the case of cards with the value 10 (which has two characters) and separately compare the value and suit, so storing the cards as strings is probably not the best approach.Once you have the sets of cards, the game begins as described before.As before, you should write your own Makefile for this lab so that running make builds an executable called game.Before you beginAn additional requirement is that you write a set of unit tests for your binary search tree. These should be in a file called tests.cpp, which you will submit, and you should write your Makefile so that running make test compiles and runs these tests. Note that there will be no Gradescope tests for these unit tests, so you can have the output in whatever format you find most helpful. You should test each of the functions on your binary search tree, which will include, at the very least, find(), delete(), insert(), successor(), and predecessor(). You should write these tests BEFORE implementing the full game to ensure that your binary search tree works correctly. Debugging one set of code is much easier than debugging two at the same time. This will also ensure that your are correctly separating your binary tree class from the rest of your program logic.Example run of the programContents of alice_cards.txt:h 3
Contents of bob_cards.txt:c 2
Correct output after running make && ./game alice_cards.txt bob_cards.txt:Alice picked matching card c 3
Bob picked matching card h 10
Alice picked matching card d a
Bob picked matching card s 10
Note: a=ace, k=king, q=queen, j=jackRequirementsFor this lab, you will have a lot of flexibility on your implementation (which just means we won’t be providing a code framework for you to fill in). However, there are a few requirements that your mentor will check for when they look at your code. Keep these in mind as you think about your solution:You must use a binary search tree you implemented yourself to solve the problem, not another data structure or a class in the standard library.
Your binary search tree must implement a constructor, a destructor and other other methods as needed
You code should be readable
Your classes should define clear interfaces and hide implementation details as much as possible.
Your program must properly free all memory it allocates, including your binary tree nodes and any dynamically allocated data stored inside them.
You do not need to worry about having multiple instances of the same card. Each card will appear only once per hand.
Submission instructionsYou must organize your program in the files: main.cpp, cards.cpp, tests.cpp, cards.h, utility.cpp and utility.hIn addition you must create a Makefile that compiles your program to an executable called game.
Requirements: as long as it needs to be for the project to work | .doc file
Why Work with Us
Top Quality and Well-Researched Papers
We always make sure that writers follow all your instructions precisely. You can choose your academic level: high school, college/university or professional, and we will assign a writer who has a respective degree.
Professional and Experienced Academic Writers
We have a team of professional writers with experience in academic and business writing. Many are native speakers and able to perform any task for which you need help.
Free Unlimited Revisions
If you think we missed something, send your order for a free revision. You have 10 days to submit the order for review after you have received the final document. You can do this yourself after logging into your personal account or by contacting our support.
Prompt Delivery and 100% Money-Back-Guarantee
All papers are always delivered on time. In case we need more time to master your paper, we may contact you regarding the deadline extension. In case you cannot provide us with more time, a 100% refund is guaranteed.
Original & Confidential
We use several writing tools checks to ensure that all documents you receive are free from plagiarism. Our editors carefully review all quotations in the text. We also promise maximum confidentiality in all of our services.
24/7 Customer Support
Our support agents are available 24 hours a day 7 days a week and committed to providing you with the best customer experience. Get in touch whenever you need any assistance.
Try it now!
How it works?
Follow these simple steps to get your paper done
Place your order
Fill in the order form and provide all details of your assignment.
Proceed with the payment
Choose the payment system that suits you most.
Receive the final file
Once your paper is ready, we will email it to you.
No need to work on your paper at night. Sleep tight, we will cover your back. We offer all kinds of writing services.
No matter what kind of academic paper you need and how urgent you need it, you are welcome to choose your academic level and the type of your paper at an affordable price. We take care of all your paper needs and give a 24/7 customer care support system.
Admission Essays & Business Writing Help
An admission essay is an essay or other written statement by a candidate, often a potential student enrolling in a college, university, or graduate school. You can be rest assurred that through our service we will write the best admission essay for you.
Our academic writers and editors make the necessary changes to your paper so that it is polished. We also format your document by correctly quoting the sources and creating reference lists in the formats APA, Harvard, MLA, Chicago / Turabian.
If you think your paper could be improved, you can request a review. In this case, your paper will be checked by the writer or assigned to an editor. You can use this option as many times as you see fit. This is free because we want you to be completely satisfied with the service offered.