コード例 #1
0
import argparse

from player import HumanPlayer, RandomPlayer
from ai_player import AIPlayer
from ui_game import UIGame
from table_generator import gaussian_table

from ai_player import AIPlayer

if __name__ == '__main__':
    parser = argparse.ArgumentParser()
    parser.add_argument('--p1', default='player 1')
    parser.add_argument('--p2', default='player 2')
    args = parser.parse_args()

    player1 = AIPlayer()
    player1.name = args.p1
    player2 = HumanPlayer()
    player2.name = args.p2

    game = UIGame(player1, player2)
コード例 #2
0
import argparse

from game import Game
from player import HumanPlayer, RandomPlayer
from ai_player import AIPlayer
from venus import AIPlayer as VenusAI

if __name__ == "__main__":
    parser = argparse.ArgumentParser()
    parser.add_argument("--p1", default="player 1")
    parser.add_argument("--p2", default="player 2")
    parser.add_argument("--rows", default="6", type=int)
    parser.add_argument("--cols", default="7", type=int)
    parser.add_argument("--num", default="4", type=int)
    args = parser.parse_args()

    player1 = RandomPlayer()
    player1.name = args.p1
    player2 = AIPlayer()
    player2.name = args.p2
    game = Game(player1, player2, args.cols, args.rows, args.num, verbose=True)
    game.run()
コード例 #3
0
    parser.add_argument('--p2', default='player 2')
    parser.add_argument('--rows', default='6', type=int)
    parser.add_argument('--cols', default='7', type=int)
    parser.add_argument('--num', default='4', type=int)
    args = parser.parse_args()

    dicc = {}
    best_tab = [[1, 2, 3, 3, 2, 1], [3, 4, 5, 5, 4, 3], [7, 9, 11, 11, 9, 7],
                [9, 10, 13, 13, 10, 9], [7, 9, 11, 11, 9, 7],
                [3, 4, 5, 5, 4, 3], [1, 2, 3, 3, 2, 1]]
    nb_players = 5

    with open("fights.txt", "a") as log:

        player = AIPlayer(best_tab)
        player.name = "champion"
        dicc[player.name] = {"victoires": 0, "player": player}

        log.write("\nPlayer : " + player.name)
        log.write("\n" + str(best_tab))

        for players in range(nb_players):
            tab = generate_table()

            player = AIPlayer(tab)
            player.name = "player" + str(players)
            dicc[player.name] = {"victoires": 0, "player": player}

            log.write("\n\nPlayer : " + player.name)
            log.write("\n" + str(tab))