Пример #1
0
def handle_contexts(game):
	print "handling context!!!!!\n==========="
	remaining = game.getRemaining()
	print len(remaining)
	for player in remaining:
		for k,v in player.contexts.iteritems():
			if int(k[0]) == 1:
				continue
			else:
				hand = player.get_hand()
				table_cards = game.table.get_cards()
				table_cards = table_cards[:int(k[0])+1]
				hs = handstrength.tryit(player.hand, game.table.cards, int(k[0]))
				#c = ''.join(map(str, context[0]))
				#print context, player.no, hand, table_cards
				#c += context[1]
				pair = [k, str(hs)]
				#print pair
				if pair[0] in player.c:
					l = player.c.get(pair[0])
					l.append(pair[1])
				else:
					player.c[pair[0]] = []
					l= player.c.get(pair[0])
					l.append(pair[1])
Пример #2
0
 def calculateAction(self, table, player, numPlayers):
     #print "calcAct: ", "hand:", player.hand, "table:", table.get_cards()
     action = handstrength.tryit(player.get_hand(), table.get_cards(), numPlayers)
     #action = rr -fr + ((cr + chr) / 2) + random.randrange(0,20)*0.5
     #print "ACTION: ", action
     return action
Пример #3
0
import handstrength

print handstrength.tryit([[5, 'C'], [11, 'D']], [[6, 'S'], [5, 'D'], [9, 'S']], 9)