This repository has been archived by the owner on Oct 8, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: zobrist hashing is used to detect repetitions
- Loading branch information
1 parent
3f1ea37
commit bb96270
Showing
5 changed files
with
90 additions
and
67 deletions.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,27 @@ | ||
use brogle_core::*; | ||
|
||
/// All contents of this file should be ignored. I just use this `main` to test small things in `brogle_core`. | ||
fn main() { | ||
// let fen = "r3k2r/p1ppqpb1/bn2pnp1/3PN3/1p2P3/2N4Q/PPPBBPPP/R3K2R b KQkq - 0 1"; // e8g8 is legal | ||
// let fen = "r3k2r/p1pNqpb1/bn2pnp1/3P4/1p2P3/2N2Q1p/PPPBBPPP/R3K2R b KQkq - 0 1"; // e8c8 is legal | ||
let fen = "r3k2r/p1ppqpb1/bn2pnp1/3PN3/1p2P3/5Q1p/PPPBBPPP/RN2K2R w KQkq - 0 1"; // e1c1 is NOT legal | ||
let game = Game::from_fen(fen).unwrap(); | ||
|
||
for mv in game.legal_moves() { | ||
if mv.from() == Tile::E1 { | ||
println!("{mv}"); | ||
} | ||
} | ||
|
||
/* | ||
let mut game = Game::default(); | ||
println!("pos: {}\nkey: {}", game.position(), game.key()); | ||
game.make_move(Move::from_uci(&game, "b1a3").unwrap()); | ||
println!("pos: {}\nkey: {}", game.position(), game.zobrist_key()); | ||
println!("pos: {}\nkey: {}", game.position(), game.key()); | ||
game.make_move(Move::from_uci(&game, "b8a6").unwrap()); | ||
println!("pos: {}\nkey: {}", game.position(), game.zobrist_key()); | ||
println!("pos: {}\nkey: {}", game.position(), game.key()); | ||
game.make_move(Move::from_uci(&game, "a3b1").unwrap()); | ||
println!("pos: {}\nkey: {}", game.position(), game.zobrist_key()); | ||
println!("pos: {}\nkey: {}", game.position(), game.key()); | ||
game.make_move(Move::from_uci(&game, "a6b8").unwrap()); | ||
println!("pos: {}\nkey: {}", game.position(), game.zobrist_key()); | ||
println!("pos: {}\nkey: {}", game.position(), game.key()); | ||
*/ | ||
|
||
let mut game = Game::default(); | ||
game.make_move(Move::from_uci(&game, "b1a3").unwrap()); | ||
println!("repetition? {}", game.is_repetition()); | ||
game.make_move(Move::from_uci(&game, "b8a6").unwrap()); | ||
println!("repetition? {}", game.is_repetition()); | ||
game.make_move(Move::from_uci(&game, "a3b1").unwrap()); | ||
println!("repetition? {}", game.is_repetition()); | ||
game.make_move(Move::from_uci(&game, "a6b8").unwrap()); | ||
println!("repetition? {}", game.is_repetition()); | ||
} |
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
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
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