4 Copyright (c) 2010 Lode Vandevenne
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/>.
34 //an EventType has some information associated with it in the Event struct.
35 //The comment at to each event says which info exactly, if any.
36 //If an event is related to a player, the player is always given as a string (not as an index). You can use those player names to uniquely identify them.
38 //info used: player, chips (with how much chips this player joins)
39 E_JOIN
, //player joins table
41 //info used: player, chips
42 E_QUIT
, //player quits table (with so many chips left; usually 0 unless he quits early, which isn't always allowed)
44 //info used: player, chips (with how much chips this player rebuys)
45 E_REBUY
, //player lost his stack and rebuys
47 //info used: player, chips
48 E_SMALL_BLIND
, //player places the small blind on the table. The amount can be smaller than the actual small blind, because, he might be all-in!
50 //info used: player, chips
51 E_BIG_BLIND
, //player places the small blind on the table. The amount can be smaller than the actual big blind, because, he might be all-in!
53 //info used: player, chips
54 E_ANTE
, //player places the ante on the table. The amount can be smaller than the actual ante, because, he might be all-in!
65 //info used: player, chips (the amount ABOVE the call amount)
68 //info used: smallBlind, bigBlind, ante
69 E_NEW_DEAL
, //= going back to preflop, receiving cards, ...
71 //info used: player, card1, card2 (the hand cards)
72 E_RECEIVE_CARDS
, //This event shows the holecards you get.
74 //info used: card1, card2, card3
75 E_FLOP
, //this event contains the 3 flop cards
77 //info used: card1, card2, card3, card4 (the turn card)
78 E_TURN
, //this event contains the Turn card
80 //info used: card1, card2, card3, card4, card5 (the river card)
81 E_RIVER
, //this event contains the River card
84 E_SHOWDOWN
, //this event indicates that the stage past the river is reached while multiple players are still active. A showdown of their cards will follow. This event can be used to distinguish between a deal ending because one player outbluffed everyone, or, a showdown going to occur. Not to be confused with E_PLAYER_SHOWDOWN!
86 //info used: chips (total pot)
87 E_POT_DIVISION
, //this event gives the pot amount right before a win amount, so you know the difference between split pot and non-split-pot. This even also indicates the deal is done, it is always given exactly once per deal (and is a counterpart of E_NEW_DEAL).
89 //info used: player, card1, card2 (his hand cards)
90 E_PLAYER_SHOWDOWN
, //the cards shown by 1 player, when required to show them. Not to be confused with E_SHOWDOWN!
92 //info used: player, card1, card2 (his hand cards)
93 E_BOAST
, //this is when the player shows cards while not needed, for the rest same as E_PLAYER_SHOWDOWN
95 //info used: player, card1, card2, card3, card4, card
96 E_COMBINATION
, //combination a player has after his showdown
98 //info used: player, chips (amount that goes from the pot towards this player)
99 E_WIN
, //player wins the entire pot or part of the pot at the end of a deal
102 E_DEALER
, //lets know who the dealer is
104 //info used: player, position, chips (chips is used to indicate tournament score, can be stack minus buyInTotal for example, depending on win condition)
105 E_TOURNAMENT_RANK
, //how good did this player rank for this tournament?
107 //info used: player, ai
108 E_REVEAL_AI
, //reveals the AI of a player (at the end of the game)
111 E_LOG_MESSAGE
, //not sent to AI's
114 E_DEBUG_MESSAGE
, //not sent to AI's
116 E_NUM_EVENTS
//don't use
123 std::string player
; //name of player the event is related to
124 std::string ai
; //used for very rare events that unmistify the AI of a player
125 int chips
; //money above call amount, if it's a raise event. Win amount if it's a win event. Pot amount if it's a pot event.
131 int position
; //position for E_TOURNAMENT_WIN event
133 //cards used for some event. Flop uses 3, turn uses card4, river uses card5, showdown and new_game uses card1 and card2. Win uses all 5.
140 Event(EventType type
);
141 Event(EventType type
, const std::string
& player
);
142 Event(EventType type
, const std::string
& player
, int chips
);
143 Event(EventType type
, int position
, const std::string
& player
);
144 Event(EventType type
, int position
, int chips
, const std::string
& player
);
145 Event(EventType type
, const std::string
& player
, const std::string
& ai
);
146 Event(EventType type
, const Card
& card1
);
147 Event(EventType type
, const Card
& card1
, const Card
& card2
);
148 Event(EventType type
, const Card
& card1
, const Card
& card2
, const Card
& card3
);
149 Event(EventType type
, const Card
& card1
, const Card
& card2
, const Card
& card3
, const Card
& card4
);
150 Event(EventType type
, const Card
& card1
, const Card
& card2
, const Card
& card3
, const Card
& card4
, const Card
& card5
);
151 Event(EventType type
, const std::string
& player
, const Card
& card1
, const Card
& card2
, const Card
& card3
, const Card
& card4
, const Card
& card5
);
152 Event(EventType type
, const std::string
& player
, const Card
& card1
, const Card
& card2
);
153 Event(EventType type
, int smallBlind
, int bigBlind
, int ante
);
154 Event(const std::string
& message
, EventType type
);
160 //this gives the event in a good form for a log or computer parsing
161 std::string
eventToString(const Event
& event
);
163 //this gives the event in a more verbose full English sentence form
164 std::string
eventToStringVerbose(const Event
& event
);
166 //TODO: make the opposite, a stringToEvent parsing function
168 //sends unprocessed events to player, but only events the player is allowed to know! (the events vector is not supposed to contain personal events, such as E_RECEIVE_CARDS)
169 void sendEventsToPlayers(size_t& counter
, std::vector
<Player
>& players
, std::vector
<Observer
*>& observers
, const std::vector
<Event
>& events
);