summaryrefslogtreecommitdiffstats
path: root/game.h
blob: 0e4d7f78298f3b1d21a582e71174ac8fca826f44 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
#ifndef _GAME_H_
#define _GAME_H_

#include <iostream>
#include <string>
#include <cstdlib>
#include <ctime>
#include <cctype>
#include <limits>

#include "cardpile.h"
#include "user.h"
#include "opponent.h"

using std::cout;
using std::endl;
using std::cin;

class Game : virtual public CardPile, public User, public Opponent
{
    private:

    protected:

    public:
        Game(void);
        void shufflePile(void);
        void askForNumberOfOpponents(void);
        void repeatGame(bool *);

        int parseInt(string *, int, int);
        int howManyCardsOfSameSuit(Card **);
        bool pairOrBetter(Card **);
        int numOfSameCards(Card **);

        struct countAndSuit numOfSameSuit(Card **);
        struct countAndType numOfSameType(Card **);
        bool doWeHaveAnAce(Card **);
        int *whichCardsToDiscard(Card **);
        void oppDiscardFromPairOrBetter(Card **, int);
        bool sanityCheck(Card **);
        void discardAndDraw(Card **, int, int);
        void opponentAI(int);

        void userDiscardCards(Card **, int);
        void userAI(Card **);

        bool isInOrderByOne(Card **);
        bool isInOrder(Card **);
        bool hasFullHouse(Card **, struct countAndType *);
        bool hasTwoPairs(Card **);
        void evaluateHand(Card **, int);
        void showHands(void);
        void determineWinner(void);

        /* variables */
        int handsPlayed;
        int handsWon;

        static string *hands[10];
        static string *suits[5];
        static string *winmsg[4];
};

#endif