106 lines
4.3 KiB
C++
106 lines
4.3 KiB
C++
/* ScummVM - Graphic Adventure Engine
|
|
*
|
|
* ScummVM is the legal property of its developers, whose names
|
|
* are too numerous to list here. Please refer to the COPYRIGHT
|
|
* file distributed with this source distribution.
|
|
*
|
|
* This program is free software: you can redistribute it and/or modify
|
|
* it under the terms of the GNU General Public License as published by
|
|
* the Free Software Foundation, either version 3 of the License, or
|
|
* (at your option) any later version.
|
|
*
|
|
* This program is distributed in the hope that it will be useful,
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
* GNU General Public License for more details.
|
|
*
|
|
* You should have received a copy of the GNU General Public License
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
*
|
|
*
|
|
* This file is dual-licensed.
|
|
* In addition to the GPLv3 license mentioned above, MojoTouch has exclusively licensed
|
|
* this code on November 10th, 2021, to be use in closed-source products.
|
|
* Therefore, any contributions (commits) to it will also be dual-licensed.
|
|
*
|
|
*/
|
|
|
|
#ifndef GROOVIE_LOGIC_GALLERY_H
|
|
#define GROOVIE_LOGIC_GALLERY_H
|
|
|
|
#include "common/random.h"
|
|
#include "common/system.h"
|
|
|
|
namespace Groovie {
|
|
|
|
/*
|
|
* Puzzle in the Gallery (bs.grv).
|
|
* The aim is to select the last piece of the image.
|
|
* There are 18 pieces in total.
|
|
* When selecting a piece, all surrounding pieces are also selected
|
|
*
|
|
* +--------------------+--------------------------------+--------+
|
|
* | 1/1A | 2/1B | |
|
|
* | +--------------+--+--------------------------+-----+ |
|
|
* | | | | |
|
|
* +--+ 4/1D | 5/1E | 3/1C |
|
|
* | | | |
|
|
* +-----+--------+--+--------+-----------------+--+--------+ |
|
|
* | | | | | | |
|
|
* | | | | | | |
|
|
* | | | 8/21 | | | |
|
|
* | | | | +-----------+ | |
|
|
* | | | | | | | |
|
|
* | | +-----------+ | 10/23 | 9/22 | |
|
|
* | | | | | |
|
|
* | | 7/20 +-----+-----+ +-----+
|
|
* | | | | | | |
|
|
* | +--------------------------+ | | | |
|
|
* | 6/1F | | | |
|
|
* +-----------+-----------+-----+--+ | 11 | | 12 |
|
|
* | 13/26 | | | | | / | | / |
|
|
* | +-----+-----+ | | | | 24 +-----------+ 25 |
|
|
* | | | | | | | | | |
|
|
* +-----+ 17/2A | | |16| | | | |
|
|
* | | | | |/ | | | | |
|
|
* | +-----+-----+ | |29| | | +-----+
|
|
* | | | | | | | | |
|
|
* | | | | | +-----+ 18/2B | |
|
|
* | 19/2C | 14/27 | | | | | |
|
|
* | | | | +-----------+ | |
|
|
* | | | | | | | |
|
|
* | | | +--+ 15/28 | | |
|
|
* | | | | | |
|
|
* | +--------+--+--------------------+-----------+ |
|
|
* | | 20/2D | 21/2E |
|
|
* +-----------+--------+-----------------------------------------+
|
|
*/
|
|
|
|
const int kPieceCount = 21;
|
|
|
|
class GalleryGame {
|
|
public:
|
|
GalleryGame(bool easierAi) {
|
|
#if 0
|
|
_easierAi = false;
|
|
test();
|
|
#endif
|
|
_easierAi = easierAi;
|
|
}
|
|
void run(byte *scriptVariables);
|
|
|
|
private:
|
|
byte galleryAI(byte *pieceStatus, int depth);
|
|
|
|
static const byte kGalleryLinks[21][10];
|
|
bool _easierAi;
|
|
|
|
void test();
|
|
void ensureSamanthaWins(int seed);
|
|
void testsWriteMove(int move, byte pieceStatus[kPieceCount]);
|
|
};
|
|
|
|
} // End of Groovie namespace
|
|
|
|
#endif // GROOVIE_LOGIC_GALLERY_H
|