Libsaki
Core library of Pancake Mahjong
shiraitodai_awai.h
1 #ifndef SAKI_GIRL_SHIRAITODAI_AWAI_H
2 #define SAKI_GIRL_SHIRAITODAI_AWAI_H
3 
4 #include "../table/princess.h"
5 #include "../table/irs_ctrl.h"
6 
7 
8 
9 namespace saki
10 {
11 
12 
13 
14 class Awai : public GirlCrtp<Awai>, public HrhBargainer
15 {
16 public:
18 
19  bool checkInit(Who who, const Hand &init, const Table &table, int iter) override;
20  void onMonkey(std::array<Exist, 4> &exists, const Table &table) override;
21  void onDraw(const Table &table, Mount &mount, Who who, bool rinshan) override;
22  void onFlipKandoraIndic(const Table &table, Mount &mount) override;
23  void onDigUradoraIndic(const Table &table, Mount &mount, util::Stactor<Who, 4> openers) override;
24 
25  HrhBargainer *onHrhBargain(const Table &table) override;
26  Claim hrhBargainClaim(int plan, T34 t) override;
27  int hrhBargainPlanCt() override;
28  void onHrhBargained(int plan, Mount &mount) override;
29  std::optional<HrhInitFix> onHrhBeg(util::Rand &rand, const Table &table,
30  const TileCount &stock) override;
31 
32 protected:
33  IrsCtrlGetter attachIrsOnDice() override;
34 
35 private:
36  struct InitSketch
37  {
38  std::array<T34, 3> heads;
39  T34 pair;
40  bool thirdIsTri;
41  TileCount need;
42  };
43 
44  bool usingDaburii() const;
45  bool checkInitSelf(const Hand &init, int iter) const;
46  bool checkInitRival(const Hand &init, int iter) const;
47  T34 kanuraOfPlan(int plan) const;
48  static int lastCorner(int dice, int kanCt);
49  void begIter(HrhInitFix &fix, util::Rand &rand, const TileCount &stock);
50  InitSketch sketch(util::Rand &rand, const util::Stactor<Suit, 3> &avaiSuits) const;
51  bool pickWait(HrhInitFix &fix, util::Rand &rand, InitSketch &ske, const TileCount &stock);
52  bool waitable(InitSketch &ske, const TileCount &stock, T34 wait);
53 
54 private:
55  static const int DRAG_MK = 100;
56  static const int ACCEL_MK = 800;
57  static const int EJECT_MK = 100;
58 
59  IrsCtrlCheck<Awai> mIrsCtrl {
61  "AWAI",
62  IrsCheckList {
63  IrsCheckItem::CHECK_ENABLED
64  }
65  }
66  };
67  T34 mSomeGuestWind;
68  T37 mFirstDraw;
69  bool mNeedFirstDraw = false;
70  T34 mKanura;
71  std::vector<T34> mLastWaits;
72 };
73 
74 
75 
76 } // namespace saki
77 
78 
79 
80 #endif // SAKI_GIRL_SHIRAITODAI_AWAI_H
Interface for working with the &#39;bargain&#39; stage.
Definition: princess.h:38
void onDigUradoraIndic(const Table &table, Mount &mount, util::Stactor< Who, 4 > openers) override
Avoid hitting more than 4 uradoras when using daburii.
Definition: shiraitodai_awai.cpp:117
IrsCtrlGetter attachIrsOnDice() override
Overriden to define a dice-time IRS&#39;s showing condition.
Definition: shiraitodai_awai.cpp:203
Claim
Definition: princess.h:47
Definition: mount.h:54
Definition: table.h:87
Definition: rand.h:19
Definition: tile.h:25
void onDraw(const Table &table, Mount &mount, Who who, bool rinshan) override
Called when someone is about to draw a tile from the mountain.
Definition: shiraitodai_awai.cpp:40
Definition: shiraitodai_awai.h:14
Definition: tile_count.h:17
void onFlipKandoraIndic(const Table &table, Mount &mount) override
Avoid hitting kandora when using daburii.
Definition: shiraitodai_awai.cpp:104
Definition: irs_ctrl.h:60
Definition: ai.cpp:18
Definition: choices.h:130
Definition: hand.h:17
Wrapper of a "T Girl::*" value where T implements IrsCtrl.
Definition: girl.h:77
Definition: tile.h:353
Stactor = statically allocated vector.
Definition: stactor.h:247
Data object for directly assigning init-hand.
Definition: princess.h:16
Definition: girl.h:212
Definition: who.h:14