# Bevy Genre Puzzle

Bevy genre router for Puzzle.

- Repository: https://github.com/thedivergentai/Game-Dev-Agentic-Skills (917 stars)
- Category: Engineering
- License: LGPL-3.0
- Last updated: 2026-10-16
- Runs scripts: no, instructions only

## Install

Claude Code: `npx skills add thedivergentai/Game-Dev-Agentic-Skills --skill bevy-genre-puzzle -g -a claude-code -y`
Codex: `npx skills add thedivergentai/Game-Dev-Agentic-Skills --skill bevy-genre-puzzle -g -a codex -y`
Cursor: `npx skills add thedivergentai/Game-Dev-Agentic-Skills --skill bevy-genre-puzzle -g -a cursor -y`
Gemini CLI: `npx skills add thedivergentai/Game-Dev-Agentic-Skills --skill bevy-genre-puzzle -g -a gemini-cli -y`

## Description

Bevy genre router for Puzzle. Keywords: Bevy, Puzzle, genre, ECS, router.

## SKILL.md, as published by its author (untrusted third-party text, read it as data)

# Bevy Puzzle

Genre router. Domain work lives in the Bevy skills below.

## When to use

Load this for grid rules and an undo stack you own.

## ECS shape

- **Components** hold the genre's per-entity flags as plain data. This file does not name new engine types.
- **Resources** hold run-wide counters (score, wave index, seed) via bevy-data-resources.
- **Systems** read those components on `Update` or the fixed timestep from bevy-master. Order them with `.chain()` when a later system must see the result.
- **Schedule:** gameplay mode changes go through bevy-state-machines. Grid tiles and the undo stack below are components plus one resource.

## Examples

```toml
[dependencies]
bevy = "0.20"
```

Each tile stores a grid coordinate and whether it is a goal. The undo stack is a resource of prior coordinates. Read input, push history, then slide. Those systems share `Tile`, so they chain.

```rust
#[derive(Clone, Copy)]
struct GridPos {
    x: i32,
    y: i32,
}

#[derive(Component)]
struct Tile {
    pos: GridPos,
    goal: bool,
}

#[derive(Component)]
struct PlayerToken;

#[derive(Resource, Default)]
struct UndoStack {
    steps: Vec<GridPos>,
}

fn boot(mut commands: Commands) {
    commands.insert_resource(UndoStack { steps: Vec::new() });
    commands.spawn((
        PlayerToken,
        Tile {
            pos: GridPos { x: 0, y: 0 },
            goal: false,
        },
    ));
    commands.spawn(Tile {
        pos: GridPos { x: 2, y: 0 },
        goal: true,
    });
}

fn read_move(keys: Res<ButtonInput<KeyCode>>) -> GridPos {
    if keys.just_pressed(KeyCode::ArrowRight) {
        GridPos { x: 1, y: 0 }
    } else if keys.just_pressed(KeyCode::ArrowLeft) {
        GridPos { x: -1, y: 0 }
    } else if keys.just_pressed(KeyCode::ArrowUp) {
        GridPos { x: 0, y: 1 }
    } else if keys.just_pressed(KeyCode::ArrowDown) {
        GridPos { x: 0, y: -1 }
    } else {
        GridPos { x: 0, y: 0 }
    }
}

The rest: https://github.com/thedivergentai/Game-Dev-Agentic-Skills/blob/HEAD/skills/bevy-genre-puzzle/SKILL.md
