ScummVM API documentation
winerack.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_WINERACK_H
29 #define GROOVIE_LOGIC_WINERACK_H
30 
31 #include "common/random.h"
32 #include "common/system.h"
33 
34 namespace Groovie {
35 
36 /*
37  * Wine rack puzzle in Clandestiny.
38  * The player needs to create a path of bottles from one side to the other
39  * before the ghost of Auld Sot does.
40  */
41 class WineRackGame {
42 public:
43  WineRackGame();
44  void run(byte *scriptVariables);
45 
46 private:
47  void initGrid(byte difficulty);
48  void placeBottle(byte pos, byte val);
49  int8 calculateNextMove(byte op);
50  int8 findEmptySpot();
51  void sub05(int8 player, int8 *moves);
52  int8 sub06(int8 *moves1, int8 *moves2);
53  uint32 didPlayerWin();
54  void sub10(int8 endPos, int8 pos, int unused, int player, int *val);
55  void sub11(int8 pos, int8 *candidates);
56  uint32 didAiWin();
57  void sub13(int8 cell, int8 player, int8 *moves1, int8 *moves2);
58  void sub15(int8 cell, int8 *candidates);
59  void sub16(int8 cell, int8 *candidates);
60  int8 countEmtpy(int8 *moves);
61  int8 randomMoveStart();
62  int8 randomMoveStart2();
63 
64  void testWinCondition(byte player, int baseX, int baseY);
65  void testGame(uint32 seed, Common::Array<int> moves, bool playerWin);
66  void runTests();
67 
68  int _totalBottles;
69  byte _wineRackGrid[100];
70  byte _wineRackGrid2[100];
71  Common::RandomSource _random;
72 };
73 
74 } // End of Groovie namespace
75 
76 #endif // GROOVIE_LOGIC_WINERACK_H
Definition: random.h:44
Definition: winerack.h:41
Definition: cursor.h:32