From 9209f1c4e010b4c052738bed7c613de73dfda245 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Varga=20D=C3=A1vid=20Lajos?= Date: Tue, 18 Nov 2025 12:14:22 +0100 Subject: [PATCH 01/24] implemented method check_test in bitboard::checktest.rs --- engine/src/bitboard/legality.rs | 48 +++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) diff --git a/engine/src/bitboard/legality.rs b/engine/src/bitboard/legality.rs index 7d12e57..64c8601 100644 --- a/engine/src/bitboard/legality.rs +++ b/engine/src/bitboard/legality.rs @@ -1,8 +1,56 @@ use super::board::Board; use super::attackmaps::RAY_TABLE; +use super::checkinfo::CheckInfo; +use super::attacks::get_raycast_from_square_in_direction; impl Board { + pub fn check_test(&self) -> CheckInfo { + let mut check_info: CheckInfo = CheckInfo::new(); + let offset: usize = 6 * self.side_to_move as usize; + let king: u64 = self.bitboards[5 + offset]; + let king_sq = king.trailing_zeros() as usize; + let occupancy = self.occupancy[2]; + + // queen-rook checks (+) + let attacker_mask = self.bitboards[10 - offset] | self.bitboards[9 - offset]; + + for dir in [0, 2, 4, 6] { + let threat_mask: u64 = get_raycast_from_square_in_direction(occupancy, king_sq, dir); + if threat_mask & attacker_mask != 0 { + check_info.add_checker(threat_mask); + } + } + + // queen-bishop checks (x) + let attacker_mask = self.bitboards[10 - offset] | self.bitboards[8 - offset]; + + for dir in [1, 3, 5, 7] { + let threat_mask = get_raycast_from_square_in_direction(occupancy, king_sq, dir); + if threat_mask & attacker_mask != 0 { + check_info.add_checker(threat_mask); + } + } + + // knight checks (L) + let attacker_mask = self.bitboards[7 - offset]; + let threat_mask = self.get_pseudo_knight_moves(king_sq as u32); + let checker = threat_mask & attacker_mask; + if checker != 0 { + check_info.add_checker(checker); + } + + // pawn checks (v) + let attacker_mask = self.bitboards[6 - offset]; + let threat_mask = self.get_pseudo_pawn_captures(king_sq as u32); + let checker = threat_mask & attacker_mask; + if checker != 0 { + check_info.add_checker(checker); + } + + return check_info; + } + pub(in super) fn calc_pinned_squares(&mut self) { self.pinned_squares = [4; 64]; self.pin_mask = 0u64; From 1a9d7ad46022e7a84c9dad11f8939b78f18c827f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Varga=20D=C3=A1vid=20Lajos?= Date: Tue, 18 Nov 2025 16:15:28 +0100 Subject: [PATCH 02/24] added tests for method bitboard::legality::check_test --- engine/src/bitboard/legality.rs | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/engine/src/bitboard/legality.rs b/engine/src/bitboard/legality.rs index 64c8601..2243bd3 100644 --- a/engine/src/bitboard/legality.rs +++ b/engine/src/bitboard/legality.rs @@ -93,4 +93,35 @@ impl Board { } } +} + +// <----- TESTS -----> + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn check_test_test() { + + let fens = [ + "rnb1k1nr/pppppppp/4q3/8/1b6/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1", // no check + "rnb1k1nr/pppppppp/4q3/8/1b1P4/8/PPP1PPPP/RNBQKBNR b KQkq d3 0 1", // single check + "rnb1k1nr/ppp1p2p/3pq1p1/8/1b1P1P2/8/PPP2PPP/RNBQKBNR w KQkq - 0 1" // double check + ]; + let expected_results = [ + CheckInfo { check_count: 0, move_mask: 0xFFFF_FFFF_FFFF_FFFF }, + CheckInfo { check_count: 1, move_mask: 0x0000_0000_0204_0800 }, + CheckInfo { check_count: 2, move_mask: 0x0000_0000_0000_0000 } + ]; + + for test_nr in 0..3 { + let fen = fens[test_nr]; + let board = Board::build(fen); + let check_test_actual = board.check_test(); + assert_eq!(check_test_actual.check_count, expected_results[test_nr].check_count); + assert_eq!(check_test_actual.move_mask, expected_results[test_nr].move_mask); + } + + } } \ No newline at end of file From 6e0efc76f3b4fc1170e12dcdd63da016e074d0ec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Varga=20D=C3=A1vid=20Lajos?= Date: Tue, 18 Nov 2025 16:18:19 +0100 Subject: [PATCH 03/24] added missing method place_piece to struct bitboard::Board --- engine/src/bitboard/board.rs | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/engine/src/bitboard/board.rs b/engine/src/bitboard/board.rs index 11a85ce..483f1c4 100644 --- a/engine/src/bitboard/board.rs +++ b/engine/src/bitboard/board.rs @@ -64,7 +64,7 @@ impl Board { for (i, c) in coming_up.chars().enumerate() { if pieces.contains(&c) { - // board.place_piece(row*8 + col, c); + board.place_piece(row*8 + col, c); col += 1; } else if ('1'..='8').contains(&c) { @@ -179,4 +179,21 @@ impl Board { } } + pub fn place_piece(&mut self, sq: i32, piece: char) { + match piece { + 'p' => {self.bitboards[6] |= 1 << sq} + 'n' => {self.bitboards[7] |= 1 << sq} + 'b' => {self.bitboards[8] |= 1 << sq} + 'r' => {self.bitboards[9] |= 1 << sq} + 'q' => {self.bitboards[10] |= 1 << sq} + 'k' => {self.bitboards[11] |= 1 << sq} + 'P' => {self.bitboards[0] |= 1 << sq} + 'N' => {self.bitboards[1] |= 1 << sq} + 'B' => {self.bitboards[2] |= 1 << sq} + 'R' => {self.bitboards[3] |= 1 << sq} + 'Q' => {self.bitboards[4] |= 1 << sq} + 'K' => {self.bitboards[5] |= 1 << sq} + _ => () + } + } } \ No newline at end of file From 7e64a7ca16dd0e962430782802aaeb76fabf1f10 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Varga=20D=C3=A1vid=20Lajos?= Date: Tue, 18 Nov 2025 16:20:42 +0100 Subject: [PATCH 04/24] fixed incorrect test parameter in bitboard::legality::tests::check_test_test --- engine/src/bitboard/legality.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/engine/src/bitboard/legality.rs b/engine/src/bitboard/legality.rs index 2243bd3..f42fdc1 100644 --- a/engine/src/bitboard/legality.rs +++ b/engine/src/bitboard/legality.rs @@ -106,7 +106,7 @@ mod tests { let fens = [ "rnb1k1nr/pppppppp/4q3/8/1b6/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1", // no check - "rnb1k1nr/pppppppp/4q3/8/1b1P4/8/PPP1PPPP/RNBQKBNR b KQkq d3 0 1", // single check + "rnb1k1nr/pppppppp/4q3/8/1b1P4/8/PPP1PPPP/RNBQKBNR w KQkq d3 0 1", // single check "rnb1k1nr/ppp1p2p/3pq1p1/8/1b1P1P2/8/PPP2PPP/RNBQKBNR w KQkq - 0 1" // double check ]; let expected_results = [ From 887b9abed899f141c3ec891e21de67130700101b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Varga=20D=C3=A1vid=20Lajos?= Date: Tue, 18 Nov 2025 17:02:07 +0100 Subject: [PATCH 05/24] adde file and module structure for bitboard::bitmove.rs --- engine/src/bitboard.rs | 1 + engine/src/bitboard/bitmove.rs | 0 2 files changed, 1 insertion(+) create mode 100644 engine/src/bitboard/bitmove.rs diff --git a/engine/src/bitboard.rs b/engine/src/bitboard.rs index 504ae04..405141f 100644 --- a/engine/src/bitboard.rs +++ b/engine/src/bitboard.rs @@ -3,5 +3,6 @@ mod utils; mod legality; mod checkinfo; mod attacks; +mod bitmove; pub mod board; \ No newline at end of file diff --git a/engine/src/bitboard/bitmove.rs b/engine/src/bitboard/bitmove.rs new file mode 100644 index 0000000..e69de29 From 57af3aaae346bd0893b0866247e3fa09297a7803 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Varga=20D=C3=A1vid=20Lajos?= Date: Tue, 18 Nov 2025 17:09:39 +0100 Subject: [PATCH 06/24] defined shape of struct bitboard::bitmove::BitMove --- engine/src/bitboard/bitmove.rs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/engine/src/bitboard/bitmove.rs b/engine/src/bitboard/bitmove.rs index e69de29..4b0bb17 100644 --- a/engine/src/bitboard/bitmove.rs +++ b/engine/src/bitboard/bitmove.rs @@ -0,0 +1,8 @@ + +pub struct BitMove { + + pub move_type: u8, + pub from_square: u8, + pub to_square: u8, + pub promotion_piece: Option +} \ No newline at end of file From c420d8b3dd54bf98b64076abc9d201da40d7cef4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Varga=20D=C3=A1vid=20Lajos?= Date: Tue, 18 Nov 2025 17:17:11 +0100 Subject: [PATCH 07/24] added constructor for quiet moves in bitboard::bitmove.rs --- engine/src/bitboard/bitmove.rs | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/engine/src/bitboard/bitmove.rs b/engine/src/bitboard/bitmove.rs index 4b0bb17..11510f9 100644 --- a/engine/src/bitboard/bitmove.rs +++ b/engine/src/bitboard/bitmove.rs @@ -5,4 +5,17 @@ pub struct BitMove { pub from_square: u8, pub to_square: u8, pub promotion_piece: Option +} + +impl BitMove { + + #[inline] + pub fn quiet(from: u8, to: u8, promotion_piece: Option) -> Self { + return Self { + move_type: 0, + from_square: from, + to_square: to, + promotion_piece: promotion_piece + }; + } } \ No newline at end of file From d8da8085804b175cdfbe7bdfe3b6f454ef193bb9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Varga=20D=C3=A1vid=20Lajos?= Date: Tue, 18 Nov 2025 17:19:31 +0100 Subject: [PATCH 08/24] added enum BitMoveType to bitboard::bitmove.rs for readability --- engine/src/bitboard/bitmove.rs | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/engine/src/bitboard/bitmove.rs b/engine/src/bitboard/bitmove.rs index 11510f9..59f9dce 100644 --- a/engine/src/bitboard/bitmove.rs +++ b/engine/src/bitboard/bitmove.rs @@ -1,7 +1,7 @@ pub struct BitMove { - pub move_type: u8, + pub move_type: BitMoveType, pub from_square: u8, pub to_square: u8, pub promotion_piece: Option @@ -12,10 +12,17 @@ impl BitMove { #[inline] pub fn quiet(from: u8, to: u8, promotion_piece: Option) -> Self { return Self { - move_type: 0, + move_type: BitMoveType::Quiet, from_square: from, to_square: to, promotion_piece: promotion_piece }; } +} + +pub enum BitMoveType { + Quiet, + Capture, + Castle, + En_Passant } \ No newline at end of file From 05294a77364ad3dc9b7853a11d8953e7e5b17976 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Varga=20D=C3=A1vid=20Lajos?= Date: Tue, 18 Nov 2025 17:20:40 +0100 Subject: [PATCH 09/24] changed name of value of enum BitMoveType to align with Rust naming conventions --- engine/src/bitboard/bitmove.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/engine/src/bitboard/bitmove.rs b/engine/src/bitboard/bitmove.rs index 59f9dce..4ba2555 100644 --- a/engine/src/bitboard/bitmove.rs +++ b/engine/src/bitboard/bitmove.rs @@ -24,5 +24,5 @@ pub enum BitMoveType { Quiet, Capture, Castle, - En_Passant + EnPassant } \ No newline at end of file From 7b9c1edbabc499e817c11b8c7a9fd3023f643e85 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Varga=20D=C3=A1vid=20Lajos?= Date: Tue, 18 Nov 2025 17:23:07 +0100 Subject: [PATCH 10/24] added constructor for capture moves in bitboard::bitmove.rs --- engine/src/bitboard/bitmove.rs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/engine/src/bitboard/bitmove.rs b/engine/src/bitboard/bitmove.rs index 4ba2555..7afee71 100644 --- a/engine/src/bitboard/bitmove.rs +++ b/engine/src/bitboard/bitmove.rs @@ -18,6 +18,15 @@ impl BitMove { promotion_piece: promotion_piece }; } + #[inline] + pub fn capture(from: u8, to: u8, promotion_piece: Option) -> Self { + return Self { + move_type: BitMoveType::Capture, + from_square: from, + to_square: to, + promotion_piece: promotion_piece + }; + } } pub enum BitMoveType { From e1f4ae717e841c45a451c34c204397ad3c629727 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Varga=20D=C3=A1vid=20Lajos?= Date: Tue, 18 Nov 2025 17:24:11 +0100 Subject: [PATCH 11/24] added constructor for castling moves in bitboard::bitmove.rs --- engine/src/bitboard/bitmove.rs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/engine/src/bitboard/bitmove.rs b/engine/src/bitboard/bitmove.rs index 7afee71..4eff425 100644 --- a/engine/src/bitboard/bitmove.rs +++ b/engine/src/bitboard/bitmove.rs @@ -27,6 +27,15 @@ impl BitMove { promotion_piece: promotion_piece }; } + #[inline] + pub fn castle(from: u8, to: u8) -> Self { + return Self { + move_type: BitMoveType::Castle, + from_square: from, + to_square: to, + promotion_piece: None + }; + } } pub enum BitMoveType { From fd0d26486b5830e8609650e2e6fbe94e84e20874 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Varga=20D=C3=A1vid=20Lajos?= Date: Tue, 18 Nov 2025 17:30:04 +0100 Subject: [PATCH 12/24] switched from public fields to getters for struct BitMove --- engine/src/bitboard/bitmove.rs | 27 +++++++++++++++++++++++---- 1 file changed, 23 insertions(+), 4 deletions(-) diff --git a/engine/src/bitboard/bitmove.rs b/engine/src/bitboard/bitmove.rs index 4eff425..0ec351b 100644 --- a/engine/src/bitboard/bitmove.rs +++ b/engine/src/bitboard/bitmove.rs @@ -1,10 +1,11 @@ +#[derive(Copy, Clone, PartialEq, Eq)] pub struct BitMove { - pub move_type: BitMoveType, - pub from_square: u8, - pub to_square: u8, - pub promotion_piece: Option + move_type: BitMoveType, + from_square: u8, + to_square: u8, + promotion_piece: Option } impl BitMove { @@ -36,8 +37,26 @@ impl BitMove { promotion_piece: None }; } + + #[inline(always)] + pub fn move_type(&self) -> BitMoveType { + return self.move_type; + } + #[inline(always)] + pub fn from_square(&self) -> u8 { + return self.from_square; + } + #[inline(always)] + pub fn to_square(&self) -> u8 { + return self.to_square; + } + #[inline(always)] + pub fn promotion_piece(&self) -> Option { + return self.promotion_piece; + } } +#[derive(Copy, Clone, PartialEq, Eq)] pub enum BitMoveType { Quiet, Capture, From db333a693f2905dd41b614f0a65fc91379b4a6c2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Varga=20D=C3=A1vid=20Lajos?= Date: Tue, 18 Nov 2025 17:38:48 +0100 Subject: [PATCH 13/24] added method uci_notation to struct BitMove --- engine/src/bitboard/bitmove.rs | 12 ++++++++++++ engine/src/bitboard/utils.rs | 5 +++++ 2 files changed, 17 insertions(+) diff --git a/engine/src/bitboard/bitmove.rs b/engine/src/bitboard/bitmove.rs index 0ec351b..86c5b44 100644 --- a/engine/src/bitboard/bitmove.rs +++ b/engine/src/bitboard/bitmove.rs @@ -1,3 +1,4 @@ +use super::utils::*; #[derive(Copy, Clone, PartialEq, Eq)] pub struct BitMove { @@ -54,6 +55,17 @@ impl BitMove { pub fn promotion_piece(&self) -> Option { return self.promotion_piece; } + + pub fn uci_notation(&self) -> String { + let mut notation = notation_from_square_number(self.from_square()); + notation.push_str(¬ation_from_square_number(self.to_square())); + + if let Some(promotion_piece) = self.promotion_piece { + notation.push(get_character_by_piece_id(promotion_piece).to_ascii_lowercase()); + } + + return notation; + } } #[derive(Copy, Clone, PartialEq, Eq)] diff --git a/engine/src/bitboard/utils.rs b/engine/src/bitboard/utils.rs index 25d7ba8..f7f83fe 100644 --- a/engine/src/bitboard/utils.rs +++ b/engine/src/bitboard/utils.rs @@ -48,6 +48,11 @@ pub fn try_get_square_number_from_notation(notation: &str) -> Result { } } +const PIECE_CHARACTERS: [char; 12] = ['P', 'N', 'B', 'R', 'Q', 'K', 'p', 'n', 'b', 'r', 'q', 'k']; +pub fn get_character_by_piece_id(id: u8) -> char { + return PIECE_CHARACTERS[id as usize]; +} + // <----- TESTS -----> From b76a009e4e69652518fe54b41e1ec9b79e5796a1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Varga=20D=C3=A1vid=20Lajos?= Date: Wed, 19 Nov 2025 14:57:36 +0100 Subject: [PATCH 14/24] added file and module structure for movebuffer.rs --- engine/src/bitboard.rs | 1 + engine/src/bitboard/movebuffer.rs | 0 2 files changed, 1 insertion(+) create mode 100644 engine/src/bitboard/movebuffer.rs diff --git a/engine/src/bitboard.rs b/engine/src/bitboard.rs index 405141f..1486484 100644 --- a/engine/src/bitboard.rs +++ b/engine/src/bitboard.rs @@ -4,5 +4,6 @@ mod legality; mod checkinfo; mod attacks; mod bitmove; +mod movebuffer; pub mod board; \ No newline at end of file diff --git a/engine/src/bitboard/movebuffer.rs b/engine/src/bitboard/movebuffer.rs new file mode 100644 index 0000000..e69de29 From a60658763dc36f4fbedb3fd1a8e4375da0768f05 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Varga=20D=C3=A1vid=20Lajos?= Date: Wed, 19 Nov 2025 15:06:37 +0100 Subject: [PATCH 15/24] defined shape of struct MoveBuffer --- engine/src/bitboard/movebuffer.rs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/engine/src/bitboard/movebuffer.rs b/engine/src/bitboard/movebuffer.rs index e69de29..4fb78ca 100644 --- a/engine/src/bitboard/movebuffer.rs +++ b/engine/src/bitboard/movebuffer.rs @@ -0,0 +1,7 @@ +use super::bitmove::BitMove; + +pub struct MoveBuffer { + + buffer: [BitMove; 256], + count: usize +} \ No newline at end of file From 85a7fa37ef47b141e0d13b56e9c096a8332e4e03 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Varga=20D=C3=A1vid=20Lajos?= Date: Wed, 19 Nov 2025 15:22:15 +0100 Subject: [PATCH 16/24] added parameterless constructor for struct MoveBuffer --- engine/src/bitboard/movebuffer.rs | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/engine/src/bitboard/movebuffer.rs b/engine/src/bitboard/movebuffer.rs index 4fb78ca..00b5dda 100644 --- a/engine/src/bitboard/movebuffer.rs +++ b/engine/src/bitboard/movebuffer.rs @@ -4,4 +4,14 @@ pub struct MoveBuffer { buffer: [BitMove; 256], count: usize +} + +impl MoveBuffer { + + pub fn new() -> Self { + return Self { + buffer: [BitMove::quiet(0, 0, None); 256], + count: 0 + }; + } } \ No newline at end of file From dc176c103b5c6c21a73425a9ed0b43a848ac0405 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Varga=20D=C3=A1vid=20Lajos?= Date: Wed, 19 Nov 2025 15:40:11 +0100 Subject: [PATCH 17/24] implemented method add for struct MoveBuffer --- engine/src/bitboard/movebuffer.rs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/engine/src/bitboard/movebuffer.rs b/engine/src/bitboard/movebuffer.rs index 00b5dda..b21a45b 100644 --- a/engine/src/bitboard/movebuffer.rs +++ b/engine/src/bitboard/movebuffer.rs @@ -14,4 +14,9 @@ impl MoveBuffer { count: 0 }; } + #[inline] + pub fn add(&mut self, bitmove: BitMove) { + self.buffer[self.count] = bitmove; + self.count += 1; + } } \ No newline at end of file From 4e7ac2a19527db8370dfc44b8de45090081a46e3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Varga=20D=C3=A1vid=20Lajos?= Date: Wed, 19 Nov 2025 15:50:03 +0100 Subject: [PATCH 18/24] added getter for field count in struct MoveBuffer --- engine/src/bitboard/movebuffer.rs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/engine/src/bitboard/movebuffer.rs b/engine/src/bitboard/movebuffer.rs index b21a45b..7b2c2cb 100644 --- a/engine/src/bitboard/movebuffer.rs +++ b/engine/src/bitboard/movebuffer.rs @@ -14,9 +14,14 @@ impl MoveBuffer { count: 0 }; } + #[inline] pub fn add(&mut self, bitmove: BitMove) { self.buffer[self.count] = bitmove; self.count += 1; } + #[inline(always)] + pub fn count(&self) -> usize{ + return self.count; + } } \ No newline at end of file From f64ebfa47f5f42a602e991536fd161a87cc3c406 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Varga=20D=C3=A1vid=20Lajos?= Date: Wed, 19 Nov 2025 15:53:39 +0100 Subject: [PATCH 19/24] implemented method get for struct MoveBuffer --- engine/src/bitboard/movebuffer.rs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/engine/src/bitboard/movebuffer.rs b/engine/src/bitboard/movebuffer.rs index 7b2c2cb..b0da949 100644 --- a/engine/src/bitboard/movebuffer.rs +++ b/engine/src/bitboard/movebuffer.rs @@ -24,4 +24,8 @@ impl MoveBuffer { pub fn count(&self) -> usize{ return self.count; } + #[inline(always)] + pub fn get(&self, idx: usize) -> &BitMove { + return &self.buffer[idx]; + } } \ No newline at end of file From 5340744abec33c5575eee7d389f04c7ac4304604 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Varga=20D=C3=A1vid=20Lajos?= Date: Wed, 19 Nov 2025 15:56:57 +0100 Subject: [PATCH 20/24] implemented method clear for struct MoveBuffer --- engine/src/bitboard/movebuffer.rs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/engine/src/bitboard/movebuffer.rs b/engine/src/bitboard/movebuffer.rs index b0da949..20aac6b 100644 --- a/engine/src/bitboard/movebuffer.rs +++ b/engine/src/bitboard/movebuffer.rs @@ -20,6 +20,10 @@ impl MoveBuffer { self.buffer[self.count] = bitmove; self.count += 1; } + #[inline] + pub fn clear(&mut self) { + self.count = 0; + } #[inline(always)] pub fn count(&self) -> usize{ return self.count; From 547b0e51cbf3827bbe59670e5f772083e8d326d0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Varga=20D=C3=A1vid=20Lajos?= Date: Wed, 19 Nov 2025 16:00:09 +0100 Subject: [PATCH 21/24] corrected annotation for method clear in struct MoveBuffer --- engine/src/bitboard/movebuffer.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/engine/src/bitboard/movebuffer.rs b/engine/src/bitboard/movebuffer.rs index 20aac6b..2f92f9e 100644 --- a/engine/src/bitboard/movebuffer.rs +++ b/engine/src/bitboard/movebuffer.rs @@ -20,7 +20,7 @@ impl MoveBuffer { self.buffer[self.count] = bitmove; self.count += 1; } - #[inline] + #[inline(always)] pub fn clear(&mut self) { self.count = 0; } From f417a7e47c72849df9f10151dde7d62fd13d8947 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Varga=20D=C3=A1vid=20Lajos?= Date: Wed, 19 Nov 2025 16:09:31 +0100 Subject: [PATCH 22/24] implemented getter for field buffer i struct MoveBuffer --- engine/src/bitboard/movebuffer.rs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/engine/src/bitboard/movebuffer.rs b/engine/src/bitboard/movebuffer.rs index 2f92f9e..8c463cf 100644 --- a/engine/src/bitboard/movebuffer.rs +++ b/engine/src/bitboard/movebuffer.rs @@ -32,4 +32,8 @@ impl MoveBuffer { pub fn get(&self, idx: usize) -> &BitMove { return &self.buffer[idx]; } + #[inline(always)] + pub fn contents(&self) -> &[BitMove] { + return &self.buffer[0..self.count]; + } } \ No newline at end of file From f39c113ef9e3768220d2e30453b42ee68cf8a429 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Varga=20D=C3=A1vid=20Lajos?= Date: Wed, 19 Nov 2025 16:13:34 +0100 Subject: [PATCH 23/24] implemented method append for struct MoveBuffer --- engine/src/bitboard/movebuffer.rs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/engine/src/bitboard/movebuffer.rs b/engine/src/bitboard/movebuffer.rs index 8c463cf..61a7844 100644 --- a/engine/src/bitboard/movebuffer.rs +++ b/engine/src/bitboard/movebuffer.rs @@ -20,6 +20,11 @@ impl MoveBuffer { self.buffer[self.count] = bitmove; self.count += 1; } + #[inline] + pub fn append(&mut self, other: &MoveBuffer) { + self.buffer[self.count..self.count + other.count()].copy_from_slice(other.contents()); + self.count += other.count(); + } #[inline(always)] pub fn clear(&mut self) { self.count = 0; From 1c1b9a96d9128da27120c1aa69fe099a724ef853 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hatvani=20Tam=C3=A1s?= <75033623+htamas1210@users.noreply.github.com> Date: Wed, 19 Nov 2025 17:34:44 +0100 Subject: [PATCH 24/24] Import time module and add sleep in data upload Added time.sleep to control row insertion rate. --- .github/workflows/upload_data.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/upload_data.yml b/.github/workflows/upload_data.yml index c0ab435..ca88108 100644 --- a/.github/workflows/upload_data.yml +++ b/.github/workflows/upload_data.yml @@ -20,7 +20,7 @@ jobs: echo "$GOOGLE_SERVICE_ACCOUNT_JSON" > service_account.json python <<'PYCODE' - import gspread, json, subprocess + import gspread, json, subprocess, time creds = json.load(open("service_account.json")) gc = gspread.service_account_from_dict(creds) @@ -38,6 +38,7 @@ jobs: for i, row in enumerate(rows_to_append): worksheet.insert_row(row, start_row + i) + time.sleep(1) with open(f"{v}/test_data.log", "r") as f: