Commits

Larry Hastings  committed c2bea1a

More cleanup. And fixed tests, which weren't cleaning up new global state.

  • Participants
  • Parent commits a6e06be

Comments (0)

Files changed (1)

 	return card
 
 
-#def pickle_pile(pile):
-#	return [card_to_string[c] for c in pile]
-#
-#def unpickle_pile(pickled_pile):
-#	return [string_to_card[s] for s in pickled_pile]
-
 
 class PlayerBase:
+
+	name = None
+
 	def __init__(self):
 		self.total_score = 0
 
 		try:
 			while True:
 				if self.state == "game end":
-					# winner = unpickle_player(self.winner)
 					winner = self.winner
 					if winner is not None:
 						winner = game.players[winner]
 					winner = game.players.index(winner)
 
 				self.state = "game end"
-				# self.winner = pickle_player(winner)
 				self.winner = winner
 
 				series.games_played += 1
 
 		while True:
 			if self.state == "hand end":
-				# hand_winner = unpickle_player(self.winner)
 				hand_winner = self.winner
 				if hand_winner is not None:
 					hand_winner = game.players[hand_winner]
 			if winner:
 				winner = game.players.index(winner)
 
-			# self.winner = pickle_player(winner)
 			self.winner = winner
 			self.state = "hand end"
 			series.hands_played += 1
 		self.p1.cards = []
 		self.p2.cards = []
 
+	def tearDown(self):
+		global series
+		global game
+		global hand
+
+		series = game = hand = None
+
 	def draw_hand(self, player, *cards):
 		assert len(cards) in {6, 7}
 		cards = [convert_card(card) for card in cards]
 		try:
 			with open(savepath, "rb") as f:
 				series = pickle.load(f)
-				# series.unpickle()
 		except EOFError:
 			print("Couldn't load savegame.  Starting new game.")
 			pass