[iagno] computer-player: split off complete_move function
- From: Michael Catanzaro <mcatanzaro src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [iagno] computer-player: split off complete_move function
- Date: Fri, 19 Sep 2014 14:20:23 +0000 (UTC)
commit 4c605a865a7c4d1b7fccf1f90b671aeb31adbcab
Author: Michael Catanzaro <mcatanzaro gnome org>
Date: Fri Sep 19 09:05:22 2014 -0500
computer-player: split off complete_move function
src/computer-player.vala | 14 ++++++++------
1 files changed, 8 insertions(+), 6 deletions(-)
---
diff --git a/src/computer-player.vala b/src/computer-player.vala
index c864982..3f28888 100644
--- a/src/computer-player.vala
+++ b/src/computer-player.vala
@@ -64,15 +64,19 @@ public class ComputerPlayer : Object
this.level = level;
}
+ private void complete_move (int x, int y)
+ {
+ if (game.place_tile (x, y) == 0)
+ critical ("Computer chose an invalid move: %d,%d", x, y);
+ }
+
public void move ()
{
int x = 0;
int y = 0;
run_search (ref x, ref y);
-
- if (game.place_tile (x, y) == 0)
- critical ("Computer chose an invalid move: %d,%d", x, y);
+ complete_move (x, y);
}
public async void move_async (double delay_seconds = 0.0)
@@ -98,9 +102,7 @@ public class ComputerPlayer : Object
}
pending_move_id = 0;
-
- if (game.place_tile (x, y) == 0)
- critical ("Computer chose an invalid move: %d,%d", x, y);
+ complete_move (x, y);
}
public void cancel_move ()
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]