File indexing completed on 2024-06-23 04:02:59
0001 #ifndef SolverInterface_H 0002 #define SolverInterface_H 0003 0004 // own 0005 #include "../hint.h" 0006 // freecell-solver 0007 #include "freecell-solver/fcs_user.h" 0008 // Qt 0009 #include <QList> 0010 0011 /* A card is represented as ( down << 6 ) + (suit << 4) + rank. */ 0012 0013 typedef quint8 card_t; 0014 0015 /* Represent a move. */ 0016 0017 enum PileType { O_Type = 1, W_Type }; 0018 0019 class MOVE 0020 { 0021 public: 0022 int card_index; /* the card we're moving (0 is the top)*/ 0023 quint8 from; /* from pile number */ 0024 quint8 to; /* to pile number */ 0025 PileType totype; 0026 signed char pri; /* move priority (low priority == low value) */ 0027 int turn_index; /* turn the card index */ 0028 bool is_fcs; 0029 fcs_move_t fcs; /* A Freecell Solver move. */ 0030 0031 bool operator<(const MOVE &m) const 0032 { 0033 return pri < m.pri; 0034 } 0035 0036 MOVE() 0037 : card_index(0) 0038 , from(0) 0039 , to(0) 0040 , totype(O_Type) 0041 , pri(0) 0042 , turn_index(0) 0043 , is_fcs(false) 0044 , fcs() 0045 { 0046 } 0047 }; 0048 0049 class SolverInterface 0050 { 0051 public: 0052 enum ExitStatus { MemoryLimitReached = -3, SearchAborted = -2, UnableToDetermineSolvability = -1, NoSolutionExists = 0, SolutionExists = 1 }; 0053 0054 virtual ~SolverInterface(){}; 0055 virtual ExitStatus patsolve(int max_positions = -1) = 0; 0056 virtual void translate_layout() = 0; 0057 virtual MoveHint translateMove(const MOVE &m) = 0; 0058 0059 virtual void stopExecution() = 0; 0060 virtual QList<MOVE> firstMoves() const = 0; 0061 virtual QList<MOVE> winMoves() const = 0; 0062 }; 0063 0064 extern long all_moves; 0065 0066 #endif