For 2D debugging: visualize grid/board state, show puzzle progress, make algorithm behavior visible.
Create a formatted text representation of grid state.
def display_grid(grid, width, height):
"""Print grid as 2D representation."""
for y in range(height):
row = ''.join(grid.get((x, y), '.') for x in range(width))
print(row)
print()
# sudoku.py - display with separators
def display(values):
"""Display values as a 2-D grid."""
width = 1 + max(len(values[s]) for s in squares)
line = '+'.join(['-' * (width * 3)] * 3)
for r in rows:
print(''.join(
values[r + c].center(width) + ('|' if c in '36' else '')
for c in cols
))
if r in 'CF':
print(line)
print()
# Output:
# 4 8 3 |9 2 1 |6 5 7
# 9 6 7 |3 4 5 |8 2 1
# 2 5 1 |8 7 6 |4 9 3
# ------+------+------
# 5 4 8 |1 3 2 |9 7 6
# ...
# Side by side comparison (Sudoku.ipynb)
def print_side_by_side(left, right, width=20):
"""Print two strings side-by-side, line-by-line."""
for L, R in zip(left.splitlines(), right.splitlines()):
print(L.ljust(width), R.ljust(width))
# Grid class with print method (AdventUtils.ipynb)
class Grid(dict):
def print(self, sep='', xrange=None, yrange=None):
"""Print a representation of the grid."""
for row in self.to_rows(xrange, yrange):
print(*row, sep=sep)
def to_rows(self, xrange=None, yrange=None):
"""Contents as rectangular list of lists."""
xrange = xrange or cover(Xs(self))
yrange = yrange or cover(Ys(self))
default = ' ' if self.default in (KeyError, None) else self.default
return [[self.get((x, y), default) for x in xrange]
for y in yrange]
Search for places (restaurants, cafes, etc.) via Google Places API proxy on localhost.
Interact with GitHub using the `gh` CLI. Use `gh issue`, `gh pr`, `gh run`, and `gh api` for issues, PRs, CI runs, and advanced queries.
Create or update AgentSkills. Use when designing, structuring, or packaging skills with scripts, references, and assets.
Start voice calls via the OpenClaw voice-call plugin.
Notion API for creating and managing pages, databases, and blocks.
Gemini CLI for one-shot Q&A, summaries, and generation.
Category:developer