summaryrefslogtreecommitdiff
path: root/sw-common-model
diff options
context:
space:
mode:
authorjoffrey-bion <joffrey.bion@gmail.com>2020-11-29 17:35:19 +0100
committerjoffrey-bion <joffrey.bion@gmail.com>2020-11-29 17:37:21 +0100
commit6180f7e44778bef26ed4386f260052651da7d4fa (patch)
tree97cd6993aca99096a35f22f2a615565b885be7d4 /sw-common-model
parentAdd best price indication (diff)
downloadseven-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-common-model')
-rw-r--r--sw-common-model/src/commonMain/kotlin/org/luxons/sevenwonders/model/resources/Resources.kt8
1 files changed, 6 insertions, 2 deletions
diff --git a/sw-common-model/src/commonMain/kotlin/org/luxons/sevenwonders/model/resources/Resources.kt b/sw-common-model/src/commonMain/kotlin/org/luxons/sevenwonders/model/resources/Resources.kt
index fc99a41d..3bf19964 100644
--- a/sw-common-model/src/commonMain/kotlin/org/luxons/sevenwonders/model/resources/Resources.kt
+++ b/sw-common-model/src/commonMain/kotlin/org/luxons/sevenwonders/model/resources/Resources.kt
@@ -32,7 +32,9 @@ enum class ResourceType(val symbol: Char) {
data class CountedResource(
val count: Int,
val type: ResourceType,
-)
+) {
+ override fun toString(): String = "$count $type"
+}
@Serializable
enum class Provider(val boardPosition: RelativeBoardPosition) {
@@ -53,7 +55,9 @@ data class PricedResourceTransaction(
override val provider: Provider,
override val resources: List<CountedResource>,
val totalPrice: Int,
-) : ResourceTransaction()
+) : ResourceTransaction() {
+ override fun toString(): String = "{$totalPrice coin(s) to $provider for $resources}"
+}
typealias PricedResourceTransactions = Set<PricedResourceTransaction>
bgstack15