ScummVM API documentation
pente.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_PENTE_H
29#define GROOVIE_LOGIC_PENTE_H
30
31#include "common/random.h"
32#include "common/system.h"
33
34namespace Groovie {
35
36/*
37 * Pente puzzle at the end of the game.
38 */
39
40struct pentePlayerTable;
41struct penteTable;
42
43class PenteGame {
44public:
45 PenteGame(bool easierAi);
46 void run(byte *vars);
47
48private:
49 void animateCapturesCheckWinner(byte *vars);
50 void opQueryPiece(byte *vars);
51
52 void addLine(int x, int y, int linesCounter);
53 void buildLookupTable();
54 void penteDeInit();
55 void penteInit(uint width, uint height, uint length);
56 int &getPlayerTable(bool staufTurn, pentePlayerTable *&pt);
57 void scoreLine(uint16 lineIndex, bool isStaufTurn, bool revert);
58 void calcTouchingPieces(byte moveX, byte moveY, bool revert);
59 void updateScore(byte x, byte y, bool whose_turn);
60 void revertScore(byte x, byte y);
61 byte scoreCaptureSingle(byte x, byte y, int slopeX, int slopeY);
62 uint scoreCapture(byte x, byte y);
63 void animateCapture(short move, byte *bitMaskG, short *outCapture1, short *outCapture2);
64 void revertCapture(byte x, byte y, byte y2);
65 int scoreMoveAndRevert(byte x, byte y, char depth, int parentScore, bool &gameOver);
66 int scoreMoveAndRevert(byte x, byte y, char depth, int parentScore);
67 int aiRecurseTail(int parentScore);
68 int aiRecurse(char depth, int parentScore);
69 uint16 aiGetBestMove(byte depth);
70 void test();
71 bool testGame(uint32 seed, Common::Array<int> moves, bool playerWin);
72 void testRandomGame(uint32 seed);
73
75
76 byte _animateCapturesBitMask;
77 short _previousMove;
78 short _nextCapturedSpot;
79 penteTable *_table;
80 bool _easierAi;
81};
82
83} // End of Groovie namespace
84
85#endif // GROOVIE_LOGIC_PENTE_H
Definition: random.h:44
Definition: pente.h:43
Out move(In first, In last, Out dst)
Definition: algorithm.h:109
Definition: cursor.h:32