pi-tic-tac-toe

Tic tac toe extension for Pi

Packages

Package details

extension

Install pi-tic-tac-toe from npm and Pi will load the resources declared by the package manifest.

$ pi install npm:pi-tic-tac-toe
Package
pi-tic-tac-toe
Version
0.1.0
Published
Jun 7, 2026
Downloads
not available
Author
shivam0110
License
MIT
Types
extension
Size
12.4 KB
Dependencies
0 dependencies · 3 peers
Pi manifest JSON
{
  "extensions": [
    "./extensions/index.ts"
  ]
}

Security note

Pi packages can execute code and influence agent behavior. Review the source before installing third-party packages.

README

pi-tic-tac-toe

Play a quick game of tic tac toe against the LLM inside Pi.

pi-tic-tac-toe adds a persistent TUI overlay opened with /tic-tac-toe. You play X, the LLM plays O, and the game stays in your Pi session so you can close the overlay and resume later.

Features

  • Centered terminal overlay, built with Pi TUI
  • Human vs LLM gameplay
  • Arrow-key and number-key input
  • Session persistence across Pi reloads/resumes
  • Validated saved state and legal move checking
  • TypeScript source, no build step required
  • Manual npm publish workflow included

Install

pi install npm:pi-tic-tac-toe

Or add it to ~/.pi/agent/settings.json:

{
  "packages": ["npm:pi-tic-tac-toe"]
}

Usage

Start or resume a game:

/tic-tac-toe

Start a fresh game:

/tic-tac-toe new

Controls

Key Action
Arrow keys Move cursor
1-9 Jump to a square
Enter Place X
n New game
q Close overlay

The overlay is TUI-only. It will not open in Pi print, JSON, or RPC modes.

How It Works

After you place X, the extension asks the LLM to play O by calling:

make_tic_tac_toe_move

The extension validates every move, so the LLM cannot move out of turn, overwrite a square, or continue after the game is over.

Development

npm install
npm test
npm run check

Try the extension locally:

pi -e ./extensions/index.ts

Then run:

/tic-tac-toe

Package Notes

Pi loads TypeScript extensions directly, so this package publishes the source .ts files. Pi core packages are declared as peer dependencies to avoid bundling duplicate Pi runtime packages.

License

MIT