fix infinite check bug
[rofl0r-oopoker.git] / table.h
blob5e3219b9cb14c9f3d17235737f2133799680cdec
1 /*
2 OOPoker
4 Copyright (c) 2010 Lode Vandevenne
5 All rights reserved.
7 This file is part of OOPoker.
9 OOPoker is free software: you can redistribute it and/or modify
10 it under the terms of the GNU General Public License as published by
11 the Free Software Foundation, either version 3 of the License, or
12 (at your option) any later version.
14 OOPoker is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 GNU General Public License for more details.
19 You should have received a copy of the GNU General Public License
20 along with OOPoker. If not, see <http://www.gnu.org/licenses/>.
23 #pragma once
25 #include <vector>
26 #include <string>
27 #include <algorithm>
28 #include <iostream>
29 #include <sstream>
31 #include "card.h"
32 #include "game.h"
35 The table is where the games happen. This holds information used by the Game.
36 AI's can't use this information, they get an Info struct instead.
38 struct Table
40 std::vector<Player> players;
41 std::vector<Observer*> observers;
43 int dealer; //index of the dealer in the players vector
44 int current; //index of the current player making a decision
47 This is roughly the last person who raised. This is used to know when a betting round stops.
48 This is made so that if the current player is the lastRaiser, the round ends.
49 This takes the fact that the big blind can make a decision into account.
51 int lastRaiser;
53 Round round;
54 int turn; //how many decision making turns this round has had so far (if people keep raising all the time this could take forever!)
56 int lastRaiseAmount; //last raise amount during this deal. This is used to disallow smaller raises. Initially this is set to the big blind. All-ins don't count towards this amount, so that it's possible to form a side-pot with smaller bets.
58 //NOTE: the values of these cards are only valid if the Round is correct.
59 //flop cards
60 Card boardCard1;
61 Card boardCard2;
62 Card boardCard3;
63 //turn card
64 Card boardCard4;
65 //river card
66 Card boardCard5;
68 Table();
70 int getPot() const;
71 int getHighestWager() const;
72 int getCallAmount() const; //get amount of money required for you to call
74 int getNumActivePlayers() const; //players that are not folded or out
75 int getNumDecidingPlayers() const; //get amount of players that still make decision: players that aren't folded and aren't all-in
77 int wrap(int index) const; //wrap: convert any index into a valid player index. For example if you do "yourIndex - 1", this gets converted to the index of the player left of you, even if yourIndex was 0
78 int getSmallBlindIndex() const;
79 int getBigBlindIndex() const;
81 bool hasHumanPlayer() const;
82 bool hadHumanPlayer() const; //the table has a human player now, or had one once but he's out