Find Jobs
Hire Freelancers

C++ Crazy8's

$30-250 USD

Cancelado
Publicado há mais de 6 anos

$30-250 USD

Pago na entrega
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.
ID do Projeto: 15563089

Sobre o projeto

1 proposta
Projeto remoto
Ativo há 7 anos

Quer ganhar algum dinheiro?

Benefícios de ofertar no Freelancer

Defina seu orçamento e seu prazo
Seja pago pelo seu trabalho
Descreva sua proposta
É grátis para se inscrever e fazer ofertas em trabalhos

Sobre o cliente

Bandeira do(a) UNITED STATES
riverside, United States
5,0
3
Método de pagamento verificado
Membro desde nov. 5, 2017

Verificação do Cliente

Obrigado! Te enviamos um link por e-mail para que você possa reivindicar seu crédito gratuito.
Algo deu errado ao enviar seu e-mail. Por favor, tente novamente.
Usuários Registrados Total de Trabalhos Publicados
Freelancer ® is a registered Trademark of Freelancer Technology Pty Limited (ACN 142 189 759)
Copyright © 2024 Freelancer Technology Pty Limited (ACN 142 189 759)
Carregando pré-visualização
Permissão concedida para Geolocalização.
Sua sessão expirou e você foi desconectado. Por favor, faça login novamente.