Created
January 16, 2022 07:42
-
-
Save FermiDirak/aa6c10e0b2af962d53848b2188c8c626 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// consuming `apply_move` immutably | |
let chess_state = Chess::starting_board(); | |
let player_move = Move { start: ('G', 1), end: ('F', 3) }; | |
let next_state = { | |
let mut next_state = chess_state.clone(); | |
next_state.apply_move(player_move); | |
next_state | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment