示例#1
0
def single_unit_game(unit_type):
    game = Game()
    game.players = [Player(WHITE), Player(BLACK)]
    game.players[0].add_card(unit_type, 1)
    game.players[0].warp = 100
    game.active_color = WHITE
    game.deploy(unit_type, WHITE, BOARD_LENGTH/2, BOARD_HEIGHT/2, False)
    return game
示例#2
0
def test_game():
    return_game = Game()
    return_game.players = [Player(WHITE), Player(BLACK)]
    for player in return_game.players:
        player.add_card(WARPLING_TYPE, BOARD_LENGTH*BOARD_HEIGHT)
    return_game.active_color = WHITE
    return_game.deploy(WARPLING_TYPE, WHITE, 5, 5, False)
    return_game.active_color = BLACK
    return_game.deploy(WARPLING_TYPE, BLACK, 6, 6, False)
    return_game.turn = 1
    return return_game
示例#3
0
def checkers_game():
    # return a game with a checkers style arrangement of warplings.
    game = Game()
    game.players = [Player(WHITE), Player(BLACK, True)]
    for player in game.players:
        player.add_card(WARPLING_TYPE, BOARD_LENGTH*START_ZONE_HEIGHT)
        player.add_card(KNIGHT_TYPE, 7)
        player.add_card(BISHOP_TYPE, 7)
        player.add_card(ROOK_TYPE, 5)
        player.add_card(QUEEN_TYPE, 1)
        player.add_card(KING_TYPE, 1)

    game.active_color = game.players[0].color
    for x in range(BOARD_LENGTH):
        for y in range(START_ZONE_HEIGHT):
            if (x, y) == (BOARD_LENGTH/2, 0):
                game.deploy(KING_TYPE, game.active_color, x, y, False)
            elif (x % 2) == (y % 2):
                game.deploy(WARPLING_TYPE, game.players[0].color, x, y, False)

    game.active_color = game.players[1].color
    for x in range(BOARD_LENGTH):
        for y in range(BOARD_HEIGHT - START_ZONE_HEIGHT, BOARD_HEIGHT):
            if (x, y) == (BOARD_LENGTH/2, BOARD_HEIGHT - 1):
                game.deploy(KING_TYPE, game.active_color, x, y, False)
            elif x % 2 == (y - (BOARD_HEIGHT - START_ZONE_HEIGHT)) % 2:
                game.deploy(WARPLING_TYPE, game.players[1].color, x, y, False)

    game.active_color = STARTING_PLAYER
    game.turn = 1
    return game
示例#4
0
def make_game():
    game = Game()
    game.players = [Player(WHITE), Player(BLACK, True)]
    for player in game.players:
        player.warp = 1000
        player.add_card(WARPLING_TYPE, BOARD_LENGTH*START_ZONE_HEIGHT)
        player.add_card(ROOK_TYPE, 2)
        player.add_card(QUEEN_TYPE, 1)
        player.add_card(KING_TYPE, 1)
        player.add_card(GOLD_GENERAL_TYPE, 2)
        player.add_card(SILVER_GENERAL_TYPE, 2)

        game.active_color = player.color
        game.deploy(WARPLING_TYPE, player.color, 1, player.adjust(0), False)
        game.deploy(ROOK_TYPE, player.color, 3, player.adjust(0), False)
        game.deploy(KING_TYPE, player.color, 4, player.adjust(0), False)
        game.deploy(QUEEN_TYPE, player.color, 5, player.adjust(0), False)
        game.deploy(ROOK_TYPE, player.color, 6, player.adjust(0), False)
        game.deploy(WARPLING_TYPE, player.color, 8, player.adjust(0), False)

        game.deploy(WARPLING_TYPE, player.color, 0, player.adjust(1), False)
        game.deploy(WARPLING_TYPE, player.color, 2, player.adjust(1), False)
        game.deploy(SILVER_GENERAL_TYPE, player.color, 3, player.adjust(1), False)
        game.deploy(GOLD_GENERAL_TYPE, player.color, 4, player.adjust(1), False)
        game.deploy(GOLD_GENERAL_TYPE, player.color, 5, player.adjust(1), False)
        game.deploy(SILVER_GENERAL_TYPE, player.color, 6, player.adjust(1), False)
        game.deploy(WARPLING_TYPE, player.color, 7, player.adjust(1), False)
        game.deploy(WARPLING_TYPE, player.color, 9, player.adjust(1), False)

        for x in range(BOARD_LENGTH):
            if x not in {0, 2, 7, 9}:
                game.deploy(WARPLING_TYPE, player.color, x, player.adjust(2), False)
        player.warp = 1

        player.remove_card(WARPLING_TYPE)
        player.remove_card(KING_TYPE)
        player.remove_card(QUEEN_TYPE)
        player.remove_card(GOLD_GENERAL_TYPE)
        player.remove_card(SILVER_GENERAL_TYPE)

        player.add_card(SUPER_PAWN_TYPE, 6)
        player.add_card(LANCE_TYPE, 5)
        player.add_card(KNIGHT_TYPE, 4)
        player.add_card(BISHOP_TYPE, 4)
        player.add_card(ROOK_TYPE, 3)
        player.add_card(PROMOTED_BISHOP_TYPE, 2)
        player.add_card(PROMOTED_ROOK_TYPE, 1)

    game.turn = 1
    game.active_color = STARTING_PLAYER
    return game