# Included games

`{chess}` includes a total of 61 games so you can get up and running as soon as you install the package. To access them, use the `system.file()` function as below:

    library(chess)

    # Read final game from the Queen's Gambit
    file <- system.file("harmon.pgn", package = "chess")
    harmon_borgov <- read_game(file)

    # PGN for game
    str(harmon_borgov)
    #> [Event "Moscow Invitational"]
    #> [Site "https://lichess.org/DxKCK3mk"]
    #> [Date "1968.??.??"]
    #> [Round "1"]
    #> [White "Harmon, Elizabeth (?)"]
    #> [Black "Borgov, Vasily (?)"]
    #> [Result "1-0"]
    #> [Annotator "lichess.org"]
    #> [BlackElo "?"]
    #> [ECO "D20"]
    #> [Opening "Queen's Gambit Accepted: Central Variation, McDonnell Defense"]
    #> [Termination "Normal"]
    #> [TimeControl "-"]
    #> [Variant "Standard"]
    #> [WhiteElo "?"]
    #>
    #> 1. d4 d5 2. c4 e5 $6 { (0.00 → 0.83) Inaccuracy. e6 was best. } ( 2... e6 3. Nc3 c6 4. e3 Nf6 5. b3 Nbd7 6. Bb2 Bd6 7. Bd3 ) 3. e4 $4 { (0.83 → -0.94) Blunder. dxe5 was best. } ( 3. dxe5 Ne7 4. Nc3 d4 5. Nb5 Nbc6 6. Nf3 Ng6 7. a3 Be7 ) 3... dxc4 $2 { (-0.94 → 0.48) Mistake. dxe4 was best.
    #> D20 Queen's Gambit Accepted: Central Variation, McDonnell Defense } ( 3... dxe4 4. Ne2 exd4 5. Qxd4 Qe7 6. Nbc3 Nc6 7. Qxe4 Be6 8. Nd4 ) 4. Be3 $2 { (0.48 → -0.91) Mistake. Nf3 was best. } ( 4. Nf3 exd4 5. Bxc4 Nc6 6. O-O Be6 7. Bb5 Bc5 8. b4 Bb6 ) 4... Nf6 5. Nc3 Nc6 $6 { (-0.51 → 0.13) Inaccuracy. exd4 was best. } ( 5... exd4 6. Qxd4 Qxd4 7. Bxd4 Be6 8. f4 Nc6 9. Bxf6 gxf6 10. f5 ) 6. d5 Ne7 $6 { (-0.33 → 0.60) Inaccuracy. Na5 was best. } ( 6... Na5 7. Qa4+ c6 8. dxc6 Nxc6 9. Bxc4 Bb4 10. Nf3 Bd7 11. O-O ) 7. Bxc4 Ng6 8. f3 Bd6 9. Qd2 Bd7 10. Nge2 a6 11. Bb3 b5 12. a4 O-O 13. O-O Qe7 14. Rac1 Nh5 15. g3 h6 16. Bc2 Rab8 17. axb5 axb5 18. Ra1 Ra8 $6 { (-0.20 → 0.55) Inaccuracy. Bh3 was best. } ( 18... Bh3 ) 19. Bd3 Bb4 20. Rxa8 Rxa8 21. Qc2 Bc5 22. Nd1 Bd6 23. Nf2 $6 { (0.56 → 0.00) Inaccuracy. Nc1 was best. } ( 23. Nc1 Bh3 24. Rf2 b4 25. Nb3 Nf8 26. Qc6 Qd8 27. Rd2 Bd7 28. Qc2 Nh7 29. Nf2 Ng5 ) 23... Nhf4 24. Rc1 Qg5 25. Kh1 Qh5 26. Ng1 Nxd3 27. Nxd3 f5 28. Nc5 Bc8 29. Rf1 $6 { (-0.40 → -0.93) Inaccuracy. Ne6 was best. } ( 29. Ne6 Bxe6 30. dxe6 Ne7 31. Bc5 Qg6 32. exf5 Qxf5 33. Qxf5 Nxf5 34. Ne2 Re8 35. g4 Nh4 ) 29... Ne7 30. Qd3 fxe4 31. fxe4 Qg6 32. Kg2 Kh7 33. Nf3 Ng8 34. Nh4 Qg4 35. Nf5 Nf6 $6 { (-0.99 → 0.00) Inaccuracy. Ra2 was best. } ( 35... Ra2 36. h3 Rxb2+ 37. Rf2 Rxf2+ 38. Bxf2 Qg6 39. Ne6 Bxe6 40. dxe6 Qxe6 41. Qxb5 Nf6 42. Qd3 ) 36. h3 Qg6 37. Ne6 Ra4 38. b3 $6 { (0.67 → 0.00) Inaccuracy. Bc1 was best. } ( 38. Bc1 Bxe6 ) 38... Rxe4 $6 { (0.00 → 0.91) Inaccuracy. Nxe4 was best. } ( 38... Nxe4 39. bxa4 Nxg3 40. Ne7 Qxd3 41. Nf8+ Kh8 42. Nfg6+ Kh7 ) 39. Nxd6 Bxe6 40. dxe6 cxd6 41. e7 d5 42. Bc5 Qe8 43. Qf3 Qc6 44. b4 Qe8 $4 { (0.62 → 4.28) Blunder. Kg8 was best. } ( 44... Kg8 ) 45. Qf5+ Kh8 46. Qxf6 gxf6 47. Rxf6 Qh5 $6 { (3.54 → 4.50) Inaccuracy. Kg7 was best. } ( 47... Kg7 ) 48. Rf8+ Kg7 49. e8=Q Re2+ $6 { (4.09 → 5.81) Inaccuracy. Qxe8 was best. } ( 49... Qxe8 50. Rxe8 ) 50. Kf1 Qxh3+ $4 { (5.42 → Mate in 8) Checkmate is now unavoidable. Qxe8 was best. } ( 50... Qxe8 51. Rxe8 Re4 52. Rd8 d4 53. Bf8+ Kg6 54. Rd6+ Kf7 55. Bxh6 Ke7 56. Rd5 Ke6 57. Rd8 ) 51. Kxe2 Qg2+ 52. Rf2 Qe4+ 53. Kd2 { Black resigns. } 1-0

The example above loads the final game from the Queen’s Gambit. The other 60 games are sourced from My 60 Memorable Games, a classic book by Bobby Fischer, and are included in a single file. They can be loaded in the same way:

    # Read all games from My 60 Memorable Games
    file <- system.file("m60mg.pgn", package = "chess")
    m60mg <- read_game(file)

    # Check if it's a list of 60 games
    length(m60mg)
    #> [1] 60

In cases where you have more than one game in a single file, you can either load them all and access them like in a list (see below) or use the `n_max` argument to read only a handful of them.

    # PGN for Fischer vs. Unzicker
    str(m60mg[[10]])
    #> [Event "ZURICH"]
    #> [Site "https://lichess.org/study/4zOTO2ki/IQZZYsFH"]
    #> [Date "1959.??.??"]
    #> [Round "?"]
    #> [White "Fischer"]
    #> [Black "Unzicker"]
    #> [Result "*"]
    #> [ECO "C97"]
    #> [Opening "Ruy Lopez: Closed, Chigorin, Yugoslav System"]
    #> [UTCDate "2020.11.11"]
    #> [UTCTime "01:28:06"]
    #> [Variant "Standard"]
    #>
    #> 1. e4 e5 2. Nf3 Nc6 3. Bb5 a6 4. Ba4 Nf6 5. O-O Be7 6. Re1 b5 7. Bb3 d6 8. c3 O-O 9. h3 Na5 10. Bc2 c5 ( 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