Exemplo n.º 1
0
def replace1_100():
    """Replace a value that has 1 position in the grid."""
    t = tg()
    t[655] = 1
    for i in xrange(1, 101):
        t.replace(i, i + 1)
    return t
Exemplo n.º 2
0
def bfs_fill2():
    """Fill the grid with two dividers."""
    t = tg()
    for y in xrange(0, 19):
        idx1 = t.coords2index(10, y)
        idx2 = t.coords2index(20, 19 - y)
        t[idx1] = t[idx2] = 1
    t.bfs_fill(42, [t.coords2index(5, 10)])
    return t
Exemplo n.º 3
0
def bfs_fill3():
    """Fill a maze."""
    t = tg()
    for y in xrange(0, 19):
        for x in range(1, 29, 2):
            if x % 4 == 1:
                idx = t.coords2index(x, y)
            else:
                idx = t.coords2index(x, 19 - y)
            t[idx] = 1
    t.bfs_fill(42, [t.coords2index(0, 0)])
    return t
Exemplo n.º 4
0
def copy_100():
    """Copy the whole grid."""
    t = tg()
    for i in xrange(100):
        t1 = t.copy()
    return t1
Exemplo n.º 5
0
def replace600_100():
    """Replace a value that has 600 positions in the grid."""
    t = tg()
    for i in xrange(100):
        t.replace(i, i + 1)
    return t
Exemplo n.º 6
0
def ray_probe_l5_100():
    """Ray probe inside the box, width = 10, limit=5."""
    t = tg()
    for i in xrange(100):
        t.ray_probe(t.coords2index(15, 10), t.DIRECTIONS['RIGHT'], 10, limit=5)
Exemplo n.º 7
0
def bfs_fill1():
    """Fill an empty grid."""
    t = tg()
    t.bfs_fill(42, [t.coords2index(5, 10)])
    return t
Exemplo n.º 8
0
def ray_probe_box10_100():
    """Ray probe inside the box, width = 10."""
    t = tg_box1(tg())
    for i in xrange(100):
        t.ray_probe(t.coords2index(15, 10), t.DIRECTIONS['RIGHT'], 10)
Exemplo n.º 9
0
def ray_probe_empty5_100():
    """Ray probe from the center, width = 5."""
    t = tg()
    for i in xrange(100):
        t.ray_probe(t.coords2index(15, 10), t.DIRECTIONS['RIGHT'], 5)
Exemplo n.º 10
0
def bfs_probe_limit10():
    """BFS probe with the limit of 10."""
    t = tg()
    t.bfs_probe(t.coords2index(15, 10), limit=10)
Exemplo n.º 11
0
def bfs_probe_box():
    """BFS probe from the box in the center."""
    t = tg_box1(tg())
    t.bfs_probe(t.coords2index(15, 10))
Exemplo n.º 12
0
def bfs_probe_empty():
    """BFS probe in the empty grid from the center."""
    t = tg()
    t.bfs_probe(t.coords2index(15, 10))