Libsaki
Core library of Pancake Mahjong
shiraitodai_sumire.h
1 #ifndef SAKI_GIRL_SHIRAITODAI_SUMIRE_H
2 #define SAKI_GIRL_SHIRAITODAI_SUMIRE_H
3 
4 #include "../form/parsed_view.h"
5 #include "../table/irs_ctrl.h"
6 
7 
8 
9 namespace saki
10 {
11 
12 
13 
14 class Sumire : public GirlCrtp<Sumire>
15 {
16 public:
18 
19  void onDice(util::Rand &rand, const Table &table) override;
20  bool checkInit(Who who, const Hand &init, const Table &table, int iter) override;
21  void onDraw(const Table &table, Mount &mount, Who who, bool rinshan) override;
22  void onIrsChecked(const Table &table, Mount &mount) override;
23 
24  std::string popUpStr() const override;
25 
26  void onTableEvent(const Table &table, const TableEvent &event) override;
27 
28 protected:
29  IrsCtrlGetter attachIrsOnDrawn(const Table &table) override;
30 
31 private:
32  void handleDrawSelf(const Table &table, Mount &mount, bool rinshan);
33  void handleDrawTarget(const Table &table, Mount &mount, bool rinshan);
34 
35  bool canStartAiming(const Table &table);
36  bool canShootTarget(const Table &table);
37  bool chooseFinalWait(const Table &table, Mount &mount, bool allowNum19, bool allowZ);
38  int evalTargetHappy(const Table &table, const Mount &mount, const Hand &dream, const Action &act);
39  bool planAimming(const Table &table, Mount &mount);
40  void updateFeedSelf(const util::Stactor<T34, 2> &plan);
41  void updateFeedSelfParse(ParsedView4Ready view, Mount &mount);
42  void updateFeedSelfYao(const util::Stactor<C34, 2> &comelds, T34 free, Mount &mount);
43  void updateFeedSelfClamp(const ParsedView4Ready &view, Mount &mount);
44 
45  void shapeYaku(const Table &table, Mount &mount, bool rinshan);
46  bool shapeYakuhai(const Table &table, Mount &mount, bool rinshan);
47 
48 private:
49  // *** SYNC order with 'mIrsCtrl' ***
50  enum IrsIndex { MAIN, RIGHT, CROSS, LEFT, ALLOW_NUM19, ALLOW_Z };
51 
52  IrsCtrlClickCheck<Sumire> mIrsCtrl {
54  "SUMIRE",
55  IrsCheckList {
56  IrsCheckItem::CHECK_ENABLED,
57  IrsCheckItem::CHILD_RADIO_DEFAULT,
58  IrsCheckItem::CHILD_RADIO,
59  IrsCheckItem::CHILD_RADIO,
60  IrsCheckItem::CHILD_CHECK,
61  IrsCheckItem::CHILD_CHECK
62  }
63  },
64  &Sumire::mIrsCtrl
65  };
66 
67  Who mTarget;
68  T34 mFinalWait;
69  T37 mFeedTarget;
70  util::Stactor<T34, 2> mFeedSelf;
71  std::bitset<34> mTargetShits;
72  int mShootTrial = 0;
73 };
74 
75 
76 
77 } // namespace saki
78 
79 
80 
81 #endif // SAKI_GIRL_SHIRAITODAI_SUMIRE_H
Definition: table_event.h:23
Definition: parsed_view.h:13
Definition: irs_ctrl.h:121
IrsCtrlGetter attachIrsOnDrawn(const Table &table) override
Overriden to define a drawn-time IRS&#39;s showing condition.
Definition: shiraitodai_sumire.cpp:107
Definition: mount.h:54
Definition: table.h:87
Definition: rand.h:19
Definition: tile.h:25
void onIrsChecked(const Table &table, Mount &mount) override
Called after self&#39;s IRS-check action.
Definition: shiraitodai_sumire.cpp:51
Definition: action.h:27
Definition: ai.cpp:18
void onDice(util::Rand &rand, const Table &table) override
Called when someone is about to dice.
Definition: shiraitodai_sumire.cpp:18
Definition: choices.h:130
Definition: shiraitodai_sumire.h:14
Definition: hand.h:17
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_sumire.cpp:43
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
Definition: girl.h:212
Definition: who.h:14