Example #1
0
def calculate_gsg(row_size, col_size):
    global ROW_SIZE, COL_SIZE, GSG_VAL, CONWAY, CONWAY_state
    if (ROW_SIZE != row_size or COL_SIZE != col_size):
        ROW_SIZE = row_size
        COL_SIZE = col_size
        CONWAY = ConwayVariant(ROW_SIZE, COL_SIZE)
        GAME_GRAPH = CONWAY.make_graph()
        GSG_VAL = GSG(GAME_GRAPH).calculate()
        CONWAY_state = CONWAY.get_states()
Example #2
0
def main():

    conway = ConwayVariant(3,3)
    gsg = GSG(conway.make_graph())
    a, b, c = gsg.calculate()

    #init_state can either be the actual config or the index of
    #the state in the graph calculated above
    #init_state = 24
    init_state = [[0,1,1],[0,1,0],[1,1,1]]

    if type(init_state) == list:
        init_state = conway.get_state_index(init_state)

    seq = path.find_winning_path(a, init_state, b, c)
    print seq[0]
    conway.print_sequence(seq[0],seq[1])
Example #3
0
def main():

    conway = ConwayVariant(3, 3)
    gsg = GSG(conway.make_graph())
    a, b, c = gsg.calculate()

    #init_state can either be the actual config or the index of
    #the state in the graph calculated above
    #init_state = 24
    init_state = [[0, 1, 1], [0, 1, 0], [1, 1, 1]]

    if type(init_state) == list:
        init_state = conway.get_state_index(init_state)

    seq = path.find_winning_path(a, init_state, b, c)
    print seq[0]
    conway.print_sequence(seq[0], seq[1])