[iagno] Use a PossibleMove in copy_and_move.
- From: Arnaud B. <arnaudb src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [iagno] Use a PossibleMove in copy_and_move.
- Date: Wed, 22 May 2019 13:01:43 +0000 (UTC)
commit 6638e9e8ca222a2b70e25519ce38f0515463d3a7
Author: Arnaud Bonatti <arnaud bonatti gmail com>
Date: Fri May 10 12:09:41 2019 +0200
Use a PossibleMove in copy_and_move.
src/computer-reversi.vala | 4 ++--
src/game.vala | 8 ++++----
2 files changed, 6 insertions(+), 6 deletions(-)
---
diff --git a/src/computer-reversi.vala b/src/computer-reversi.vala
index 8341c0b..d83c23e 100644
--- a/src/computer-reversi.vala
+++ b/src/computer-reversi.vala
@@ -300,7 +300,7 @@ private abstract class ComputerReversi : ComputerPlayer
if (move == null)
assert_not_reached ();
- GameState _g = new GameState.copy_and_move (g, ((!) move).x, ((!) move).y);
+ GameState _g = new GameState.copy_and_move (g, (!) move);
int16 a_new = -1 * search (_g, initial_depth, NEGATIVE_INFINITY, -a);
if (a_new > a)
@@ -341,7 +341,7 @@ private abstract class ComputerReversi : ComputerPlayer
if (move == null)
assert_not_reached ();
- GameState _g = new GameState.copy_and_move (g, ((!) move).x, ((!) move).y);
+ GameState _g = new GameState.copy_and_move (g, (!) move);
int16 a_new = -1 * search (_g, depth - 1, -b, -a);
if (a_new > a)
diff --git a/src/game.vala b/src/game.vala
index 6ec5832..fbc393b 100644
--- a/src/game.vala
+++ b/src/game.vala
@@ -61,7 +61,7 @@ private class GameState : Object
is_complete = false;
}
- internal GameState.copy_and_move (GameState game, uint8 move_x, uint8 move_y)
+ internal GameState.copy_and_move (GameState game, PossibleMove move)
{
Player move_color = game.current_color;
Object (size: game.size, current_color: Player.flip_color (move_color));
@@ -72,10 +72,10 @@ private class GameState : Object
_n_dark_tiles = game._n_dark_tiles;
uint8 n_tiles;
- place_tile (move_x, move_y, move_color, /* apply move */ true, out n_tiles);
+ place_tile (move.x, move.y, move_color, /* apply move */ true, out n_tiles);
if (n_tiles == 0)
{
- critical ("Computer marked move (%d, %d) as valid, but is invalid when checking.\n%s", move_x,
move_y, to_string ());
+ critical ("Computer marked move (%d, %d) as valid, but is invalid when checking.\n%s", move.x,
move.y, to_string ());
assert_not_reached ();
}
@@ -553,7 +553,7 @@ private class Game : Object
if (n_tiles == 0)
return false;
- current_state = new GameState.copy_and_move (current_state, x, y);
+ current_state = new GameState.copy_and_move (current_state, PossibleMove (x, y, n_tiles));
undo_stack.append (current_state);
end_of_turn (/* undoing */ false, /* no_draw */ false);
return true;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]