summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--digital/io-hub/src/robospierre/element.c14
-rw-r--r--digital/io-hub/src/robospierre/element.h4
2 files changed, 9 insertions, 9 deletions
diff --git a/digital/io-hub/src/robospierre/element.c b/digital/io-hub/src/robospierre/element.c
index 5b192e4f..37efa46f 100644
--- a/digital/io-hub/src/robospierre/element.c
+++ b/digital/io-hub/src/robospierre/element.c
@@ -280,15 +280,15 @@ element_score (position_t robot_pos, uint8_t element_id)
&& e.failure_until_s + failure_offset_s < chrono_remaining_time () / 1000)
return -1;
- if (e.type & ELEMENT_PAWN)
- score += ELEMENT_PAWN_SCORE;
- if (e.type & ELEMENT_QUEEN)
- score += ELEMENT_QUEEN_SCORE;
- if (e.type & ELEMENT_KING)
+ if (e.type == ELEMENT_KING)
score += ELEMENT_KING_SCORE;
- if (e.type & ELEMENT_ANY)
+ else if (e.type == ELEMENT_QUEEN)
+ score += ELEMENT_QUEEN_SCORE;
+ else if (e.type == ELEMENT_PAWN)
+ score += ELEMENT_PAWN;
+ else if (e.type == ELEMENT_ANY)
score += ELEMENT_ANY_SCORE;
- else if (e.type & ELEMENT_NONE)
+ if (e.type & ELEMENT_NONE)
score /= 2;
/* Add score modifier. */
diff --git a/digital/io-hub/src/robospierre/element.h b/digital/io-hub/src/robospierre/element.h
index 9464c1f9..5b6ad9a4 100644
--- a/digital/io-hub/src/robospierre/element.h
+++ b/digital/io-hub/src/robospierre/element.h
@@ -57,8 +57,8 @@
#define ELEMENT_PAWN_SCORE 10
#define ELEMENT_ANY_SCORE 15
-#define ELEMENT_QUEEN_SCORE 20
-#define ELEMENT_KING_SCORE 30
+#define ELEMENT_QUEEN_SCORE 20 * 30
+#define ELEMENT_KING_SCORE 30 * 30
/** Emplacement attributes bits. */
#define ELEMENT_BONUS 1