- "source": "def draw(x, canvas, color='black'):\n with hold_canvas(canvas):\n canvas.clear()\n canvas.fill_style = '#FFF0C9'\n canvas.rough_fill_style = 'solid'\n canvas.fill_rect(-10, -10, canvas.size[0] + 10, canvas.size[1] + 10)\n canvas.rough_fill_style = 'cross-hatch'\n\n canvas.fill_style = color\n canvas.stroke_style = color\n\n living_cells = np.where(x)\n \n rects_x = living_cells[1] * n_pixels\n rects_y = living_cells[0] * n_pixels\n\n canvas.fill_rects(rects_x, rects_y, n_pixels)\n canvas.stroke_rects(rects_x, rects_y, n_pixels)",
0 commit comments