Skip to content

Commit

Permalink
Comments (#76)
Browse files Browse the repository at this point in the history
* first pass

* added fixtures for scanner tests

* fix eof issues w/ scanner

* doc for comments, simplify hash function which is slightly faster

Co-authored-by: Logan Spears <logan@logans-mac-mini.lan>
  • Loading branch information
notnil and Logan Spears authored Aug 12, 2021
1 parent 59a143a commit a05cf7a
Show file tree
Hide file tree
Showing 13 changed files with 504 additions and 102 deletions.
18 changes: 18 additions & 0 deletions fixtures/pgns/0001.pgn
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
[Event "?"]
[Site "?"]
[Date "1997.05.03"]
[Round "1"]
[White "Kasparov"]
[Black "Deep-Blue"]
[Result "1-0"]
[WhiteElo "2795"]

1. Nf3 d5 2. g3 Bg4 3. b3 Nd7 4. Bb2 e6 5. Bg2 Ngf6 6. O-O c6
7. d3 Bd6 8. Nbd2 O-O 9. h3 Bh5 10. e3 h6 11. Qe1 Qa5 12. a3
Bc7 13. Nh4 g5 14. Nhf3 e5 15. e4 Rfe8 16. Nh2 Qb6 17. Qc1 a5
18. Re1 Bd6 19. Ndf1 dxe4 20. dxe4 Bc5 21. Ne3 Rad8 22. Nhf1 g4
23. hxg4 Nxg4 24. f3 Nxe3 25. Nxe3 Be7 26. Kh1 Bg5 27. Re2 a4
28. b4 f5 29. exf5 e4 30. f4 Bxe2 31. fxg5 Ne5 32. g6 Bf3 33. Bc3
Qb5 34. Qf1 Qxf1+ 35. Rxf1 h5 36. Kg1 Kf8 37. Bh3 b5 38. Kf2 Kg7
39. g4 Kh6 40. Rg1 hxg4 41. Bxg4 Bxg4 42. Nxg4+ Nxg4+ 43. Rxg4
Rd5 44. f6 Rd1 45. g7 1-0
17 changes: 17 additions & 0 deletions fixtures/pgns/0002.pgn
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
[Event "?"]
[Site "http://lichess.org/4HXJOtpN"]
[Date "1997.05.03"]
[White "Kasparov (2795)"]
[Black "Deep-Blue"]
[Result "1-0"]
[WhiteElo "?"]
[BlackElo "?"]
[PlyCount "89"]
[Variant "Standard"]
[TimeControl "-"]
[ECO "A07"]
[Opening "King's Indian Attack, General"]
[Termination "Normal"]
[Annotator "lichess.org"]

1. Nf3 d5 2. g3 { King's Indian Attack, General } Bg4 3. b3 Nd7 4. Bb2 e6 5. Bg2 Ngf6 6. O-O c6 7. d3 Bd6 8. Nbd2 O-O 9. h3 Bh5 10. e3 h6 11. Qe1 Qa5 12. a3 Bc7 13. Nh4 g5 14. Nhf3 e5 15. e4 Rfe8 16. Nh2 Qb6 17. Qc1 a5 18. Re1 Bd6 19. Ndf1 dxe4 20. dxe4 Bc5 21. Ne3 Rad8 22. Nhf1 g4 23. hxg4 Nxg4 24. f3 Nxe3 25. Nxe3 Be7 26. Kh1 Bg5 27. Re2 a4 28. b4 f5 29. exf5 e4 30. f4 Bxe2 31. fxg5 Ne5 32. g6 Bf3 33. Bc3 Qb5 34. Qf1 Qxf1+ 35. Rxf1 h5 36. Kg1 Kf8 37. Bh3 b5 38. Kf2 Kg7?! { (0.70 → 1.52) Inaccuracy. The best move was Rd6. } (38... Rd6 39. Re1 Re7 40. Rg1 Re8 41. g4 h4 42. g5 Kg8 43. Rf1 Kf8 44. Re1 Kg8 45. Rb1 Rdd8 46. Rf1 Kf8 47. Rg1 Kg8 48. Rb1) 39. g4 Kh6?! { (1.42 → 2.07) Inaccuracy. The best move was h4. } (39... h4 40. g5 Kf8 41. Bg2 Ng4+ 42. Nxg4 Bxg4 43. Ke3 h3 44. Rf4 hxg2 45. Rxg4 Rd1 46. Rxg2 Rf1 47. Rf2 Rg1 48. Bf6 Rh1 49. Kd4) 40. Rg1 hxg4 41. Bxg4 Bxg4 42. Nxg4+ Nxg4+ 43. Rxg4 Rd5 44. f6 Rd1?? { (1.60 → 8.36) Blunder. The best move was Rf5+. } (44... Rf5+ 45. Ke2 Rg8 46. g7 e3 47. Bd4 Kh7 48. Kxe3 Re8+ 49. Re4 Rxe4+ 50. Kxe4 Rf1 51. Ke5 Kg8 52. Ke6 Rf4 53. c3 Rf1 54. Ke7) 45. g7 { Black resigns } 1-0
14 changes: 14 additions & 0 deletions fixtures/pgns/0003.pgn
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
[Event "?"]
[Site "?"]
[Date "????.??.??"]
[Round "?"]
[White "N.N."]
[Black "N.N."]
[Result "1-0"]
[Annotator "T1R"]
[SetUp "1"]
[FEN "2r2rk1/pp1bqpp1/2nppn1p/2p3N1/1bP5/1PN3P1/PBQPPPBP/3R1RK1 w - - 0 1"]
[PlyCount "5"]
[EventType "swiss"]

1. Nd5 exd5 (1... hxg5 2. Nxe7+ Nxe7) 2. Bxf6 hxg5 3. Bxe7 1-0
32 changes: 32 additions & 0 deletions fixtures/pgns/0004.pgn
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
[Event "Rated Bullet tournament https://lichess.org/tournament/yc1WW2Ox"]
[Site "https://lichess.org/PpwPOZMq"]
[Date "2017.04.01"]
[Round "-"]
[White "Abbot"]
[Black "Costello"]
[Result "0-1"]
[UTCDate "2017.04.01"]
[UTCTime "11:32:01"]
[WhiteElo "2100"]
[BlackElo "2000"]
[WhiteRatingDiff "-4"]
[BlackRatingDiff "+1"]
[WhiteTitle "FM"]
[ECO "B30"]
[Opening "Sicilian Defense: Old Sicilian"]
[TimeControl "300+0"]
[Termination "Time forfeit"]

1. e4 { [%eval 0.17] [%clk 0:00:30] } 1... c5 { [%eval 0.19] [%clk 0:00:30] }
2. Nf3 { [%eval 0.25] [%clk 0:00:29] } 2... Nc6 { [%eval 0.33] [%clk 0:00:30] }
3. Bc4 { [%eval -0.13] [%clk 0:00:28] } 3... e6 { [%eval -0.04] [%clk 0:00:30] }
4. c3 { [%eval -0.4] [%clk 0:00:27] } 4... b5? { [%eval 1.18] [%clk 0:00:30] }
5. Bb3?! { [%eval 0.21] [%clk 0:00:26] } 5... c4 { [%eval 0.32] [%clk 0:00:29] }
6. Bc2 { [%eval 0.2] [%clk 0:00:25] } 6... a5 { [%eval 0.6] [%clk 0:00:29] }
7. d4 { [%eval 0.29] [%clk 0:00:23] } 7... cxd3 { [%eval 0.6] [%clk 0:00:27] }
8. Qxd3 { [%eval 0.12] [%clk 0:00:22] } 8... Nf6 { [%eval 0.52] [%clk 0:00:26] }
9. e5 { [%eval 0.39] [%clk 0:00:21] } 9... Nd5 { [%eval 0.45] [%clk 0:00:25] }
10. Bg5?! { [%eval -0.44] [%clk 0:00:18] } 10... Qc7 { [%eval -0.12] [%clk 0:00:23] }
11. Nbd2?? { [%eval -3.15] [%clk 0:00:14] } 11... h6 { [%eval -2.99] [%clk 0:00:23] }
12. Bh4 { [%eval -3.0] [%clk 0:00:11] } 12... Ba6? { [%eval -0.12] [%clk 0:00:23] }
13. b3?? { [%eval -4.14] [%clk 0:00:02] } 13... Nf4? { [%eval -2.73] [%clk 0:00:21] } 0-1
22 changes: 22 additions & 0 deletions fixtures/pgns/0005.pgn
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
[Event "Rated Blitz game"]
[Site "https://lichess.org/T6ZHGA95"]
[Date "2021.07.30"]
[White "notnil"]
[Black "Parth_chess_08"]
[Result "1-0"]
[UTCDate "2021.07.30"]
[UTCTime "14:34:39"]
[WhiteElo "1158"]
[BlackElo "1058"]
[WhiteRatingDiff "+11"]
[BlackRatingDiff "-32"]
[Variant "Standard"]
[TimeControl "300+3"]
[ECO "B31"]
[Opening "Sicilian Defense: Nyezhmetdinov-Rossolimo Attack, Fianchetto Variation"]
[Termination "Normal"]
[Annotator "lichess.org"]

1. e4 { [%eval 0.24] [%clk 0:05:00] } 1... c5 { [%eval 0.32] [%clk 0:05:00] } 2. Nf3 { [%eval 0.0] [%clk 0:05:01] } 2... Nc6 { [%eval 0.32] [%clk 0:05:02] } 3. Bb5 { [%eval 0.0] [%clk 0:05:00] } 3... g6 { [%eval 0.13] [%clk 0:05:03] } { B31 Sicilian Defense: Nyezhmetdinov-Rossolimo Attack, Fianchetto Variation } 4. d4 { [%eval -0.25] [%clk 0:04:57] } 4... Bg7?! { (-0.25 → 0.39) Inaccuracy. cxd4 was best. } { [%eval 0.39] [%clk 0:05:05] } (4... cxd4 5. Nxd4 Bg7 6. Be3 Nf6 7. Nc3 a6 8. Be2 d5 9. exd5) 5. dxc5?? { (0.39 → -4.17) Blunder. c3 was best. } { [%eval -4.17] [%clk 0:04:55] } (5. c3 Qb6 6. a4 cxd4 7. O-O a6 8. Bxc6 dxc3 9. Bxd7+ Bxd7) 5... a6?? { (-4.17 → 2.08) Blunder. Qa5+ was best. } { [%eval 2.08] [%clk 0:05:03] } (5... Qa5+ 6. Nc3 Bxc3+ 7. bxc3 Qxb5 8. Be3 Nf6 9. Nd2 Qa6 10. Rb1) 6. Ba4?? { (2.08 → 0.26) Blunder. Bxc6 was best. } { [%eval 0.26] [%clk 0:04:46] } (6. Bxc6 dxc6) 6... Qa5+ { [%eval 0.44] [%clk 0:04:57] } 7. Nc3?? { (0.44 → -5.14) Blunder. c3 was best. } { [%eval -5.14] [%clk 0:04:18] } (7. c3 Qxc5) 7... Qxc5?? { (-5.14 → 1.28) Blunder. Bxc3+ was best. } { [%eval 1.28] [%clk 0:04:55] } (7... Bxc3+ 8. bxc3) 8. Bxc6? { (1.28 → -0.23) Mistake. Nd5 was best. } { [%eval -0.23] [%clk 0:04:11] } (8. Nd5 Qa5+) 8... Qxc6?! { (-0.23 → 0.59) Inaccuracy. Bxc3+ was best. } { [%eval 0.59] [%clk 0:04:55] } (8... Bxc3+ 9. bxc3 Qxc3+ 10. Bd2 Qxc6 11. O-O d6 12. h3 Nf6 13. e5 dxe5 14. Nxe5 Qd5 15. Qe1) 9. Qd5?? { (0.59 → -5.86) Blunder. Nd5 was best. } { [%eval -5.86] [%clk 0:03:54] } (9. Nd5 b5) 9... e6?? { (-5.86 → 0.93) Blunder. Bxc3+ was best. } { [%eval 0.93] [%clk 0:04:49] } (9... Bxc3+) 10. Qxc6 { [%eval 1.18] [%clk 0:03:38] } 10... bxc6 { [%eval 1.14] [%clk 0:04:52] } 11. O-O { [%eval 0.81] [%clk 0:03:39] } 11... Rb8 { [%eval 1.11] [%clk 0:04:49] } 12. Rd1?! { (1.11 → 0.46) Inaccuracy. e5 was best. } { [%eval 0.46] [%clk 0:02:53] } (12. e5 f5 13. Na4 Nh6 14. Re1 Nf7 15. b3 Rg8 16. Bb2 Bf8 17. Rad1 c5 18. Ba3 Rb5) 12... d6?? { (0.46 → 2.86) Blunder. d5 was best. } { [%eval 2.86] [%clk 0:04:24] } (12... d5 13. e5 Bf8 14. Na4 c5 15. b3 Bd7 16. Be3 d4 17. Bd2 Bc6 18. Rab1 h5 19. c3) 13. Rxd6 { [%eval 2.95] [%clk 0:02:45] } 13... Bf8? { (2.95 → 5.51) Mistake. Ne7 was best. } { [%eval 5.51] [%clk 0:04:22] } (13... Ne7) 14. Rxc6 { [%eval 5.44] [%clk 0:02:31] } 14... Bd7 { [%eval 6.31] [%clk 0:04:22] } 15. Rxa6 { [%eval 6.23] [%clk 0:02:31] } 15... Bb5?! { (6.23 → 10.20) Inaccuracy. Bg7 was best. } { [%eval 10.2] [%clk 0:04:21] } (15... Bg7 16. a4 Ne7 17. a5 O-O 18. Rd6 Bc6 19. a6 Rfc8 20. a7 Ra8 21. Bg5 Bxc3 22. bxc3) 16. Nxb5 { [%eval 10.07] [%clk 0:02:17] } 16... Rxb5 { [%eval 10.25] [%clk 0:04:21] } 17. Ra8+ { [%eval 10.24] [%clk 0:02:13] } 17... Ke7 { [%eval 10.39] [%clk 0:04:21] } 18. Ra7+ { [%eval 9.46] [%clk 0:01:44] } 18... Kf6 { [%eval 9.63] [%clk 0:04:12] } 19. e5+ { [%eval 8.84] [%clk 0:01:38] } 19... Kf5 { [%eval 16.9] [%clk 0:04:11] } 20. Ra4 { [%eval 8.69] [%clk 0:00:56] } 20... f6? { (8.69 → Mate in 1) Checkmate is now unavoidable. Rb4 was best. } { [%eval #1] [%clk 0:02:31] } (20... Rb4 21. Ra7 Ne7 22. b3 h6 23. Bd2 Re4 24. h3 g5 25. a4 Kg6 26. Re1 Rxe1+ 27. Bxe1) 21. g4# { [%clk 0:00:46] } { White wins by checkmate. } 1-0


89 changes: 89 additions & 0 deletions fixtures/pgns/0006.pgn
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
[Event "Rated Classical game"]
[Site "https://lichess.org/4w6vfr19"]
[White "Yudhisthira"]
[Black "netsah08"]
[Result "0-1"]
[UTCDate "2013.01.31"]
[UTCTime "22:59:08"]
[WhiteElo "1854"]
[BlackElo "1937"]
[WhiteRatingDiff "-9"]
[BlackRatingDiff "+16"]
[ECO "E80"]
[Opening "King's Indian Defense: Saemisch Variation"]
[TimeControl "600+10"]
[Termination "Normal"]

1. d4 Nf6 2. c4 g6 3. Nc3 Bg7 4. e4 d6 5. f3 Nc6 6. Be3 a6 7. Qd2 Rb8 8. g4 h5 9. g5 Nd7 10. f4 e5 11. d5 Nd4 12. Bh3 c6 13. f5 gxf5 14. exf5 f6 15. Bxd4 exd4 16. Qxd4 Qe7+ 17. Qe4 fxg5 18. Qxe7+ Kxe7 19. Nge2 Ne5 20. b3 Nd3+ 21. Kf1 g4 22. Bg2 Rf8 23. dxc6 Rxf5+ 24. Kg1 Nf4 25. Re1 Kd8 26. Nxf4 Bd4+ 27. Kf1 Rxf4+ 28. Ke2 Bxc3 29. Rd1 Kc7 30. Rd5 Be5 31. c5 bxc6 32. cxd6+ Bxd6 33. Rxh5 Rb5 34. Rh7+ Kb6 35. Rh6 Re5+ 36. Kd1 Rd4+ 37. Kc1 Ba3+ 38. Kb1 Bf5+ 0-1

[Event "Rated Classical game"]
[Site "https://lichess.org/33p7nthu"]
[White "Daler"]
[Black "kualalumpur"]
[Result "0-1"]
[UTCDate "2013.01.31"]
[UTCTime "22:59:13"]
[WhiteElo "1500"]
[BlackElo "1266"]
[WhiteRatingDiff "-331"]
[BlackRatingDiff "+12"]
[ECO "B01"]
[Opening "Scandinavian Defense"]
[TimeControl "720+0"]
[Termination "Time forfeit"]

1. e4 d5 2. d3 dxe4 3. dxe4 Qxd1+ 4. Kxd1 Nc6 5. Bf4 e5 6. Be3 Be6 7. Nc3 O-O-O+ 8. Bd3 Nb4 9. Kd2 c5 10. a3 Nxd3 11. cxd3 c4 12. Kc2 cxd3+ 13. Kd1 Nf6 14. Bg5 Bb3+ 15. Kc1 d2+ 16. Kb1 d1=Q+ 17. Nxd1 Rxd1+ 18. Bc1 Bc5 19. Nf3 Rxh1 20. Nxe5 Rd8 21. Nxf7 Bxf7 0-1

[Event "Rated Classical game"]
[Site "https://lichess.org/pzncnhrt"]
[White "senip"]
[Black "Richard_XII"]
[Result "0-1"]
[UTCDate "2013.01.31"]
[UTCTime "22:59:27"]
[WhiteElo "1431"]
[BlackElo "1523"]
[WhiteRatingDiff "-70"]
[BlackRatingDiff "+7"]
[ECO "B01"]
[Opening "Scandinavian Defense: Mieses-Kotroc Variation"]
[TimeControl "960+6"]
[Termination "Normal"]

1. e4 d5 2. exd5 Qxd5 3. Nc3 Qd8 4. Nf3 Nc6 5. Bb5 Nf6 6. Bxc6+ bxc6 7. O-O Bg4 8. a4 e6 9. a5 Rb8 10. a6 Bc5 11. b3 h5 12. Ba3 Bb6 13. h3 Bxf3 14. Qxf3 g5 15. Qxc6+ Qd7 16. Qxd7+ Kxd7 17. Na4 Rbd8 18. Nxb6+ cxb6 19. c4 Kc8 20. c5 Kc7 21. cxb6+ Kxb6 22. Bb4 Rd4 23. Bc3 Rf4 24. Bxf6 Rxf6 25. Ra4 Rd8 26. Rfa1 g4 27. Rb4+ Kc5 28. Rc4+ Kb6 29. Rb4+ Kc5 30. Rc4+ Kb6 31. b4 gxh3 32. gxh3 Rxd2 33. b5 Rfxf2 34. Rc6+ Kxb5 35. Rcc1 e5 36. Rcb1+ Kc4 37. Rc1+ Kd3 38. Rd1 Rxd1+ 39. Rxd1+ Rd2 40. Rxd2+ Kxd2 41. Kf2 Kd3 42. Kf3 e4+ 43. Kf2 Kd2 44. h4 e3+ 45. Kf1 e2+ 46. Kf2 e1=Q+ 47. Kg2 Qxh4 48. Kg1 f5 49. Kf1 f4 50. Kg1 f3 51. Kf1 Qe1# 0-1

[Event "Rated Blitz game"]
[Site "https://lichess.org/hhwb2whr"]
[White "van9"]
[Black "shueardm"]
[Result "1-0"]
[UTCDate "2013.01.31"]
[UTCTime "22:59:41"]
[WhiteElo "1693"]
[BlackElo "1479"]
[WhiteRatingDiff "+6"]
[BlackRatingDiff "-5"]
[ECO "B00"]
[Opening "Barnes Defense"]
[TimeControl "180+1"]
[Termination "Normal"]

1. e4 f6 2. Bc4 e6 3. d4 Qe7 4. Nc3 Nc6 5. d5 exd5 6. Bxd5 d6 7. Nf3 Bg4 8. h3 Bxf3 9. Qxf3 O-O-O 10. Bxc6 bxc6 11. Be3 g5 12. Bxa7 Nh6 13. O-O-O f5 14. exf5 Bg7 15. Rhe1 Qf6 16. g4 Rhf8 17. Qxc6 Nxf5 18. gxf5 Qxf5 19. Nd5 Rf7 20. Ne7+ Rxe7 21. Rxe7 Qf4+ 22. Be3 1-0

[Event "Rated Blitz game"]
[Site "https://lichess.org/e4gb7ja6"]
[White "pablotorre"]
[Black "Tortfeasor"]
[Result "0-1"]
[UTCDate "2013.01.31"]
[UTCTime "22:59:31"]
[WhiteElo "1744"]
[BlackElo "1762"]
[WhiteRatingDiff "-10"]
[BlackRatingDiff "+19"]
[ECO "B15"]
[Opening "Caro-Kann Defense: Forgacs Variation"]
[TimeControl "300+0"]
[Termination "Time forfeit"]

1. e4 c6 2. d4 d5 3. Nc3 dxe4 4. Nxe4 Nf6 5. Nxf6+ exf6 6. Bc4 Be7 7. Qh5 O-O 8. Be3 Nd7 9. Nf3 Nb6 10. Bb3 Be6 11. c3 Bxb3 12. axb3 Nd5 13. O-O Nxe3 14. fxe3 Bd6 15. e4 Bc7 16. e5 fxe5 17. Nxe5 Bxe5 18. Qxe5 Re8 19. Qc5 Qb6 20. Qxb6 axb6 21. Kf2 Ra6 22. Rae1 Rxe1 23. Rxe1 Kf8 24. c4 Ra2 25. Re2 Ra3 26. Re3 f6 27. d5 Ra8 28. b4 Rd8 29. Rd3 Ke7 30. Ke3 Rd6 31. Ke4 g6 32. g4 Kd7 33. dxc6+ bxc6 34. Rxd6+ Kxd6 35. Kd4 c5+ 36. Ke4 cxb4 37. Kd4 f5 38. gxf5 gxf5 39. b3 f4 40. Ke4 Kc5 41. Kxf4 Kd4 42. h4 Kc3 43. Ke3 Kxb3 44. Kd2 Kxc4 45. Kc2 b3+ 46. Kb2 h5 47. Kb1 Kd4 48. Kb2 Ke4 49. Kxb3 Kf4 50. Kb4 Kg4 51. Kb5 Kxh4 52. Kxb6 Kg3 53. Kc5 h4 54. Kd4 h3 55. Kd3 h2 56. Ke4 h1=Q+ 57. Ke5 Qf3 58. Ke6 Kg4 59. Kd6 Qf4+ 60. Kc6 Kg5 61. Kc5 Qf6 62. Kd5 Kf4 63. Kc4 Qg5 64. Kb3 Qg4 0-1
139 changes: 139 additions & 0 deletions fixtures/pgns/0007.pgn
Original file line number Diff line number Diff line change
@@ -0,0 +1,139 @@
[Event "FIDE World Cup 2021"]
[Site "Krasnaya Polyana RUS"]
[Date "2021.07.20"]
[Round "3.3"]
[White "Giri,A"]
[Black "Abdusattorov,Nodirbek"]
[Result "0-1"]
[WhiteTitle "GM"]
[BlackTitle "GM"]
[WhiteElo "2776"]
[BlackElo "2634"]
[ECO "C09"]
[Opening "French"]
[Variation "Tarrasch, open variation, main line"]
[WhiteFideId "24116068"]
[BlackFideId "14204118"]
[EventDate "2021.07.12"]
[EventType "k.o."]

1. e4 e6 2. d4 d5 3. Nd2 c5 4. Ngf3 Nc6 5. exd5 exd5 6. Bb5 Qe7+ 7. Be2 Qc7 8.
dxc5 Bxc5 9. Nb3 Bb6 10. O-O Nge7 11. Nfd4 O-O 12. Be3 a6 13. Nxc6 bxc6 14. Bxb6
Qxb6 15. Qd4 Qxd4 16. Nxd4 Rb8 17. Nb3 Bf5 18. Rfc1 a5 19. Rab1 a4 20. Nc5 Ra8
21. Bd3 Ra5 22. Bxf5 Nxf5 23. Nd7 Re8 24. c4 d4 25. b4 axb3 26. axb3 Ra2 27. Nc5
Ree2 28. Nd3 Nd6 29. Ra1 Ne4 30. Rxa2 Rxa2 31. Re1 f5 32. g4 Ng5 33. Kg2 fxg4
34. Kg3 Nf3 35. Re7 Rd2 36. Nf4 d3 37. Re3 h5 38. Nxh5 Rd1 39. Kxg4 Nxh2+ 40.
Kf4 d2 41. Rd3 Nf1 0-1

[Event "FIDE World Cup 2021"]
[Site "Krasnaya Polyana RUS"]
[Date "2021.07.20"]
[Round "3.3"]
[White "Mamedyarov,S"]
[Black "Martirosyan,Haik M."]
[Result "0-1"]
[WhiteTitle "GM"]
[BlackTitle "GM"]
[WhiteElo "2782"]
[BlackElo "2632"]
[ECO "A22"]
[Opening "English opening"]
[WhiteFideId "13401319"]
[BlackFideId "13306553"]
[EventDate "2021.07.12"]
[EventType "k.o."]

1. c4 e5 2. Nc3 Nf6 3. e3 Bb4 4. Nge2 c6 5. d4 exd4 6. Qxd4 O-O 7. a3 Be7 8. g4
d6 9. g5 Nfd7 10. f4 Nc5 11. Qd1 a5 12. Nd4 a4 13. h4 Re8 14. Bg2 Nbd7 15. O-O
Bf8 16. Qe2 Qb6 17. Rb1 Nb3 18. Nc2 Ndc5 19. Kh2 Be6 20. e4 Qa6 21. Ne3 Na5 22.
f5 Bxc4 23. Nxc4 Nxc4 24. Rd1 d5 25. Bf4 Rad8 26. Rd4 Nb3 27. Rd3 d4 28. Rbd1
Bd6 29. Bxd6 Nxd6 30. Qc2 Qc4 31. Qf2 dxc3 32. Rxc3 Nxe4 33. Rxd8 Rxd8 34. Qf4
Qd4 35. Qxe4 Qxe4 36. Bxe4 Rd4 37. Bc2 Na5 38. Kh3 Kf8 39. f6 gxf6 40. gxf6 Rf4
41. Kg3 Rxf6 42. Bxa4 b5 43. Bc2 h6 44. b4 Nb7 45. a4 bxa4 46. Bxa4 Nd8 47. b5
cxb5 48. Bxb5 Ne6 49. Bd7 Nd4 50. Bg4 Kg7 51. Rc4 Nc6 52. Re4 Rd6 53. Bh5 Rd3+
54. Kg2 Rd5 55. Bf3 Ne5 56. Re2 Ra5 57. Be4 Ra3 58. Bf5 Kf6 59. Rf2 Re3 60. Bb1+
Kg7 61. Bf5 Rc3 62. Re2 Nc4 63. Rf2 Ne3+ 64. Kh2 Rc4 65. Kg3 Rc3 66. Kh2 Rc5 67.
Bh3 Kg6 68. Rf3 Re5 69. Kg3 f5 70. Bf1 Kf6 71. Bh3 Nd5 72. Ra3 Re3+ 73. Rxe3
Nxe3 74. Kf3 Nd5 75. Bf1 Ke5 76. Bc4 Nb4 77. Bb5 Nc2 78. Be8 Nd4+ 79. Ke3 f4+
80. Kf2 Nf5 81. h5 Nd4 82. Bg6 Kf6 83. Be8 Kg5 84. Bg6 Kg4 85. Be8 Nc2 86. Bg6
Nb4 87. Be8 Nd3+ 88. Ke2 Ne5 89. Kf2 f3 90. Ke3 Kg3 91. Ke4 Nc4 0-1

[Event "FIDE World Cup 2021"]
[Site "Krasnaya Polyana RUS"]
[Date "2021.07.20"]
[Round "3.3"]
[White "Vachier Lagrave,M"]
[Black "Paravyan,D"]
[Result "1-0"]
[WhiteTitle "GM"]
[BlackTitle "GM"]
[WhiteElo "2749"]
[BlackElo "2625"]
[ECO "B33"]
[Opening "Sicilian"]
[Variation "Pelikan (Lasker/Sveshnikov) variation"]
[WhiteFideId "623539"]
[BlackFideId "4194985"]
[EventDate "2021.07.12"]
[EventType "k.o."]

1. e4 c5 2. Nf3 Nc6 3. d4 cxd4 4. Nxd4 Nf6 5. Nc3 e5 6. Ndb5 d6 7. Nd5 Nxd5 8.
exd5 Ne7 9. c4 Ng6 10. Qa4 Bd7 11. Qb4 Bf5 12. h4 a6 13. Nc3 Be7 14. h5 Nf4 15.
Qa4+ b5 16. cxb5 O-O 17. Bxf4 axb5 18. Qb4 exf4 19. Qxf4 Bd7 20. Be2 b4 21. Qxb4
Rb8 22. Nb5 Bf6 23. a4 Re8 24. Kf1 Qe7 25. Re1 Be5 26. g3 Qf6 27. Kg2 Red8 28.
b3 Bxb5 29. Bxb5 Bc3 30. Qc4 Bxe1 31. Rxe1 Rdc8 32. Bc6 Qb2 33. Re3 Qd2 34. Qf4
Qc2 35. b4 h6 36. b5 Qc5 37. Re4 Rd8 38. Qe3 Qc2 39. a5 Qd1 40. a6 f5 41. Re7 f4
42. Qf3 Qa1 43. a7 Rbc8 44. b6 fxg3 45. Qxg3 1-0

[Event "FIDE World Cup 2021"]
[Site "Krasnaya Polyana RUS"]
[Date "2021.07.20"]
[Round "3.3"]
[White "Vakhidov,J"]
[Black "Ponkratov,P"]
[Result "0-1"]
[WhiteTitle "GM"]
[BlackTitle "GM"]
[WhiteElo "2534"]
[BlackElo "2629"]
[ECO "A28"]
[Opening "English"]
[Variation "four knights, Nimzovich variation"]
[WhiteFideId "14201801"]
[BlackFideId "4157800"]
[EventDate "2021.07.12"]
[EventType "k.o."]

1. c4 Nf6 2. Nc3 e5 3. Nf3 Nc6 4. e4 Bb4 5. d3 d6 6. a3 Bxc3+ 7. bxc3 O-O 8. g3
Nd7 9. Bg2 a6 10. a4 Nc5 11. Nh4 Na5 12. Be3 Bd7 13. O-O b5 14. axb5 axb5 15.
cxb5 Bxb5 16. c4 Bd7 17. Nf5 Kh8 18. f4 exf4 19. Rxf4 Nc6 20. Rxa8 Qxa8 21. d4
Qa3 22. Bc1 Qd3 23. Qh5 Bxf5 24. exf5 Nxd4 25. Bf1 Qc3 26. f6 g6 27. Qh6 Nce6
28. Rf2 Nf5 29. Qd2 Qxd2 30. Bxd2 h5 31. Bd3 Nfd4 32. Be4 Rb8 33. Kg2 Kg8 34. h3
Nc5 35. Bxg6 fxg6 36. f7+ Kg7 37. f8=Q+ Rxf8 38. Bh6+ Kxh6 39. Rxf8 Kg7 40. Rf1
Nd7 41. Ra1 Kf6 42. Ra7 Ne6 0-1

[Event "FIDE World Cup 2021"]
[Site "Krasnaya Polyana RUS"]
[Date "2021.07.20"]
[Round "3.3"]
[White "Adhiban,Baskaran"]
[Black "Vidit,S"]
[Result "1/2-1/2"]
[WhiteTitle "GM"]
[BlackTitle "GM"]
[WhiteElo "2660"]
[BlackElo "2726"]
[ECO "C24"]
[Opening "Bishop's opening"]
[Variation "Berlin defence"]
[WhiteFideId "5018471"]
[BlackFideId "5029465"]
[EventDate "2021.07.12"]
[EventType "k.o."]

1. e4 e5 2. Bc4 Nf6 3. d3 c6 4. Nf3 d5 5. Bb3 a5 6. a4 Bb4+ 7. c3 Bd6 8. exd5
Nxd5 9. Nbd2 O-O 10. Ne4 Bc7 11. O-O Bg4 12. h3 Bh5 13. Ng3 Bg6 14. Re1 Nd7 15.
d4 exd4 16. Bxd5 cxd5 17. Qxd4 Re8 18. Rxe8+ Qxe8 19. Qxd5 Bxg3 20. fxg3 Be4 21.
Qd1 Nc5 22. Nd4 Rd8 23. Bf4 Ne6 24. Be3 Rd6 25. Qg4 Nxd4 26. Bxd4 Rg6 27. Qf4
Bc6 28. Kh2 h6 29. Rf1 Bxa4 30. Ra1 Bc6 31. Rxa5 Qe2 32. Qf2 Qxf2 33. Bxf2 Re6
34. Kg1 Re2 35. b4 Rc2 36. Rc5 Rc1+ 37. Kh2 Rc2 38. Kg1 Rc1+ 39. Kh2 1/2-1/2
File renamed without changes.
6 changes: 6 additions & 0 deletions game.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ type Game struct {
notation Notation
tagPairs []*TagPair
moves []*Move
comments [][]string
positions []*Position
pos *Position
outcome Outcome
Expand Down Expand Up @@ -194,6 +195,11 @@ func (g *Game) Moves() []*Move {
return append([]*Move(nil), g.moves...)
}

// Comments returns the comments for the game indexed by moves.
func (g *Game) Comments() [][]string {
return append([][]string(nil), g.comments...)
}

// TagPairs returns the game's tag pairs.
func (g *Game) TagPairs() []*TagPair {
return append([]*TagPair(nil), g.tagPairs...)
Expand Down
2 changes: 1 addition & 1 deletion notation_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ type validNotationTest struct {
}

func TestValidDecoding(t *testing.T) {
f, err := os.Open("assets/valid_notation_tests.json")
f, err := os.Open("fixtures/valid_notation_tests.json")
if err != nil {
t.Fatal(err)
return
Expand Down
Loading

0 comments on commit a05cf7a

Please sign in to comment.