ScummVM API documentation
gallery.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_GALLERY_H
29 #define GROOVIE_LOGIC_GALLERY_H
30 
31 #include "common/random.h"
32 #include "common/system.h"
33 
34 namespace Groovie {
35 
36 /*
37  * Puzzle in the Gallery (bs.grv).
38  * The aim is to select the last piece of the image.
39  * There are 18 pieces in total.
40  * When selecting a piece, all surrounding pieces are also selected
41  *
42  * +--------------------+--------------------------------+--------+
43  * | 1/1A | 2/1B | |
44  * | +--------------+--+--------------------------+-----+ |
45  * | | | | |
46  * +--+ 4/1D | 5/1E | 3/1C |
47  * | | | |
48  * +-----+--------+--+--------+-----------------+--+--------+ |
49  * | | | | | | |
50  * | | | | | | |
51  * | | | 8/21 | | | |
52  * | | | | +-----------+ | |
53  * | | | | | | | |
54  * | | +-----------+ | 10/23 | 9/22 | |
55  * | | | | | |
56  * | | 7/20 +-----+-----+ +-----+
57  * | | | | | | |
58  * | +--------------------------+ | | | |
59  * | 6/1F | | | |
60  * +-----------+-----------+-----+--+ | 11 | | 12 |
61  * | 13/26 | | | | | / | | / |
62  * | +-----+-----+ | | | | 24 +-----------+ 25 |
63  * | | | | | | | | | |
64  * +-----+ 17/2A | | |16| | | | |
65  * | | | | |/ | | | | |
66  * | +-----+-----+ | |29| | | +-----+
67  * | | | | | | | | |
68  * | | | | | +-----+ 18/2B | |
69  * | 19/2C | 14/27 | | | | | |
70  * | | | | +-----------+ | |
71  * | | | | | | | |
72  * | | | +--+ 15/28 | | |
73  * | | | | | |
74  * | +--------+--+--------------------+-----------+ |
75  * | | 20/2D | 21/2E |
76  * +-----------+--------+-----------------------------------------+
77  */
78 
79 const int kPieceCount = 21;
80 
81 class GalleryGame {
82 public:
83  GalleryGame(bool easierAi) {
84 #if 0
85  _easierAi = false;
86  test();
87 #endif
88  _easierAi = easierAi;
89  }
90  void run(byte *scriptVariables);
91 
92 private:
93  byte galleryAI(byte *pieceStatus, int depth);
94 
95  static const byte kGalleryLinks[21][10];
96  bool _easierAi;
97 
98  void test();
99  void ensureSamanthaWins(int seed);
100  void testsWriteMove(int move, byte pieceStatus[kPieceCount]);
101 };
102 
103 } // End of Groovie namespace
104 
105 #endif // GROOVIE_LOGIC_GALLERY_H
Out move(In first, In last, Out dst)
Definition: algorithm.h:109
Definition: cursor.h:32