Skip to content
Back to skills

Display Grid State

ASecurity

For 2D debugging: visualize grid/board state, show puzzle progress, make algorithm behavior visible.

  • 4 stars
  • 0 votes
  • 0 copies
  • 1 view
  • Added November 7, 2026
ai-agentspythongoangulardebuggingperformance

Security analysis

A100/100

Scanned November 7, 2026

npx -y skills add jimmc414/claude-code-plugin-marketplace --skill display-grid-state --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Display Grid State?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Display Grid State
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/jimmc414-display-grid-state/badge)](https://www.skillsdirectory.com/skills/jimmc414-display-grid-state)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: display-grid-state
description: "For 2D debugging: visualize grid/board state, show puzzle progress, make algorithm behavior visible."
---

# display-grid-state

## When to Use
- Debugging grid algorithms
- Showing puzzle state
- Visualizing search progress
- Making algorithm transparent

## When NOT to Use
- Non-visual data
- Grids too large to display
- Performance-critical code

## The Pattern

Create a formatted text representation of grid state.

```python
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()
```

## Example (from pytudes)

```python
# 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]
```

## Key Principles
1. **Human readable**: Space/align for clarity
2. **Show boundaries**: Separators for structure
3. **Default for missing**: Empty cells have representation
4. **Configurable size**: Let caller specify range
5. **Print vs return**: Option to get string or print directly

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in ai-agents →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.