55 lines
2.2 KiB
C++
55 lines
2.2 KiB
C++
#pragma once
|
|
#include "Serial.h"
|
|
#include <cstdint>
|
|
|
|
#include "../../gen/Generated.h"
|
|
|
|
namespace Puzzle
|
|
{
|
|
constexpr const char* PuzzleFileDir = "game/data/puzzles/";
|
|
struct Config
|
|
{
|
|
static constexpr uint32_t CardSize = 2;
|
|
static constexpr uint32_t NodesPerCard = CardSize * CardSize;
|
|
static constexpr uint32_t MaxElementsPerTile = 4;
|
|
static constexpr uint32_t MaxPuzzleSizeCards = 16;
|
|
static constexpr uint32_t MaxCardsInPuzzle = MaxPuzzleSizeCards * MaxPuzzleSizeCards;
|
|
static constexpr uint32_t MaxPuzzleSizeTiles = 16 * CardSize;
|
|
static constexpr uint32_t MaxTilesInPuzzle = MaxPuzzleSizeTiles * MaxPuzzleSizeTiles;
|
|
static constexpr uint32_t MaxAvailableStacks = 16;
|
|
static constexpr uint32_t MaxGoalPositions = 16;
|
|
};
|
|
} // namespace Puzzle
|
|
|
|
namespace Generated
|
|
{
|
|
PuzPos operator+=(PuzPos lhs, const PuzPos& rhs);
|
|
PuzPos operator+(PuzPos lhs, const PuzPos& rhs);
|
|
|
|
void Setup();
|
|
StaticPuzzleData& GetStaticPuzzleData();
|
|
void LoadStaticPuzzleData();
|
|
void SaveStaticPuzzleData();
|
|
const StaticPuzzleCard& GetCard(const StaticPuzzleData& data, StaticPuzzleCardHandle H);
|
|
bool HasElement(const PuzzleNode& node, PuzzleElementType::Enum search);
|
|
bool IsEmpty(const PuzzleNode& node);
|
|
bool IsValid(StaticPuzzleCardHandle h);
|
|
uint8_t GetRemainingCount(const PuzzleCardStack& stack);
|
|
const PuzzleNode& GetNodeAt(const PuzzleData& puz, PuzPos pos);
|
|
PuzzleElementType::Enum GetElementAt(const PuzzleData& puz, ElemPos pos);
|
|
|
|
struct PuzzleSolver
|
|
{
|
|
bool IsPuzzleSolved(const Generated::PuzzleData& puzzle);
|
|
bool IsExitSatisfied(const Generated::PuzzleData& puzzle, ElemPos pos);
|
|
|
|
// This assumes flowFrom is already verified to be connected.
|
|
bool IsValidGoalConnection(const Generated::PuzzleData& puzzle,
|
|
PuzPos flowFrom,
|
|
PuzPos flowTo,
|
|
PuzzleElementType::Enum goalType);
|
|
bool IsValidSource(PuzzleElementType::Enum sourceType, PuzzleElementType::Enum goalType);
|
|
};
|
|
bool RenderDebugUI(PuzzleData& obj);
|
|
} // namespace Generated
|