Home About Random
from ipythonblocks import BlockGrid, fui_colors
def four(grid, row, col, color):
    # draw a 4 in a grid 6 blocks wide by 8 blocks high
    g = grid[row:row + 8, col:col + 6]
    g[:, 4] = color
    g[4, :] = color
    g[1, 3] = color
    g[2, 2] = color
    g[3, 1] = color
def zero(grid, row, col, color):
    # draw a 0 in a grid 6 blocks wide by 8 blocks high
    g = grid[row:row + 8, col:col + 6]
    g[2:2 + 4, 0] = color
    g[2:2 + 4, 5] = color
    g[0, 2:2 + 2] = color
    g[7, 2:2 + 2] = color
    g[1, 1] = color
    g[1, 4] = color
    g[6, 1] = color
    g[6, 4] = color
fg = fui_colors.Emerald
bg = fui_colors.MidnightBlue

grid = BlockGrid(22, 10, fill=bg)

four(grid, 1, 1, fg)
zero(grid, 1, 8, fg)
four(grid, 1, 15, fg)

grid
grid.post_to_web('1:4,5,6')