ScummVM API documentation
cell.h
1 /* ScummVM - Graphic Adventure Engine
2  *
3  * ScummVM is the legal property of its developers, whose names
4  * are too numerous to list here. Please refer to the COPYRIGHT
5  * file distributed with this source distribution.
6  *
7  * This program is free software: you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation, either version 3 of the License, or
10  * (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program. If not, see <http://www.gnu.org/licenses/>.
19  *
20  *
21  * This file is dual-licensed.
22  * In addition to the GPLv3 license mentioned above, MojoTouch has exclusively licensed
23  * this code on November 10th, 2021, to be use in closed-source products.
24  * Therefore, any contributions (commits) to it will also be dual-licensed.
25  *
26  */
27 
28 #ifndef GROOVIE_LOGIC_CELL_H
29 #define GROOVIE_LOGIC_CELL_H
30 
31 #include "common/textconsole.h"
32 
33 #define BOARDSIZE 7
34 #define CELL_CLEAR 0
35 #define CELL_BLUE 1
36 #define CELL_GREEN 2
37 
38 namespace Groovie {
39 
40 class CellGame {
41 public:
42  CellGame(bool easierAi);
43  ~CellGame();
44  void run(uint16 depth, byte *scriptBoard);
45 
46  byte getStartX();
47  byte getStartY();
48  byte getEndX();
49  byte getEndY();
50 
51 private:
52  void copyToTempBoard();
53  void copyFromTempBoard();
54  void copyToShadowBoard();
55  void pushBoard();
56  void popBoard();
57  void pushShadowBoard();
58  void popShadowBoard();
59  void clearMoves();
60  void pushMove();
61  void resetMove();
62  bool canMoveFunc1(int8 color);
63  bool canMoveFunc2(int8 color);
64  bool canMoveFunc3(int8 color);
65  void takeCells(uint16 whereTo, int8 color);
66  void countAllCells();
67  int countCellsOnTempBoard(int8 color);
68  void makeMove(int8 color);
69  int getBoardWeight(int8 color1, int8 color2);
70  void chooseBestMove(int8 color);
71  int8 calcBestWeight(int8 color1, int8 color2, uint16 depth, int bestWeight);
72  void doGame(int8 color, int depth);
73  void calcMove(int8 color, uint16 depth);
74 
75  byte _startX;
76  byte _startY;
77  byte _endX;
78  byte _endY;
79 
80  int8 _board[57];
81  int8 _tempBoard[58];
82  int8 _shadowBoard[64];
83  int8 _boardStack[570];
84  int _boardStackPtr;
85 
86  int8 _boardSum[58];
87 
88  int8 _stack_startXY[128];
89  int8 _stack_endXY[128];
90  int8 _stack_pass[128];
91  int _stack_index;
92 
93  int _coeff3;
94  bool _flag1, _flag2, _flag4;
95  int _moveCount;
96  bool _easierAi;
97 };
98 
99 } // End of Groovie namespace
100 
101 #endif // GROOVIE_LOGIC_CELL_H
Definition: cell.h:40
Definition: cursor.h:32