28 #ifndef GROOVIE_LOGIC_CAKE_H 29 #define GROOVIE_LOGIC_CAKE_H 31 #include "common/random.h" 32 #include "common/system.h" 42 void run(byte *scriptVariables);
45 static const int WIDTH = 8;
46 static const int HEIGHT = 7;
47 static const int GOAL_LEN = 4;
48 static const int WIN_SCORE = 1000000;
49 static const byte STAUF = 1;
50 static const byte PLAYER = 2;
51 static const int NUM_LINES = 107;
56 struct LinesMappings {
57 byte lengths[WIDTH][HEIGHT];
58 byte indecies[WIDTH][HEIGHT][GOAL_LEN * GOAL_LEN];
62 struct PlayerProgress {
64 int _linesCounters[NUM_LINES];
67 PlayerProgress _playerProgress;
68 PlayerProgress _staufProgress;
70 byte _boardState[WIDTH][HEIGHT];
71 byte _columnHeights[WIDTH];
80 void setLineNum(uint x, uint y, uint index);
81 bool isColumnFull(byte column);
82 PlayerProgress &getPlayerProgress(
bool stauf);
83 void updateScores(byte x,
bool revert =
false);
84 void placeBonBon(byte x);
85 void revertMove(byte x);
89 int aiRecurse(
int search_depth,
int parent_score);
90 byte aiGetBestMove(
int search_depth);
92 void runCakeTest(uint seed,
const char *moves,
bool player_win);
93 void runCakeTestNoAi(
const char *moves,
bool player_win,
bool draw);
98 #endif // GROOVIE_LOGIC_CAKE_H