deck analysis: check for dark cards at bottom of deck
This commit is contained in:
parent
75b0f95e0b
commit
9f0f85b604
1 changed files with 7 additions and 0 deletions
|
@ -12,6 +12,7 @@ class InfeasibilityType(Enum):
|
||||||
OutOfPace = 0 # idx denotes index of last card drawn before being forced to reduce pace, value denotes how bad pace is
|
OutOfPace = 0 # idx denotes index of last card drawn before being forced to reduce pace, value denotes how bad pace is
|
||||||
OutOfHandSize = 1 # idx denotes index of last card drawn before being forced to discard a crit
|
OutOfHandSize = 1 # idx denotes index of last card drawn before being forced to discard a crit
|
||||||
NotTrivial = 2
|
NotTrivial = 2
|
||||||
|
CritAtBottom = 3
|
||||||
|
|
||||||
|
|
||||||
class InfeasibilityReason():
|
class InfeasibilityReason():
|
||||||
|
@ -26,6 +27,9 @@ class InfeasibilityReason():
|
||||||
return "Deck runs out of pace ({}) after drawing card {}".format(self.value, self.index)
|
return "Deck runs out of pace ({}) after drawing card {}".format(self.value, self.index)
|
||||||
case InfeasibilityType.OutOfHandSize:
|
case InfeasibilityType.OutOfHandSize:
|
||||||
return "Deck runs out of hand size after drawing card {}".format(self.index)
|
return "Deck runs out of hand size after drawing card {}".format(self.index)
|
||||||
|
case InfeasibilityType.CritAtBottom:
|
||||||
|
return "Deck has crit non-5 at bottom (index {})".format(self.index)
|
||||||
|
|
||||||
|
|
||||||
def analyze_suit(occurrences):
|
def analyze_suit(occurrences):
|
||||||
# denotes the indexes of copies we can use wlog
|
# denotes the indexes of copies we can use wlog
|
||||||
|
@ -97,6 +101,9 @@ def analyze_card_usage(instance: HanabiInstance):
|
||||||
|
|
||||||
def analyze(instance: HanabiInstance, find_non_trivial=False) -> InfeasibilityReason | None:
|
def analyze(instance: HanabiInstance, find_non_trivial=False) -> InfeasibilityReason | None:
|
||||||
|
|
||||||
|
if instance.deck[-1].rank != 5 and instance.deck[-1].suitIndex + instance.num_dark_suits >= instance.num_suits:
|
||||||
|
return InfeasibilityReason(InfeasibilityType.CritAtBottom, instance.deck_size - 1)
|
||||||
|
|
||||||
# we will sweep through the deck and pretend that we instantly play all cards
|
# we will sweep through the deck and pretend that we instantly play all cards
|
||||||
# as soon as we have them (and recurse this)
|
# as soon as we have them (and recurse this)
|
||||||
# this allows us to detect standard pace issue arguments
|
# this allows us to detect standard pace issue arguments
|
||||||
|
|
Loading…
Reference in a new issue