all repos

tyess @ 3f3048b6eabb39e39333e63cf4d67ba48587a099

chess in typst

tyess/lib.typ (view raw)

Oleksandr Smirnov Oleksandr Smirnov
olexsmir@gmail.com
what's creamy, 27 days ago
1
#import "game.typ": render, apply-moves, parse-moves
2
3
// Usage:
4
//   #show: chess.with()
5
//   g4 d5 Bg5 Bxg4 c4 c6 cxd5 cxd5 Qb3
6
//
7
#let chess(body) = {
8
  set page(height: auto, width: auto, margin: (top: 0.5in, bottom: 0.5in, rest: 0.5in))
9
  let moves = parse-moves(body)
10
  let states = apply-moves(moves)
11
  render(states.last())
12
}