コード例 #1
0
def create_board(P1, P2, P3, *args):
    board = Board()
    P1 = board.get_player(P1)
    P2 = board.get_player(P2)
    P3 = board.get_player(P3)
    A = board.add_node('A', player=P1, power=2)
    L = board.add_node('L', player=P2, power=2)
    P = board.add_node('P', player=P3, power=2)
    B, C, D, E, F, G, H, I, J, K, M, N, O = board.get_empty_nodes(['B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K',
                                                                   'M', 'N', 'O'])
    board.add_paths([(A, B),
                     (A, C),
                     (A, D),
                     (B, E),
                     (C, F),
                     (D, G),
                     (E, H),
                     (F, I),
                     (F, J),
                     (G, K),
                     (H, L),
                     (I, L),
                     (J, P),
                     (K, P),
                     (L, M),
                     (M, N),
                     (N, O),
                     (O, P)
                     ])
    return board
コード例 #2
0
def create_board(P1, P2, *args):
    board = Board()
    P1 = board.get_player(P1)
    P2 = board.get_player(P2)
    A = board.add_node('A', player=P1, power=2)
    B, C, D = board.get_empty_nodes(['B', 'C', 'D'])
    E = board.add_node('E', player=P2, power=2)
    board.add_paths([(A, B),
                     (B, C),
                     (C, D),
                     (D, E)])
    return board