show-game.rs 664 B

12345678910111213141516171819202122
  1. // Load a PGN file containing a single game, and display that game, move by move
  2. pub fn main() {
  3. let fischer = pgn_filter::Games::from_file("examples/fischer.pgn").unwrap();
  4. println!("File has {} game(s)", fischer.iter().count());
  5. if fischer.iter().count() > 0 {
  6. let game = &fischer.iter().next().unwrap();
  7. for (board, mv) in game.iter() {
  8. println!("{}", board);
  9. println!("Move {}: {}{}",
  10. board.fullmove_number(),
  11. if board.player_to_move() == "White" { "" } else { "..." },
  12. mv
  13. );
  14. println!("");
  15. }
  16. }
  17. }