Results 1 to 2 of 2
  1. #1
    NullX's Avatar
    Join Date
    May 2019
    Gender
    male
    Posts
    1
    Reputation
    10
    Thanks
    0

    Homework Create Crazy 8's card game

    Hey all,
    I'm having trouble with making the code translating and the logic (how will the computer know which card is which).
    I am able to break it down and try to see I would need to write out the code. The assignment is:

    The mission of this assignment is to realize a "Crazy Eights" card game using a standard 52-card deck. In this assignment, you will be playing with other 3 people whose card turns are automatically generated according to the next rules:
    find the same number of any suit
    find the same suit
    use any eight and declare the suit of the most occurring suit in hand (e.g., select H if HHHCCDS in hand)
    draw from the deck until finding any of the above
    You need to implement the card selection in this order. Each player is given 6 cards at the beginning of the game. You are the first player, and anyone who used up all cards will win. Game also ends when all cards in the stockpile are used. You should check all the potential input errors. The first card in the pile may be a crazy eight, in which case use it as a selection condition of suit or reshuffle the pile to choose another non crazy eight card (choice is up to you). Note that this version of Crazy Eight can discard only one card at a time and needs to draw from deck until an eligible card is found (added 5/1).
    You must display all kinds of transactions happening in the progress of the game. At your turn, typing "?" will show hands of others (cheating option). The next session shows an example game sessions. Observe carefully and adapt this output format as much as possible -- points will be deducted if we found yours too much deviated from.
    Pile has S10 <--- your turn

    (a) C3 (b) H3 (c) C8 (d) S3 (e) HK (f) DQ (g) draw

    Which one to play? d

    Pile has S3
    Player 1 chose H8
    Player 1 declared suite C
    Pile has C*
    Player 2 chose CJ
    Pile has CJ
    Player 3 chose CK
    Pile has CK <--- your turn

    (a) C3 (b) H3 (c) C8 (d) DQ (e) HK (f) draw

    Which one to play? a
    Pile has C3
    Player 1 chose CQ
    Pile has CQ
    Player 2 chose D8
    Player 2 declared suite S
    Pile has S*
    Player 3 drawing...
    Player 3 chose S9
    Pile has S9 <--- your turn

    (a) HK (b) H3 (c) C8 (d) DQ (e) draw

    Which one to play? ?
    Player 1 (a) D9 (b) H4 (c) C4 (d) HA
    Player 2 (a) S7 (b) HJ (c) SA (d) SK
    Player 3 (a) H5 (b) H6 (c) H2 (d) DA (e) H10
    Which one to play? e

    (a) HK (b) H3 (c) C8 (d) DQ (e) D6 (f) draw

    Which one to play? f

    (a) HK (b) H3 (c) C8 (d) DQ (e) D6 (f) S5 (g) draw

    Which one to play? f
    Pile has S5
    Player 1 drawing...
    Player 1 chose S6
    Pile has S6
    Player 2 chose S7
    Pile has S7
    Player 3 drawing...
    Player 3 chose D7
    Pile has D7 <--- your turn

    (a) HK (b) H3 (c) C8 (d) DQ (e) D6 (f) draw

    Which one to play? d
    Pile has DQ
    Player 1 chose D9
    Pile has D9
    Player 2 drawing...
    Player 2 drawing...
    Player 2 drawing...
    Player 2 chose C9
    Pile has C9
    Player 3 drawing...
    Player 3 drawing...
    Player 3 drawing...
    Player 3 chose S8
    Player 3 declared suite H
    Pile has H* <--- your turn

    (a) HK (b) H3 (c) C8 (d) D6 (e) draw

    Which one to play? a
    Pile has HK
    Player 1 chose HA
    Pile has HA
    Player 2 chose HJ
    Pile has HJ
    Player 3 chose H5
    Pile has H5 <--- your turn

    (a) D6 (b) H3 (c) C8 (d) draw

    Which one to play? b
    Pile has H3
    Player 1 chose H4
    Pile has H4
    Player 2 chose HQ
    Pile has HQ
    Player 3 chose H6
    Pile has H6 <--- your turn

    (a) D6 (b) C8 (c) draw

    Which one to play? b
    Which suit you want? D
    Pile has D*
    Player 1 drawing...
    Player 1 chose D5
    Pile has D5
    Player 2 drawing...
    Player 2 drawing...
    Player 2 chose DK
    Pile has DK
    Player 3 chose D3
    Pile has D3 <--- your turn

    (a) D6 (b) draw

    Which one to play? a
    You won!

    [ Final card distributions ]
    Player 0
    Player 1 (a) C4
    Player 2 (a) SK (b) C2 (c) SA (d) S4
    Player 3 (a) H10 (b) SJ (c) H2 (d) DA

    In the game, Player 0 represents you and Player 1 through 3 are (machine-implemented) family member competitors. 180 lines max

  2. #2
    Hell_Demon's Avatar
    Join Date
    Mar 2008
    Gender
    male
    Location
    I love causing havoc
    Posts
    3,977
    Reputation
    343
    Thanks
    4,307
    My Mood
    Cheeky
    Give all cards a 2 letter identifier(suit + value)
    e.g.
    C5 = 5 of Clubs
    D6 = 6 of Diamonds
    S3 = 3 of Spades
    H8 = 8 of Hearts.


    if you store this as simple char[2] for each card in the list then it's trivial to check if the suit or value matches. If this is done in C++ you can use enums and structs to mimic the objects, the enums would specify integer values for suits and cards, and your card struct can hold both suit and value. std::vector or std::queue could be used to store all the cards(standard library also has easy access to shuffling cards).
    Ah we-a blaze the fyah, make it bun dem!

Similar Threads

  1. Card Game
    By Cappesh in forum Spammers Corner
    Replies: 5
    Last Post: 10-17-2011, 04:46 PM
  2. [Help] Creating a new thread closes game?
    By boboben1 in forum Call of Duty Black Ops Coding, Programming & Source Code
    Replies: 0
    Last Post: 03-17-2011, 12:27 AM
  3. The Illuminati card Game (Please read!)
    By Ethereal in forum United States of America
    Replies: 25
    Last Post: 12-09-2010, 09:35 AM
  4. [Tutorial] Creating an account at LevelUp! Games
    By SorrySniper in forum Combat Arms Brazil Tutorials
    Replies: 7
    Last Post: 09-19-2010, 01:00 AM
  5. Element trading card game trainer
    By anticreeps in forum General Game Hacking
    Replies: 1
    Last Post: 10-07-2009, 10:47 PM