-
Notifications
You must be signed in to change notification settings - Fork 6
/
SimpleBot.h
46 lines (34 loc) · 1.61 KB
/
SimpleBot.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
#include "Hanabi.h"
struct CardKnowledge {
CardKnowledge();
bool mustBe(Hanabi::Color color) const;
bool mustBe(Hanabi::Value value) const;
bool cannotBe(Hanabi::Color color) const;
bool cannotBe(Hanabi::Value value) const;
int value() const;
void setMustBe(Hanabi::Color color);
void setMustBe(Hanabi::Value value);
bool isPlayable;
private:
enum Possibility { NO, MAYBE, YES };
Possibility colors_[Hanabi::NUMCOLORS];
Possibility values_[5+1];
};
class SimpleBot final : public Hanabi::Bot {
int me_;
/* What does each player know about his own hand? */
std::vector<std::vector<CardKnowledge> > handKnowledge_;
void invalidateKnol(int player_index, int card_index);
void wipeOutPlayables(const Hanabi::Card &played_card);
bool maybePlayLowestPlayableCard(Hanabi::Server &server);
bool maybeGiveHelpfulHint(Hanabi::Server &server);
public:
SimpleBot(int index, int numPlayers, int handSize);
void pleaseObserveBeforeMove(const Hanabi::Server &) override;
void pleaseMakeMove(Hanabi::Server &) override;
void pleaseObserveBeforeDiscard(const Hanabi::Server &, int from, int card_index) override;
void pleaseObserveBeforePlay(const Hanabi::Server &, int from, int card_index) override;
void pleaseObserveColorHint(const Hanabi::Server &, int from, int to, Hanabi::Color color, Hanabi::CardIndices card_indices) override;
void pleaseObserveValueHint(const Hanabi::Server &, int from, int to, Hanabi::Value value, Hanabi::CardIndices card_indices) override;
void pleaseObserveAfterMove(const Hanabi::Server &) override;
};