Diffstat (limited to 'noncore/games/backgammon/moveengine.h') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/games/backgammon/moveengine.h | 76 |
1 files changed, 76 insertions, 0 deletions
diff --git a/noncore/games/backgammon/moveengine.h b/noncore/games/backgammon/moveengine.h new file mode 100644 index 0000000..a2d4a52 --- a/dev/null +++ b/noncore/games/backgammon/moveengine.h | |||
@@ -0,0 +1,76 @@ | |||
1 | #ifndef MOVEENGINE_H | ||
2 | #define MOVEENGINE_H | ||
3 | |||
4 | #include <qobject.h> | ||
5 | #include "definition.h" | ||
6 | |||
7 | class MoveEngine : public QObject | ||
8 | { | ||
9 | Q_OBJECT | ||
10 | private: | ||
11 | //normal pieses | ||
12 | int x_coord[26]; //26 posssible x-positions or piece is not on the board | ||
13 | int yup_coord[15]; // the 15 posssible y-positions on the upper half of the board | ||
14 | int ylow_coord[15]; // the 15 posssible y-positions on the lower half of the board | ||
15 | int z_coord[15]; //the 15 possible z-positionson the board | ||
16 | //finshed pieces | ||
17 | int x_fin1[3]; | ||
18 | int x_fin2[3]; | ||
19 | int y_fin[5]; | ||
20 | int z_fin; | ||
21 | //the board population | ||
22 | // |12|11|10|09|08|07|06|05|04|03|02|01|00| | ||
23 | // ======================================= | ||
24 | // |13|14|15|16|17|18|19|20|21|22|23|24|25| | ||
25 | // endzones 26 player1, 27 player 2 | ||
26 | Population population[28]; | ||
27 | AISettings ai; | ||
28 | //move information | ||
29 | int player; | ||
30 | int otherplayer; | ||
31 | int dice[4]; | ||
32 | //index of the markers | ||
33 | int marker_current; | ||
34 | int marker_next[4]; | ||
35 | //player pieces are all in the end zone | ||
36 | bool allclear[3]; | ||
37 | //player must bring pieces back into game | ||
38 | bool pieces_out[3]; | ||
39 | bool move_with_pieces_out; | ||
40 | //player can rescue pieces with dice bigger than move, even if there are poeces "behind" it | ||
41 | bool nice_dice; | ||
42 | int last_piece[3]; | ||
43 | //possible moves | ||
44 | Possiblilites moves[26]; | ||
45 | public: | ||
46 | public: | ||
47 | MoveEngine(); | ||
48 | ~MoveEngine(); | ||
49 | signals: | ||
50 | void done_dice1(); | ||
51 | void done_dice2(); | ||
52 | void done_dice3(); | ||
53 | void done_dice4(); | ||
54 | void nomove(); | ||
55 | void player_finished(int); | ||
56 | private slots: | ||
57 | void automove(); | ||
58 | public: | ||
59 | void position(Pieces& pieces,bool non_qte=false); | ||
60 | void diceroll(const int& player,const int& face1,const int& face2,const int& face3,const int& face4,bool computer); | ||
61 | void boardpressed(const int& x,const int& y,Marker& marker,bool non_qte=false); | ||
62 | void reset(); | ||
63 | void loadGame(const LoadSave& load); | ||
64 | LoadSave saveGame(); | ||
65 | AISettings getAISettings(); | ||
66 | void setAISettings(const AISettings& new_ai); | ||
67 | void setRules(Rules rules); | ||
68 | private: | ||
69 | int getPossibleMoves(); | ||
70 | void move(const int& from, int to, const int& dice); | ||
71 | void checkstate(); | ||
72 | void nomarker(Marker& marker); | ||
73 | int fieldColor(const int& index) const; | ||
74 | }; | ||
75 | |||
76 | #endif //MOVEENGINE_H | ||