Commits

larry  committed aee0eb1

Added some todo items.

  • Participants
  • Parent commits 0545ef5

Comments (0)

Files changed (1)

 #!/usr/bin/env python3
 #
+# todo:
+#    * '>' (shift '.') means "discard until end of hand"
+#
 # Copyright 2012 Larry Hastings
 #
 # This software is provided 'as-is', without any express or implied
-# warranty. In no event will the authors be held liable for any damages
+# warranty. In no event will the authors be held lihttp://www.prospectseattle.com/able for any damages
 # arising from the use of this software.
 #
 # Permission is granted to anyone to use this software for any purpose,
 #	  should play ROW and move if delta in miles gets big
 #	  or opponent is about to win
 #	  likelyhood should go way up if they might get shut out
+#   * decide to extend based on delta in score--extend if opponent
+#     mileage is > 0 but norman has a big lead, make it less likely
+#     if
+#   * consider making norman slightly less predictable--add a mild!
+#	  random element making him play safeties when unnecessary / not
+#	  play safeties when opponent is within striking distance
 #
 # smart computer player
 #	* calculates odds on whether a card is still in the draw pile / in opponent's hand
 
 class HandPlayerData(PlayerData):
 
+	discard_all = False
+
 	def __init__(self, player):
 		super().__init__(player)
 
 	Rosey is the dumbest player who could play a legal game.
 
 	On every turn she shuffles her cards.
-	Shen then tries each in order.
+	She then tries each in order.
 	If she finds a card that is legally playable, she plays it--
 		unless it's redundant (plays hazards only when stopped, plays
 		speed limit only if you don't already have one)
 
 class AverageComputerPlayer(Player):
 	"""
-	"Norman" is a reasonably sophisticated player.
+	"Norman" is a reasonably sophisticated player.  Norman plays
+	by a very specific set of rules:
 
 	* doesn't count cards
 	* understands coup fouree
 class SmartComputerPlayer(AverageComputerPlayer):
 	"""
 	Moriarty is as smart as I can make him.
-	His main achievement over AverageComputerPlayer is that
+	His main achievement over Norman is that
 	he counts cards and calculates odds.
 
 	(Moriarty is named for the machine intelligence that escaped
       s - show current scores
       S - show current scores as if each player had won the current hand
       t - redraw the table (discard, piles, etc)
+      ! - discard all remaining cards (deck is empty, you have nothing useful)
       ? - display this help
 
  Ctrl-C - exit, automatically saving state
 					prompt += " or [d]raw? > "
 					valid += "d"
 				else:
-					prompt += " or [.]discard? > "
-					valid += "."
-				c = self.getch(prompt, valid)
+					prompt += " or [.!]discard? > "
+					valid += ".!"
+				if not self.hand.discard_all:
+					c = self.getch(prompt, valid)
 
 				if c == 'd':
 					self.hand.last_drawn = card = self.hand.draw()
 					print()
 					redraw = True
 					continue
-				if c == '.':
+				elif c == '.':
 					c2 = self.getch("    Discard which card? [" + valid_cards + "] > ")
 					if c2 not in valid_cards:
 						continue
 					i = int(c2) - 1
+				elif self.hand.discard_all:
+					c = '.'
+					i = 0
+				elif c == '!':
+					if hand.draw_pile:
+						print("Deck isn't empty!  There's still hope!")
+						continue
+					self.hand.discard_all = True
+					c = '.'
+					i = 0
 				else:
 					assert '1' <= c <= str(len(self.hand.hand))
 					i = int(c) - 1