Worked on c++
This commit is contained in:
54
shenzhen_solitaire/c++/auxiliary/swig.i
Normal file
54
shenzhen_solitaire/c++/auxiliary/swig.i
Normal file
@@ -0,0 +1,54 @@
|
||||
%module shenzhen
|
||||
%{
|
||||
#include "board.hpp"
|
||||
#include "card.hpp"
|
||||
#include "goal.hpp"
|
||||
%}
|
||||
|
||||
namespace solitaire {
|
||||
enum class CardType : int { Zhong, Bai, Fa, Hua, Red, Green, Black };
|
||||
|
||||
auto isNormalCardType(CardType type) -> bool;
|
||||
|
||||
struct Card {
|
||||
CardType type;
|
||||
int value;
|
||||
auto toString() const noexcept -> std::string;
|
||||
};
|
||||
|
||||
class Goal {
|
||||
std::array<std::optional<Card>, 3> goal{};
|
||||
auto getEmptyId() -> std::optional<int>;
|
||||
|
||||
public:
|
||||
auto getId(CardType suit) const noexcept -> std::optional<int>;
|
||||
auto get(CardType suit) const noexcept -> std::optional<int>;
|
||||
|
||||
void set(CardType suit, int value) noexcept;
|
||||
void inc(CardType suit) noexcept;
|
||||
};
|
||||
|
||||
struct BunkerField {
|
||||
std::optional<Card> card;
|
||||
bool empty{};
|
||||
bool closed{};
|
||||
};
|
||||
|
||||
inline constexpr int MAX_ROW_SIZE = 13;
|
||||
inline constexpr int MAX_COLUMN_SIZE = 8;
|
||||
|
||||
class Stack {
|
||||
std::array<std::optional<Card>, MAX_COLUMN_SIZE> values{};
|
||||
};
|
||||
|
||||
struct Board {
|
||||
std::array<Stack, MAX_ROW_SIZE> field{};
|
||||
std::array<BunkerField, 3> bunker{};
|
||||
Goal goal{};
|
||||
bool flower_gone{};
|
||||
|
||||
auto solved() const noexcept -> bool;
|
||||
auto hash() const noexcept -> std::size_t;
|
||||
auto correct() const noexcept -> bool;
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user