Skip to content

A domain-specific language (DSL) for describing basketball playbooks and generating SVG previews.

License

Notifications You must be signed in to change notification settings

poteto0/playbook-lang

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

50 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Playbook Lang

A domain-specific language (DSL) for describing basketball playbooks and generating SVG previews.

documentation

web-playground

Features

  • Simple DSL: Human-readable syntax to describe player positions and actions.
  • SVG Generation: Generates clean, scalable vector graphics for your playbooks.
  • Fast: Built with Rust for high performance and safety.
  • Wasm Ready: The core logic is designed to run in both CLI and Web environments.

Quick Start

1. Installation

clone repository

2. Write Playbook Code

players = { p1, p2, p3, p4, p5 }

state = {
  baller = p1,
  position = {
    p1 = (0, 60),
    p2 = (90, -80),
    p3 = (-90, -80),
    p4 = (50, -10),
    p5 = (-50, -10),
  },
}

actions = [
  action = {
    move = {
      p5 -> (-20, 40),
    },
  },

  action = {
    move = {
      p2 ~> (70, 20),
      p3 -> (0, -80),
    },
    screen = {
      p4 -> p2:middle,
      p5 ~[r]> (-60, -80)
    },
    pass = {
      p1 -> p2:after,
    },
  }
]

3 Run compile

3.1 Run with pre-built binary

A pre-built CLI is available in the build/ directory.

# Convert a sample playbook to SVG
./build/playbook-cli fixtures/input.playbook --output fixtures/output.svg

3.2 Build from source

If you have Rust and just installed:

# Run all tests
just test

# Convert using cargo
just convert fixtures/input.playbook

4. Output svg

Output

License

This project is licensed under the MIT License - see the LICENSE file for details.

About

A domain-specific language (DSL) for describing basketball playbooks and generating SVG previews.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 2

  •  
  •