use rand::rng;
use rand::seq::IndexedRandom;
use schachmatt::{Game, Pgn};
fn main() {
let mut game = random_game();
let pgn = Pgn::export(&mut game);
println!("{}", pgn);
}
fn random_game() -> Game {
let mut game = Game::default();
let mut rng = rng();
while game.get_game_result().is_none() {
let possible_moves = game.get_possible_turns();
let turn_to_play = possible_moves.choose(&mut rng).unwrap();
game.execute_turn(*turn_to_play).unwrap();
}
game
}