Compare commits
2 Commits
185a08fa8b
...
00ce5251e1
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
00ce5251e1 | ||
|
|
87ba7168f6 |
16
README.md
16
README.md
@ -22,18 +22,19 @@ For each square on the board, pressure is the net number of pieces attacking it.
|
|||||||
|------|------|-------|-------|
|
|------|------|-------|-------|
|
||||||
| The Immortal Game | 1851 | Anderssen | Kieseritzky |
|
| The Immortal Game | 1851 | Anderssen | Kieseritzky |
|
||||||
| The Opera Game | 1858 | Morphy | Duke of Brunswick & Count Isouard |
|
| The Opera Game | 1858 | Morphy | Duke of Brunswick & Count Isouard |
|
||||||
| Kasparov's Immortal | 1999 | Kasparov | Topalov |
|
|
||||||
| Fischer vs Spassky, Game 6 | 1972 | Fischer | Spassky |
|
| Fischer vs Spassky, Game 6 | 1972 | Fischer | Spassky |
|
||||||
|
| Shirov vs Polgar | 1994 | Shirov | Polgar |
|
||||||
| Kasparov vs Deep Blue, Game 2 | 1997 | Deep Blue | Kasparov |
|
| Kasparov vs Deep Blue, Game 2 | 1997 | Deep Blue | Kasparov |
|
||||||
|
| Kasparov's Immortal | 1999 | Kasparov | Topalov |
|
||||||
|
| Polgar vs Anand | 1999 | Polgar | Anand |
|
||||||
|
| Polgar vs Kasparov | 2002 | Polgar | Kasparov |
|
||||||
|
| Hou Yifan vs Caruana | 2017 | Hou Yifan | Caruana |
|
||||||
|
| Ju Wenjun vs Lei Tingjie, WCC G12 | 2023 | Ju Wenjun | Lei Tingjie |
|
||||||
|
|
||||||
## Quickstart
|
## Quickstart
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
# Install dependencies
|
uv run chess-pressure
|
||||||
pip install fastapi uvicorn python-chess
|
|
||||||
|
|
||||||
# Run the server
|
|
||||||
python -m chess_pressure.app
|
|
||||||
```
|
```
|
||||||
|
|
||||||
The app starts on [http://localhost:8888](http://localhost:8888).
|
The app starts on [http://localhost:8888](http://localhost:8888).
|
||||||
@ -51,11 +52,12 @@ The app starts on [http://localhost:8888](http://localhost:8888).
|
|||||||
## Project Structure
|
## Project Structure
|
||||||
|
|
||||||
```
|
```
|
||||||
chess_pressure/
|
src/chess_pressure/
|
||||||
__init__.py
|
__init__.py
|
||||||
app.py # FastAPI routes and static file serving
|
app.py # FastAPI routes and static file serving
|
||||||
engine.py # Pressure computation, PGN parsing, move logic
|
engine.py # Pressure computation, PGN parsing, move logic
|
||||||
games.py # Built-in famous games (PGN data)
|
games.py # Built-in famous games (PGN data)
|
||||||
|
static/ # Frontend assets (HTML, JS, CSS, piece images)
|
||||||
```
|
```
|
||||||
|
|
||||||
## License
|
## License
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
[project]
|
[project]
|
||||||
name = "chess-pressure"
|
name = "chess-pressure"
|
||||||
version = "0.1.1"
|
version = "0.1.2"
|
||||||
description = "Chess pressure heatmap visualization"
|
description = "Chess pressure heatmap visualization"
|
||||||
readme = "README.md"
|
readme = "README.md"
|
||||||
requires-python = ">=3.11"
|
requires-python = ">=3.11"
|
||||||
|
|||||||
@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
|
from functools import lru_cache
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
|
||||||
import uvicorn
|
import uvicorn
|
||||||
@ -39,6 +40,7 @@ def list_games():
|
|||||||
|
|
||||||
|
|
||||||
@app.get("/api/games/{game_id}")
|
@app.get("/api/games/{game_id}")
|
||||||
|
@lru_cache(maxsize=16)
|
||||||
def load_game(game_id: str):
|
def load_game(game_id: str):
|
||||||
pgn = get_game_pgn(game_id)
|
pgn = get_game_pgn(game_id)
|
||||||
if pgn is None:
|
if pgn is None:
|
||||||
|
|||||||
2
uv.lock
generated
2
uv.lock
generated
@ -41,7 +41,7 @@ sdist = { url = "https://files.pythonhosted.org/packages/93/09/7d04d7581ae3bb8b5
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "chess-pressure"
|
name = "chess-pressure"
|
||||||
version = "0.1.1"
|
version = "0.1.2"
|
||||||
source = { editable = "." }
|
source = { editable = "." }
|
||||||
dependencies = [
|
dependencies = [
|
||||||
{ name = "fastapi" },
|
{ name = "fastapi" },
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user