Chess


Chess package (preliminary). User interface for ordinary chess games, including PGN read


Load the package by

Needs[Chess`]

Get PGN files from internet, for example

kasparov = Import["http://chessproblem.my-free-games.com/PGN/Kasparov.zip", "*.pgn"][[1]];

You may find the PGNs by

MakePGNfiles[kasparov]
   549 PGN files are available (PGNfile[no])

Select one file:

PGNfile[540]
     <|Event -> KasparovChess GP g/60, Site -> Internet INT,  Date -> 2000.02.13, Round -> 2.2, White -> Van Wely, Loek, Black -> Kasparov, Gary,  Result -> 0-1, WhiteElo -> 2646, BlackElo -> 2851,  ECO -> D46k, EventDate -> 2000.02.09,  PGN -> {1.d4, Nf6, 2.Nf3, d5, 3.c4, e6, 4.Nc3, c6,  5.e3, Nbd7, 6.Qc2, Bd6, 7.Bd3, O-O, 8.O-O, dxc4,  9.Bxc4, a6, 10.a4, c5, 11.Rd1, Qc7, 12.Ne4, Nxe4,  13.Qxe4, Nf6, 14.Qh4, cxd4, 15., Bd3, h6, 16.e4,  Nd7, 17.Bxh6, gxh6, 18.Rac1, Qd8, 19.Qxh6, Qf6,  20.Qxf6, Nxf6, 21.e5, Be7, 22.exf6, Bxf6, 23.Be4,  Rd8, 24.g4, Rb8, 25.g5, Bh8, 26.Ne1, Bd7, 27.a5,  Ba4, 28., Rd2, d3, 29.Rxd3, Bb5, 30.Rxd8+, Rxd8,  31.Nf3, Bxb2, 32.Rc7, Ba3, 33.Rxb7, Rd1+, 34., Kg2, Bd6, 35.Kh3, Rc1, 36.Nd4, Bf1+, 37.Bg2, Rc3+,  38.f3, Bd3, 39.Rb3, Rxb3, 40.Nxb3, Bb4, 41.f4, Bc4, 42.Nd4, Bxa5, 43.f5, Bc3, 44.Nc6, a5, 45.Nxa5,  Bxa5, 46.Be4, Bd5, 47., Bd3, Bc7, 48.f6, Bf4,  49.Kg4, Bxh2, 50.g6, e5, 51.Kf5, Be6+, 52.Kg5,  Bf4+, 53.Kh5, Bd5, 54.Kg4, fxg6, 55.Bxg6, Be6+,  56.Kf3, Bg5}|>

You may convert the PGN to a readable format for Mathematica

pgn = PGNconvert[PGNfile[540]["PGN"]];

and load the PGN directly into Chess:

Chess[ShowBoard -> pgn, Interact -> False]

title