Ejemplo n.º 1
0
def LCG_crack():
    acc = try_createacc(ACC_LASTID)
    account_id = acc.id
    a = 1664525
    c = 1013904223
    x = play(PlayMode.LCG, account_id, 1, 42).real_number

    def next():
        return (x * a + c) % M

    while acc.money <= 1000_000:
        x = next()
        print(f'Playing {x}')
        result = play(PlayMode.LCG, account_id, 900, x)
        print(result)
        acc = result.account
Ejemplo n.º 2
0
def main():
    card = "*5 &Q &7 $3 *A #3 &6 $9 $6 *10 *3 $J &5"

    # # print(get_weight(1, to_card("&2 #3 $6 $Q &Q")))
    # res = solve(card)
    # print(res)

    token = api.login()
    game_id, card = api.begin_game(token)
    res = solve(card)
    api.play(game_id, res, token)
    print("--------比赛结果---------")

    time.sleep(2)
    api.get_game_list(token)
    # api.get_detail(token, game_id)

    print("-------------------")
    print()
Ejemplo n.º 3
0
def MT_BETTER_crack():
    acc = try_createacc(ACC_LASTID)
    account_id = acc.id

    inputs = []
    for i in range(624):
        res = play(PlayMode.BETTER_MT, account_id, 1, 42)
        acc = res.account
        inputs.append(res.real_number)
        print(f'Playing {i + 1}/624; money left: {acc.money}...')

    cracked_rng = MTCrack(inputs).make_rng()

    while acc.money <= 1000_000:
        expected = cracked_rng.next()
        bet = acc.money - 1
        result: PlayResult = play(PlayMode.BETTER_MT,
                                  account_id, bet, expected)
        print(result)
        acc = result.account
Ejemplo n.º 4
0
def solve_lcg(account_id: int) -> int:
    from sympy import mod_inverse
    # _last = (a * _last + c) % m; // m is 2^32
    inp = [play(PlayMode.LCG, account_id, 1, 42).real_number for _ in range(3)]
    print(inp)
    x1, x2, x3 = inp
    mi = mod_inverse(x2 - x1, M)
    a = ((x3 - x2) * mi) % M
    c = (x2 - x1 * a) % M
    print(f'a = {a}; c = {c}')
    return x3
Ejemplo n.º 5
0
def MT_crack():
    acc = try_createacc(ACC_LASTID)

    # Here we don't recover because need to initialize seed
    account_id = acc.id

    dt = acc.get_creation_time() - datetime.fromtimestamp(0, timezone.utc)
    seed = int(dt.total_seconds())
    print(f'Seed: {seed}')

    local_rng = MT19937Gen(seed)

    while acc.money <= 1000_000:
        expected = local_rng.next()
        result: PlayResult = play(PlayMode.MT, account_id, 900, expected)
        print(result)
        acc = result.account
Ejemplo n.º 6
0
import api
import ai
import time

toeken = ""
while True:
    token = api.login()
    while True:
        try:
            game_id, card = api.begin_game(token)
            res = ai.solve(card)
            api.play(game_id, res, token)
            print("--------比赛结果---------")
            time.sleep(1)
            # api.get_detail(token,game_id)
            api.get_game_list(token)
            print("-------------------")
            print()
        except:
            break
Ejemplo n.º 7
0
import api


def strategy():

    info = api.get()
    print('=======================')
    print('radius', api.getRadius())
    print('me    ', api.getMe())
    print('friend', api.getFriend())
    print('enemy1', api.getEnemy1())
    print('enemy2', api.getEnemy2())

    return [1000, 1000, 'gogo']


api.play('ws://sunset.nctu.me:8080/ws', 'demo-room', '君の名', strategy)
Ejemplo n.º 8
0
import api


def strategy():
    state = api.getState()
    myPos = api.getMyPosition()
    mySpeed = api.getMySpeed()
    enemyPos = api.getEnemyPosition()
    enemySpeed = api.getEnemySpeed()
    arenaR = api.getArenaRadius()
    gsensor = api.getGsensor()

    if state!='':
        # Win or lose
        print(state)

    return [-100, -100]


api.play('ws://snp2016.nctu.me:8080/ws', 'yourname', strategy)
Ejemplo n.º 9
0
import api


def strategy():
    state = api.getState()
    myPos = api.getMyPosition()
    mySpeed = api.getMySpeed()
    enemyPos = api.getEnemyPosition()
    enemySpeed = api.getEnemySpeed()
    arenaR = api.getArenaRadius()
    gsensor = api.getGsensor()

    if state != '':
        # Win or lose
        print(state)

    return [-100, -100]


api.play('ws://snp2016.nctu.me:8080/ws', 'yourname', strategy)