def isNowPlayable(self,
color: Optional[Color],
value: Optional[Value]) -> bool:
'''Returns True the color and/or value is playable'''
assert color is not None or value is not None
if color is not None and value is not None:
return self.isPlayable(color, value)
if color is not None:
playableValue = len(self.game.playedCards[color]) + 1
if (playableValue <= 5
and not self.locatedCount[color][playableValue]):
return True
return False
if value is not None:
for c in self.colors:
if (len(self.game.playedCards[c]) + 1 == value
and not self.locatedCount[c][value]):
return True
return False
assert False
评论列表
文章目录