Пример #1
0
import Structure.GameBoard as gb
from Players.HumanPlayer import HumanPlayer

test_player = HumanPlayer("Joe")

test_board = gb.GameBoard([test_player], "Structure/Maps/classic.txt")

moves = 0
MAX_MOVES = 10

chosen_node = test_player.choose_start_pos(test_board)
test_player.add_start_node(test_board, chosen_node)

while moves < MAX_MOVES:
    moves += 1
    for player in test_board.get_players():
        chosen_node = player.make_move(test_board)
        test_player.add_node_to_network(test_board, chosen_node)

        print("----------")
        player.print_nodes_in_network()
        print("----------")
        player.print_cities_in_network(test_board)
        print("----------")
        player.print_edges_in_network()
Пример #2
0
import Structure.GameBoard as gb
from Players.Bots.BasicBots import BasicBot
from Graphics.DrawLib import BasicNetworkDrawer
import psychopy

comp1 = BasicBot("Comp1")
comp2 = BasicBot("Comp2")

test_board = gb.GameBoard([comp1, comp2], "Structure/Maps/classic.txt")

drawer = BasicNetworkDrawer(test_board.get_map(), test_board._cities)
win = psychopy.visual.Window(size=[1280, 720],
                             units="pix",
                             fullscr=False,
                             color=[0.9, 0.9, 0.9])

moves = 0
MAX_MOVES = 100

for player in test_board.get_players():
    player.choose_start_pos(test_board)

game_won = False

while not game_won:
    for player in test_board.get_players():
        if not player.has_won() and not game_won:
            valid = False
            while not valid:
                co_ords = player.make_move(test_board)
                if test_board.is_valid_move(player, co_ords):