[iagno] Fix AI regression.
- From: Arnaud B. <arnaudb src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [iagno] Fix AI regression.
- Date: Sat, 30 Mar 2019 10:14:42 +0000 (UTC)
commit 675ca91399a95fb4ef3a5747841b6426b80bc42c
Author: Arnaud Bonatti <arnaud bonatti gmail com>
Date: Fri Mar 29 15:04:19 2019 +0100
Fix AI regression.
src/computer-player.vala | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
---
diff --git a/src/computer-player.vala b/src/computer-player.vala
index 760be13..92e4991 100644
--- a/src/computer-player.vala
+++ b/src/computer-player.vala
@@ -236,7 +236,8 @@ private class ComputerPlayer : Object
{
/* End of the game, return a near-infinite evaluation */
if (g.is_complete)
- return g.n_current_tiles > g.n_opponent_tiles ? POSITIVE_INFINITY - g.n_opponent_tiles :
NEGATIVE_INFINITY + g.n_current_tiles;
+ return g.n_current_tiles > g.n_opponent_tiles ? POSITIVE_INFINITY - (int) g.n_opponent_tiles
+ : NEGATIVE_INFINITY + (int) g.n_current_tiles;
/* Checking move_pending here is optional. It helps avoid a long unnecessary search
* if the move has been cancelled, but is expensive because it requires taking a mutex. */
@@ -318,7 +319,7 @@ private class ComputerPlayer : Object
private static int calculate_heuristic (Game g, ref uint8 difficulty_level)
{
- int tile_difference = g.n_current_tiles - g.n_opponent_tiles;
+ int tile_difference = (int) g.n_current_tiles - (int) g.n_opponent_tiles;
/* Try to lose */
if (difficulty_level == 1)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]