-
Notifications
You must be signed in to change notification settings - Fork 1
/
player_mike.h
51 lines (43 loc) · 1.35 KB
/
player_mike.h
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
#ifndef _PLAYER_MIKE_H_
#define _PLAYER_MIKE_H_
#include "player.h"
// This is a very basic player. It is not very smart, and it is
// only intended to beat the even dumber player DUMB.
template <int cutoff>
class PlayerMike : public Player
{
public:
unsigned bet(int myCard, unsigned callCost, unsigned bank, unsigned pot __attribute__((unused)))
{
// Estimate how likely we are to win,
// based on the value of our card.
bool willWeWin = (rand()%13) < myCard;
// If opponent has bet/raised, then assume the opponent has a high card.
if (callCost > 0)
{
willWeWin = (myCard > cutoff);
}
if (!willWeWin)
{
// Our card is pretty small, so just give up. Don't want to lose
// any more money.
return -1; // FOLD
}
else
{
// We have a good card!
// Do we have enough money in the bank?
if (callCost <= bank)
{
// Bet/raise half of what we have left.
return callCost + (bank-callCost)/2;
}
else
{
return callCost;
}
}
}
std::string name() const {return "MIKE_" + std::to_string(cutoff);}
}; // end of class PlayerMike
#endif // _PLAYER_MIKE_H_