Find Jobs
Hire Freelancers

C++ Crazy8's

$30-250 USD

Cancelled
Posted over 6 years ago

$30-250 USD

Paid on delivery
Description for the requirements for the program are as listed are below. : In this project you are going to write the code to implement the card game Crazy Eights, using a linear data structure to represent the deck of cards. -There should be separate .h and .cpp files for all the classes in addition to your main program source code file. -The Deck class must contain a linear data structure that you have coded yourself – you MAY NOT use the STL library for this data structure and you MAY NOT use an array. In addition to the pointer to the top of the linked structure of cards, your Deck class should maintain a size variable indicating how many cards are in the deck. Your Deck class should have the following member functions: • A fill() function to initialize the Deck to contain the standard 52 playing cards found in a deck of cards: (Ace, 2, 3 … 10, Jack, Queen and King in suits Hearts, Diamonds, Clubs and Spades). If you wish to represent the 10 card as a T instead, e.g. T♥ would be the ten of hearts, then you are free to do so. • A drawCard() function to remove the top card from the Deck and return it. • A removeCard() function to find a specific card and remove it from the Deck. • An addCard() function to insert a new card into the Deck. • A shuffle() function to randomize the order of the cards in the Deck. You will implement a simulation of a standard riffle shuffle based on the Gilbert-Shannon-Reeds model. To perform one riffle, you will split the deck into two halves (stored in two Deck objects) – you should split the original deck by taking the first 50% of the cards and placing them on one Deck object and then put all of the remainder on a second Deck object: don’t alternate putting the cards on the two half decks. You will then loop through randomly choosing a card from one of the two half decks. If the first half deck contains x cards and the second half deck contains y cards, then with probability x/(x + y) you will pull a card from the first half deck onto the original deck, otherwise you will pull a card from the second half deck. Your shuffle function should riffle the cards seven times to fully randomize the order. • You must include a destructor and copy constructor to clean up properly after your code. Note that if there’s an error in your destructor or copy constructor code, it may well cause the program to crash immediately after it appears to finish.
Project ID: 15563089

About the project

1 proposal
Remote project
Active 7 yrs ago

Looking to make some money?

Benefits of bidding on Freelancer

Set your budget and timeframe
Get paid for your work
Outline your proposal
It's free to sign up and bid on jobs

About the client

Flag of UNITED STATES
riverside, United States
5.0
3
Payment method verified
Member since Nov 5, 2017

Client Verification

Thanks! We’ve emailed you a link to claim your free credit.
Something went wrong while sending your email. Please try again.
Registered Users Total Jobs Posted
Freelancer ® is a registered Trademark of Freelancer Technology Pty Limited (ACN 142 189 759) & Freelancer Online India Private Limited (CIN U93000HR2011FTC043854)
Copyright © 2024 Freelancer Technology Pty Limited (ACN 142 189 759)
Loading preview
Permission granted for Geolocation.
Your login session has expired and you have been logged out. Please log in again.