def test_zh_game(self): pgn_string = '[Variant "Crazyhouse"]\n{ Stockfish 020118 64 POPCNT } 1. e4 e5 2. Nf3 Nc6 3. Nc3 Bc5 4. Bc4 Nf6 5. d3 O-O 6. O-O d6 7. Bg5 h6 8. Bh4 Bg4 $2 { 3.23 } ( 8... Kh8 9. Nd5 { 0.99/19 } ) 9. Nd5 Nxd5 10. Bxd8 Raxd8 11. Bxd5 B@h5 12. Bxc6 $6 { 1.01 } ( 12. N@f5 { 2.27/17 } ) 12... bxc6 $2 { 3.70 } ( 12... Bxf3 13. gxf3 { 1.66/18 } ) 13. N@g5 hxg5 14. Nxg5 N@f6 15. Qxg4 Bxg4 16. N@e7+ $4 { -4.20 } ( 16. @h7+ Kh8 17. Q@g8+ Rxg8 18. Nxf7+ Kxh7 19. N@g5+ Kg6 20. @f5+ Bxf5 21. exf5+ Kxf5 22. B@e6+ Kg6 23. B@f5+ Kh5 24. g4+ Nxg4 25. Bxg4+ Kg6 26. N@h4+ Kf6 27. Ne4+ Ke7 28. Ng6+ Ke8 29. Nfxd6+ Rxd6 30. @f7+ Kd8 31. fxg8=Q+ N@e8 32. R@c8# ) 16... Kh8 17. Nxc6 $4 { -10.83 } ( 17. Q@h4+ Q@h6 { -4.31/16 } ) 17... Q@h4 18. B@g3 Qxg5 19. Nxd8 N@e2+ 20. Kh1 Nxg3+ $4 { -5.22 } ( 20... Rxd8 { -8.46/15 } ) 21. fxg3 $4 { -14.50 } ( 21. hxg3 Rxd8 { -5.41/16 } ) 21... B@h3 22. N@e1 N@f2+ 23. Rxf2 Bxf2 24. R@f1 Bxe1 25. @e7 Bxg2+ 26. Kg1 @f2+ 27. Rxf2 Bxf2+ 28. Kxg2 B@f3+ 29. Kf1 R@g1+ 30. Kxf2 R@g2# 0-1' # noqa E501 pgn = StringIO(pgn_string) game = chess.pgn.read_game(pgn) result = annotator.clean_game(game) node = result.end() while True: assert len(node.variations) <= 1 assert node.comment is None assert node.nags == [] if node == game.root(): break node = node.parent
def test_commented_game(self): pgn_string = "{ Stockfish 8 64 POPCNT } 1. Nf3 { test comment } Nf6 2. g3 g6 { A05 King's Indian Attack: Symmetrical Defense } 3. Bg2 Bg7 4. O-O O-O 5. c4 d6 6. b3 e5 7. Bb2 c5 8. e3 Nc6 9. Nc3 Bf5 10. d4 e4 11. Ne1 Re8 12. Nc2 h5 13. Qd2 h4 14. Ba3 $6 { -1.13 } ( 14. h3 g5 15. g4 Bg6 16. Rad1 Qe7 17. Qe2 a6 18. Ba3 a5 { 0.19/25 } ) 14... b6 $6 { -0.04 } ( 14... Nh7 15. Nd5 Ng5 16. Bb2 Rc8 17. Rac1 Ne7 18. Nf4 h3 19. Bh1 { -1.11/24 } ) 15. Rfd1 $6 { -1.15 } ( 15. h3 d5 16. g4 Be6 17. cxd5 Nxd5 18. Nxe4 f5 19. gxf5 gxf5 { 0.00/26 } ) 15... Bg4 16. Rdc1 Qd7 17. b4 Qf5 18. Bb2 Rad8 19. Nb5 Bf3 20. d5 Ne5 $6 { -1.66 } ( 20... Nxb4 21. Ne1 Bxg2 22. Nxg2 Nd3 23. Nxh4 Qh3 24. Bxf6 Bxf6 25. f4 { -3.14/25 } ) 21. Bxe5 Rxe5 22. Ne1 hxg3 23. fxg3 Bh6 24. Rab1 Kg7 $6 { -1.08 } ( 24... Qh5 25. Rb3 Rf5 26. bxc5 dxc5 27. Rc2 Ng4 28. h3 Bxg2 29. Kxg2 { -2.48/24 } ) 25. Rb3 Qh5 26. h3 $6 { -3.08 } ( 26. bxc5 bxc5 27. Nxa7 Rh8 28. h4 Qg4 29. Nc6 Rh5 30. Qf2 Bd1 { -2.00/23 } ) 26... Nh7 $2 { -1.37 } ( 26... Rg5 27. Qf2 { -2.89/24 }) 27. g4 Bxg4 28. hxg4 Qxg4 29. Qd1 $4 { -5.69 } ( 29. Qb2 Ng5 30. Nxd6 Qg3 31. Nf5+ gxf5 32. Kf1 Nf3 33. Qf2 Nh2+ { -2.30/24 } ) 29... Qg3 30. Qe2 Ng5 31. Kh1 Rh8 32. Nxd6 Kg8 33. bxc5 Bf8+ 34. Kg1 Nh3+ 35. Kf1 Bxd6 36. cxd6 Rf5+ 37. Nf3 Rxf3+ 0-1" # noqa E501 pgn = StringIO(pgn_string) game = chess.pgn.read_game(pgn) result = annotator.clean_game(game) node = result.end() while True: assert len(node.variations) <= 1 assert node.comment is None assert node.nags == [] if node == game.root(): break node = node.parent