Exemplo n.º 1
0
def play_game(sample_size):
    bb = Baraja()
    bb.revolver()
    A = bb.approx_best_move(sample_size=sample_size)
    prize = bb.play(A[0]).value
    logging.debug('%s -- %s -- %s' % (bb.preview(), act.actions[A[0]], prize))
    return prize
Exemplo n.º 2
0
def batching(size):
    print('running batching')
    xbat = []
    ybat = []
    b = Baraja()
    for _ in range(size):
        b.revolver()
        xbat.append(b.one_hot())
        ybat.append(b.approx_best_move(sample_size=150)[0])
    return xbat, ybat
Exemplo n.º 3
0
 def test_approx_best_move(self):
     b = Baraja()
     b.start_with(map(Naipe, ['AS', 'QS', 'JS', 'KS', '10S']))
     self.assertEqual(b.approx_best_move(sample_size=200)[0], 31)
Exemplo n.º 4
0
# %load_ext autoreload
# %autoreload 2
import actions as act
from collections import Counter
from baraja import Naipe, Mano, Baraja, Prize
# #%run ~/code/EfedEquis/Efedequis/poquer/baraja/baraja

# %%time
b = Baraja()
b.start_with(map(Naipe,['6D', 'QH', '7H', '7S', '10C']))
#b.evaluate(13, sample_size=5000000)
prize_counter = Counter()
for _ in range(1000):
    prize_counter.update([b.play(13)])
print(prize_counter.most_common())
b.approx_best_move(sample_size=300)

# %%time
b = Baraja()
b.start_with(map(Naipe,['3S', 'QS', 'JD', '7S', '6S']))
res = []
for i in range(32):
    res.append((act.actions[i], b.evaluate_eff(i, sample_size=10)))
{k: v for k, v in sorted(res, key=lambda item: -item[1])}
best = b.approx_best_move(sample_size=100)
act.actions[best[0]],best[1]


# +
#b = Baraja()
#b.revolver()