Beispiel #1
0
def test_cfull_enumeration_with_boardcards_against_py():
    switch = {3: 4, 4: 3}
    n = 3
    for __ in range(100):
        n = switch[n]
        cards = utils.deal([2, 2, n])
        hands, board = cards[:2], cards[2]
        map(assert_close, cpoker.full_enumeration(hands, board), poker.full_enumeration(hands, board))

    for __ in range(100):
        n = switch[n]
        cards = utils.deal([2, 2, 2, n])
        hands, board = cards[:3], cards[3]
        map(assert_close, cpoker.full_enumeration(hands, board), poker.full_enumeration(hands, board))

    for __ in range(100):
        n = switch[n]
        cards = utils.deal([2, 2, 2, 2, 2, n])
        hands, board = cards[:5], cards[5]
        map(assert_close, cpoker.full_enumeration(hands, board), poker.full_enumeration(hands, board))
Beispiel #2
0
def test_cfull_enumeration_with_boardcards_against_py():
    switch = {3:4, 4:3}
    n = 3
    for __ in range(100):
        n = switch[n]
        cards = utils.deal([2, 2, n])
        hands, board = cards[:2], cards[2]
        map(assert_close, cpoker.full_enumeration(hands, board), poker.full_enumeration(hands, board))

    for __ in range(100):
        n = switch[n]
        cards = utils.deal([2, 2, 2, n])
        hands, board = cards[:3], cards[3]
        map(assert_close, cpoker.full_enumeration(hands, board), poker.full_enumeration(hands, board))

    for __ in range(100):
        n = switch[n]
        cards = utils.deal([2, 2, 2, 2, 2, n])
        hands, board = cards[:5], cards[5]
        map(assert_close, cpoker.full_enumeration(hands, board), poker.full_enumeration(hands, board))
Beispiel #3
0
def test_full_enumeration():
    f = lambda *hands: cpoker.full_enumeration([utils.to_cards(h) for h in hands])
    map(assert_close, f("3s 2c", "5c 2h"), [0.398847108925, 1 - 0.398847108925])
    map(assert_close, f("8h Kh", "2c 5h"), [0.665651659986, 1 - 0.665651659986])
    map(assert_close, f("2s 3s", "5s Js"), [0.329603271382, 1 - 0.329603271382])
    map(assert_close, f("9c Jc", "Ts Td"), [0.327120651473, 1 - 0.327120651473])
    map(assert_close, f("9d Qh", "3s Ac"), [0.426625762715, 1 - 0.426625762715])
    map(assert_close, f("9c Ac", "Ah Kh"), [0.288065962586, 1 - 0.288065962586])
    map(assert_close, f("8c 4s", "Qh 9d"), [0.333585332978, 1 - 0.333585332978])
    map(assert_close, f("Jc 2s", "7s 2d"), [0.730345779721, 1 - 0.730345779721])
    map(assert_close, f("Ah 3c", "Qs 4d"), [0.609246080135, 1 - 0.609246080135])
    map(assert_close, f("5c 3h", "Qh 4h"), [0.376223789701, 1 - 0.376223789701])

    # multiway
    map(assert_close, f("8c Qd", "9h 9s", "4c 3d"), [0.263, 0.584, 0.153])
    map(assert_close, f("9h 4s", "3s Jc", "4h Ad", "8c 2s"), [0.172, 0.269, 0.352, 0.207])
    map(assert_close, f("4s Ad", "5h 4c", "Jc 9h", "3d Qc", "2s Qh"), [0.288, 0.165, 0.328, 0.113, 0.106])
Beispiel #4
0
def test_full_enumeration():
    f = lambda *hands: cpoker.full_enumeration([utils.to_cards(h) for h in hands])
    map(assert_close, f("3s 2c", "5c 2h"), [0.398847108925, 1 - 0.398847108925])
    map(assert_close, f("8h Kh", "2c 5h"), [0.665651659986, 1 - 0.665651659986])
    map(assert_close, f("2s 3s", "5s Js"), [0.329603271382, 1 - 0.329603271382])
    map(assert_close, f("9c Jc", "Ts Td"), [0.327120651473, 1 - 0.327120651473])
    map(assert_close, f("9d Qh", "3s Ac"), [0.426625762715, 1 - 0.426625762715])
    map(assert_close, f("9c Ac", "Ah Kh"), [0.288065962586, 1 - 0.288065962586])
    map(assert_close, f("8c 4s", "Qh 9d"), [0.333585332978, 1 - 0.333585332978])
    map(assert_close, f("Jc 2s", "7s 2d"), [0.730345779721, 1 - 0.730345779721])
    map(assert_close, f("Ah 3c", "Qs 4d"), [0.609246080135, 1 - 0.609246080135])
    map(assert_close, f("5c 3h", "Qh 4h"), [0.376223789701, 1 - 0.376223789701])

    #multiway
    map(assert_close, f('8c Qd', '9h 9s', '4c 3d'),
        [0.263, 0.584, 0.153])
    map(assert_close, f('9h 4s',  '3s Jc', '4h Ad', '8c 2s'),
        [0.172, 0.269, 0.352, 0.207])
    map(assert_close, f('4s Ad', '5h 4c', 'Jc 9h', '3d Qc', '2s Qh'),
        [0.288, 0.165, 0.328, 0.113, 0.106])