diff options
author | joffrey-bion <joffrey.bion@gmail.com> | 2020-11-29 17:35:19 +0100 |
---|---|---|
committer | joffrey-bion <joffrey.bion@gmail.com> | 2020-11-29 17:37:21 +0100 |
commit | 6180f7e44778bef26ed4386f260052651da7d4fa (patch) | |
tree | 97cd6993aca99096a35f22f2a615565b885be7d4 /sw-engine/src/main/kotlin | |
parent | Add best price indication (diff) | |
download | seven-wonders-6180f7e44778bef26ed4386f260052651da7d4fa.tar.gz seven-wonders-6180f7e44778bef26ed4386f260052651da7d4fa.tar.bz2 seven-wonders-6180f7e44778bef26ed4386f260052651da7d4fa.zip |
Remove unrealistic transaction options
Options where both the left and the right price are more expensive should never be used.
Resolves:
https://github.com/joffrey-bion/seven-wonders/issues/53
Diffstat (limited to 'sw-engine/src/main/kotlin')
-rw-r--r-- | sw-engine/src/main/kotlin/org/luxons/sevenwonders/engine/resources/TransactionOptionsCalculator.kt | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/sw-engine/src/main/kotlin/org/luxons/sevenwonders/engine/resources/TransactionOptionsCalculator.kt b/sw-engine/src/main/kotlin/org/luxons/sevenwonders/engine/resources/TransactionOptionsCalculator.kt index fbbcaa6e..29fcc21b 100644 --- a/sw-engine/src/main/kotlin/org/luxons/sevenwonders/engine/resources/TransactionOptionsCalculator.kt +++ b/sw-engine/src/main/kotlin/org/luxons/sevenwonders/engine/resources/TransactionOptionsCalculator.kt @@ -122,6 +122,8 @@ private class TransactionOptionsCalculator(resourcesToPay: Resources, player: Pl private operator fun PricedResourceTransactions.compareTo(prices: Map<Provider, Int>): Int = when { left == prices.left -> right.compareTo(prices.right) right == prices.right -> left.compareTo(prices.left) + left < prices.left && right < prices.right -> -1 + left > prices.left && right > prices.right -> 1 else -> 0 } |