Exemple #1
0
def shiftRight(grid, rnd, value):
    g = []
    idxs = []
    for idx, r in enumerate(grid):
        if row.canShiftRight(r):
            idxs.append(idx)
            g.append(row.shiftRight(r))
        else:
            g.append(row.copy(r))

    if len(idxs) > 0:
        g[idxs[int(rnd * len(idxs))]][0] = value

    return g
Exemple #2
0
def shiftRight(grid, rnd, value):
    g = []
    idxs = []
    for idx, r in enumerate(grid):
        if row.canShiftRight(r):
            idxs.append(idx)
            g.append(row.shiftRight(r))
        else:
            g.append(row.copy(r))

    if len(idxs) > 0:
        g[idxs[int(rnd * len(idxs))]][0] = value

    return g
Exemple #3
0
def canShiftRight(grid):
    for r in grid:
        if row.canShiftRight(r):
            return True
    return False
Exemple #4
0
def canShiftRight(grid): 
    for r in grid:
        if row.canShiftRight(r):
            return True
    return False