This commit is contained in:
Lukas Wölfer
2019-04-19 20:40:18 +02:00
parent 0483a839df
commit f65cdc42e5
3 changed files with 44 additions and 23 deletions

View File

@@ -78,7 +78,6 @@ class Board:
result <<= 5
result |= card.identifier()
result <<= 1
if self.flower_gone:
result |= 1
@@ -87,7 +86,8 @@ class Board:
result <<= 4
result |= goal_count
# Max stack size is 13 (4 random cards from the start, plus a stack from 9 to 1]
# Max stack size is 13
# (4 random cards from the start, plus a stack from 9 to 1)
# So 4 bits are sufficient
for stack in self.field:
assert len(stack) == len(stack) & 0b1111
@@ -118,8 +118,8 @@ class Board:
special_cards[SpecialCard.Hua] += 1
for card in itertools.chain(
self.bunker, itertools.chain.from_iterable(
stack for stack in self.field if stack), ):
self.bunker, itertools.chain.from_iterable(
stack for stack in self.field if stack), ):
if isinstance(card, tuple):
special_cards[card[0]] += 4 # pylint: disable=E1136
elif isinstance(card, SpecialCard):