Exemplo n.º 1
0
    async def player_2():
        b = Battleship()
        await b.connect(nick="bar")
        check_states_empty(b)

        set_layout(b, get_basic_layout_1())
        await asyncio.sleep(0.1)
        b._ship_layout = get_basic_layout_2()
        b._salt = "invalid_salt"
        await b.join("foo")

        check_states_empty(b)
        for i in range(17):
            await b.round(9, 9)
        check_abort(b)

        b.restart()
        check_states_empty(b)
        set_layout(b, get_basic_layout_2())
        b._ship_layout = get_basic_layout_1()
        b._salt = "invalid_salt"
        await b.auto()

        await shoot_layout(b, get_basic_layout_2())
        check_abort(b)
Exemplo n.º 2
0
    async def player_1():
        b = Battleship()
        await b.connect(nick="foo")
        check_states_empty(b)

        set_layout(b, get_basic_layout_1())
        b._ship_layout = get_basic_layout_2()
        await b.start()

        check_states_empty(b)
        await shoot_layout(b, get_basic_layout_1())
        check_abort(b)

        b.restart()
        check_states_empty(b)
        await check_list(b, "bar")
        set_layout(b, get_basic_layout_2())
        await asyncio.sleep(0.1)
        b._ship_layout = get_basic_layout_1()
        await b.auto()

        for _ in range(17):
            await b.round(9, 9)
        check_abort(b)