6 /* número máximo de movimentos de uma partida */
12 class MoveHistoryEntry
17 _from_x
= _from_y
= _to_x
= _to_y
= -1;
20 MoveHistoryEntry(Board
*board
,
23 _board
= board
->copy();
30 const MoveHistoryEntry
& operator=(const MoveHistoryEntry
& entry
) {
31 if(_board
) delete _board
;
32 _board
= entry
._board
;
33 _from_x
= entry
._from_x
;
34 _from_y
= entry
._from_y
;
40 Board
*board() { return _board
; }
41 int from_x() { return _from_x
; }
42 int from_y() { return _from_y
; }
43 int to_x() { return _to_x
; }
44 int to_y() { return _to_y
; }
48 int _from_x
, _from_y
, _to_x
, _to_y
;
57 void move(int fromX
, int fromY
, int toX
, int toY
);
58 bool think(int& fx
, int& fy
, int& tx
, int& ty
);
59 void fill_moves(int x
, int y
, bool *to
);
60 bool can_move(int x
, int y
);
61 void fill_pieces(bool *isEmpty
, char *piece
);
62 void set_player(bool player
);
63 bool can_undo() { return _current_move
> 1; }
64 bool can_redo() { return _current_move
<= _move_count
; }
65 void undo(int& fromX
, int &fromY
,
69 e
= _move_history
[--_current_move
- 1];
78 void redo(int& fromX
, int &fromY
,
82 e
= _move_history
[_current_move
++];
91 void load(FILE *in
, int& fromX
, int &fromY
,
93 void set(MoveHistoryEntry entry
) {
95 _board
= entry
.board()->copy();
97 void set_computer_color(int computerColor
) { _computer_color
= computerColor
; }
102 int _move_count
, _current_move
, _computer_color
;
103 MoveHistoryEntry _move_history
[MAX_MOVES
];