# HG changeset patch # User Larry Hastings # Date 1339482186 25200 # Node ID 3e6f58caf79e02a828e988793b4adf362bb65a14 # Parent 614392db19d837f07b61dae318ca3fe39fd51de7 Bugfix: If you're within one card of winning, and Norman can't stop you, Norman will play all his safeties in order to try and get a card that can stop you. However, his logic was off; if he'd extended, but you were at fewer than 700 miles, he'd get anxious if you were within one card of getting to 700. diff --git a/mille.py b/mille.py --- a/mille.py +++ b/mille.py @@ -1309,9 +1309,9 @@ safeties_needed_to_win.add(right_of_way) debug("P0.b", we_can_win, safeties_needed_to_win) + limit = 1000 if hand.extended else 700 if we_can_win: # do we have the mileage card we'd need to play? - limit = 1000 if hand.extended else 700 card_to_win = to_card.get(limit - mileage_so_far) we_can_win = card_to_win in mileage debug("P0.c", card_to_win, we_can_win) @@ -1384,15 +1384,13 @@ return other_mileage = other.hand.mileage() - if other_mileage >= 700: - other_mileage -= 300 possibles = {25, 50} if other.hand.autobahn(): possibles.add(75) possibles.add(100) if other.hand.two_hundreds() < 2: possibles.add(200) - if ((700 - other_mileage) in possibles) and safeties: + if ((limit - other_mileage) in possibles) and safeties: debug("P1.c") self.play(safeties[0]) return self.turn()