From b278ed12e871c4ae42e788eabc0f7a3a88525cd9 Mon Sep 17 00:00:00 2001 From: raj-open Date: Fri, 5 Sep 2025 11:20:27 +0100 Subject: [PATCH 01/41] story-gs > staging: added self-add/mult --- .../games/genius_square/models/arrays/models.rs | 14 ++++++++++++++ .../games/genius_square/models/pieces/models.rs | 14 ++++++++++++++ 2 files changed, 28 insertions(+) diff --git a/src/bin/games/genius_square/models/arrays/models.rs b/src/bin/games/genius_square/models/arrays/models.rs index 1208bec..4fb46f6 100644 --- a/src/bin/games/genius_square/models/arrays/models.rs +++ b/src/bin/games/genius_square/models/arrays/models.rs @@ -9,7 +9,9 @@ use std::fmt::Display; use std::fmt::Formatter; use std::fmt::Result; use std::ops::Add; +use std::ops::AddAssign; use std::ops::Mul; +use std::ops::MulAssign; use itertools::iproduct; use itertools::Itertools; @@ -286,6 +288,12 @@ impl Add for BinArray { } } +impl AddAssign for BinArray { + fn add_assign(&mut self, other: Self) { + *self = self.to_owned() + other; + } +} + impl Mul for BinArray { type Output = Self; @@ -296,3 +304,9 @@ impl Mul for BinArray { return Self {m, n, values}; } } + +impl MulAssign for BinArray { + fn mul_assign(&mut self, other: Self) { + *self = self.to_owned() * other; + } +} diff --git a/src/bin/games/genius_square/models/pieces/models.rs b/src/bin/games/genius_square/models/pieces/models.rs index a0deed6..1674e94 100644 --- a/src/bin/games/genius_square/models/pieces/models.rs +++ b/src/bin/games/genius_square/models/pieces/models.rs @@ -7,7 +7,9 @@ use std::fmt::Display; use std::fmt::Formatter; use std::fmt::Result; use std::ops::Add; +use std::ops::AddAssign; use std::ops::Mul; +use std::ops::MulAssign; use crate::models::arrays::models::BinArray; use crate::models::constants::board::*; @@ -177,6 +179,12 @@ impl Add for Piece { } } +impl AddAssign for Piece { + fn add_assign(&mut self, other: Self) { + *self = self.to_owned() + other; + } +} + impl Mul for Piece { type Output = Self; @@ -186,3 +194,9 @@ impl Mul for Piece { return Self {kind, positions}; } } + +impl MulAssign for Piece { + fn mul_assign(&mut self, other: Self) { + *self = self.to_owned() * other; + } +} From 8d49b183fca2db89b59cd9abf88bb7ac71b125f7 Mon Sep 17 00:00:00 2001 From: raj-open Date: Fri, 5 Sep 2025 11:24:44 +0100 Subject: [PATCH 02/41] story-gs > staging: added dynamic variables for obstacles/dithered obstacles --- .../genius_square/models/board/models.rs | 65 +++++++++++-------- 1 file changed, 37 insertions(+), 28 deletions(-) diff --git a/src/bin/games/genius_square/models/board/models.rs b/src/bin/games/genius_square/models/board/models.rs index c0cc9e1..115af43 100644 --- a/src/bin/games/genius_square/models/board/models.rs +++ b/src/bin/games/genius_square/models/board/models.rs @@ -22,6 +22,9 @@ use crate::models::pieces::models::*; pub struct GameBoard { block: Piece, pieces: HashMap, + // for dynamic computations + obstacle_basic: Piece, + obstacle_dithered: Piece, } /// ---------------------------------------------------------------- @@ -31,7 +34,10 @@ pub struct GameBoard { impl GameBoard { pub fn new(block: &Piece) -> Self { let pieces: HashMap = HashMap::new(); - return Self {block: block.clone(), pieces} + let block = block.clone(); + let obstacle_basic = block.clone(); + let obstacle_dithered = block.clone(); + return Self {block, obstacle_basic, obstacle_dithered, pieces} } #[allow(unused)] @@ -48,6 +54,34 @@ impl GameBoard { &self.block } + pub fn get_obstacle(&self) -> &Piece { + &self.obstacle_basic + } + + #[allow(unused)] + pub fn get_obstacle_weight(&self) -> isize { + self.obstacle_basic.get_weight() + } + + pub fn get_obstacle_coweight(&self) -> isize { + self.obstacle_basic.get_coweight() + } + + pub fn initialise_obstacle(&mut self) { + self.obstacle_basic = self.block.to_owned(); + self.obstacle_dithered = self.block.to_owned(); + } + + pub fn update_obstacle(&mut self, piece: &Piece) { + let symb = piece.get_kind(); + self.obstacle_basic += piece.to_owned(); + if NON_ADJACENT.contains(&symb) { + self.obstacle_dithered += piece.transform_dither().to_owned(); + } else { + self.obstacle_dithered += piece.to_owned(); + } + } + pub fn to_string(&self) -> String { let field = self.to_array_of_strings(false); let text = Self::array_to_string(&field); @@ -153,39 +187,14 @@ impl GameBoard { pub fn get_configurations( &self, piece: &Piece, - obst: &Piece, ) -> impl Iterator { let mut used: Vec = vec![]; + let obst_positions = self.get_obstacle().get_positions(); let it = piece // convert to positions .get_positions() // get all possible orientations + shifts which do not collide with obstacle - .get_configurations(Some(obst.get_positions())) - // skip all moves which lead to forbidden adjacent pieces - .filter(|pos| { - // only need to check for collisions of pieces of a paritcular kind - let kind = piece.get_kind(); - if !(NON_ADJACENT.contains(&kind)) { - return true; - } - let pos_dither = pos.transform_dither(); - for (s, q) in self.pieces.iter() { - // only need to check for collisions of pieces of a paritcular kind - if !(NON_ADJACENT.contains(s)) { - continue; - } - if *s == kind { - continue; - } - - let collision = pos_dither.to_owned() * q.get_positions().to_owned(); - let penalty = -collision.get_weight(); - if penalty < 0 { - return false; - } - } - return true; - }) + .get_configurations(Some(obst_positions)) // convert to piece .map(|pos| { let kind = piece.get_kind(); From 33431f651fb6bed8e0d2e4bb3b73ae81b82e6f26 Mon Sep 17 00:00:00 2001 From: raj-open Date: Fri, 5 Sep 2025 11:26:54 +0100 Subject: [PATCH 03/41] story-gs > staging: refactored algorithm to use dynamic variables Also by switching between the obstacle and the dithered, we avoid dupicate computations --- .../games/genius_square/algorithms/solve.rs | 20 +++++++++---------- .../genius_square/features/setup_game.rs | 2 +- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/src/bin/games/genius_square/algorithms/solve.rs b/src/bin/games/genius_square/algorithms/solve.rs index 89e6eae..2d2180d 100644 --- a/src/bin/games/genius_square/algorithms/solve.rs +++ b/src/bin/games/genius_square/algorithms/solve.rs @@ -16,10 +16,10 @@ use crate::models::board::models::GameBoard; /// Recursively solves by check all possibilities pub fn solve_brute_force( - board: &GameBoard, + board: &mut GameBoard, ) -> GameBoard { - let obst = board.get_block().to_owned(); - match recursion(board, &obst, None, None) { + board.initialise_obstacle(); + match recursion(board, None, None) { Some(board_) => { return board_; }, @@ -35,7 +35,6 @@ pub fn solve_brute_force( fn recursion( board: &GameBoard, - obst: &Piece, option_kinds: Option<&[EnumPiece]>, option_pbar: Option<&ProgressBar>, ) -> Option { @@ -57,7 +56,7 @@ fn recursion( if n == 0 { // if nothing left to solve, then return pieces, provide everything is filled - if obst.get_coweight() == 0 { + if board.get_obstacle_coweight() == 0 { pbar.finish_and_clear(); println!("...completed in {:.2?}", pbar.elapsed()); return Some(board.to_owned()); @@ -67,17 +66,18 @@ fn recursion( let kind = &kinds[0].clone(); let kinds = &kinds[1..]; let piece0 = Piece::from_kind(kind, None); // initialised piece - for piece in board.get_configurations(&piece0, &obst) { + for piece in board.get_configurations(&piece0) { pbar.inc(1); - // update the obstacle - let obst_ = obst.clone() + piece.clone(); + let mut board_ = board.clone(); // update the solution - let mut board_ = board.clone(); board_.add_piece(&kind.clone(), &piece); + // update the obstacle + board_.update_obstacle(&piece); + // compute remainder of solution recursively - match recursion(&mut board_, &obst_, Some(kinds), Some(&pbar)) { + match recursion(&board_, Some(kinds), Some(&pbar)) { Some(board_) => { return Some(board_); }, diff --git a/src/bin/games/genius_square/features/setup_game.rs b/src/bin/games/genius_square/features/setup_game.rs index d3d85f3..5ebb196 100644 --- a/src/bin/games/genius_square/features/setup_game.rs +++ b/src/bin/games/genius_square/features/setup_game.rs @@ -34,6 +34,6 @@ pub fn feature_setup_game( // Solve the problem println!("\nCompute solution...\n"); - board = solve_brute_force(&board); + board = solve_brute_force(&mut board); println!("\nSolution:\n{}\n", board.pretty()); } From 9fe53b8a6bbda123ab56719b9647282ff67aac85 Mon Sep 17 00:00:00 2001 From: raj-open Date: Fri, 5 Sep 2025 14:16:42 +0100 Subject: [PATCH 04/41] story-gs > staging: added core methods --- src/_core/mod.rs | 1 + src/_core/time.rs | 15 +++++++++++++++ 2 files changed, 16 insertions(+) create mode 100644 src/_core/time.rs diff --git a/src/_core/mod.rs b/src/_core/mod.rs index a715ece..914a732 100644 --- a/src/_core/mod.rs +++ b/src/_core/mod.rs @@ -1,3 +1,4 @@ pub mod errors; pub mod rand; pub mod strings; +pub mod time; diff --git a/src/_core/time.rs b/src/_core/time.rs new file mode 100644 index 0000000..3a1b901 --- /dev/null +++ b/src/_core/time.rs @@ -0,0 +1,15 @@ +/// ---------------------------------------------------------------- +/// IMPORTS +/// ---------------------------------------------------------------- + +use std::thread; +use std::time::Duration; + +/// ---------------------------------------------------------------- +/// METHODS +/// ---------------------------------------------------------------- + +#[allow(unused)] +pub fn sleep_ms(time_ms: u64) { + thread::sleep(Duration::from_millis(time_ms)); +} From f3106fda3976004ca050d2346c7467db801b0435 Mon Sep 17 00:00:00 2001 From: raj-open Date: Fri, 5 Sep 2025 14:17:51 +0100 Subject: [PATCH 05/41] story-gs > staging: refactored to deal with obstacle in GameBoard --- .../games/genius_square/algorithms/solve.rs | 32 +++++----- .../genius_square/features/setup_game.rs | 17 ++++-- .../genius_square/models/arrays/models.rs | 17 ++++-- .../genius_square/models/board/models.rs | 60 +++++++++---------- 4 files changed, 68 insertions(+), 58 deletions(-) diff --git a/src/bin/games/genius_square/algorithms/solve.rs b/src/bin/games/genius_square/algorithms/solve.rs index 2d2180d..d551c7b 100644 --- a/src/bin/games/genius_square/algorithms/solve.rs +++ b/src/bin/games/genius_square/algorithms/solve.rs @@ -4,6 +4,7 @@ use indicatif::ProgressBar; use indicatif::ProgressStyle; +use std::time::Duration; use crate::models::constants::enums::ENUM_PIECES; use crate::models::constants::enums::EnumPiece; @@ -16,17 +17,12 @@ use crate::models::board::models::GameBoard; /// Recursively solves by check all possibilities pub fn solve_brute_force( - board: &mut GameBoard, -) -> GameBoard { + board: &GameBoard, +) -> (Duration, Option) { + let mut board = board.clone(); board.initialise_obstacle(); - match recursion(board, None, None) { - Some(board_) => { - return board_; - }, - None => { - return board.to_owned(); - } - } + let result = recursion(&board, None, None); + return result; } /// ---------------------------------------------------------------- @@ -37,7 +33,7 @@ fn recursion( board: &GameBoard, option_kinds: Option<&[EnumPiece]>, option_pbar: Option<&ProgressBar>, -) -> Option { +) -> (Duration, Option) { let kinds = option_kinds.unwrap_or(ENUM_PIECES); let n = kinds.len() as u64; @@ -58,8 +54,8 @@ fn recursion( // if nothing left to solve, then return pieces, provide everything is filled if board.get_obstacle_coweight() == 0 { pbar.finish_and_clear(); - println!("...completed in {:.2?}", pbar.elapsed()); - return Some(board.to_owned()); + let dt = pbar.elapsed(); + return (dt, Some(board.to_owned())); } } else { // otherwise go through all permissible moves for next piece and then proceed recursively @@ -77,9 +73,10 @@ fn recursion( board_.update_obstacle(&piece); // compute remainder of solution recursively - match recursion(&board_, Some(kinds), Some(&pbar)) { - Some(board_) => { - return Some(board_); + let (dt, result) = recursion(&board_, Some(kinds), Some(&pbar)); + match result { + Some(_) => { + return (dt, result); }, None => { let k = pbar.position(); @@ -89,5 +86,6 @@ fn recursion( } } - return None; + let dt = pbar.elapsed(); + return (dt, None); } diff --git a/src/bin/games/genius_square/features/setup_game.rs b/src/bin/games/genius_square/features/setup_game.rs index 5ebb196..8a3315e 100644 --- a/src/bin/games/genius_square/features/setup_game.rs +++ b/src/bin/games/genius_square/features/setup_game.rs @@ -29,11 +29,20 @@ pub fn feature_setup_game( // Establish the problem let coords = dice.iter().map(|die| die.to_coords()).collect(); let block = Piece::from_coords(coords, Some(EnumPiece::Block)); - let mut board = GameBoard::new(&block); + let board = GameBoard::new(&block); println!("\nProblem:\n{}", board.pretty()); // Solve the problem - println!("\nCompute solution...\n"); - board = solve_brute_force(&mut board); - println!("\nSolution:\n{}\n", board.pretty()); + println!("\nCompute solution ...\n"); + let (dt, result) = solve_brute_force(&board); + match result { + Some(board) => { + println!("... completed in {:.2?}", dt); + println!("\nSolution:\n{}\n", board.pretty()); + }, + None => { + println!("... terminated after {:.2?}", dt); + println!("\n\x1b[91mNo solution found!\x1b[0m\n"); + } + } } diff --git a/src/bin/games/genius_square/models/arrays/models.rs b/src/bin/games/genius_square/models/arrays/models.rs index 4fb46f6..c4d53a0 100644 --- a/src/bin/games/genius_square/models/arrays/models.rs +++ b/src/bin/games/genius_square/models/arrays/models.rs @@ -209,6 +209,8 @@ impl BinArray { let (m, n) = self.get_shape(); let obst = option_obst.map_or_else(|| BinArray::from_coords(vec![], m, n), |x| x.clone()); let free = obst.transform_invert(); + let mut used: Vec = vec![]; + let iterator = iproduct!( [0, 1, -1], [false, true], @@ -227,12 +229,19 @@ impl BinArray { if hflip { arr = arr.transform_hflip(false); } - // NOTE: No longer need this as anchor point will be shifted - // if hflip | vflip | (rot != 0) { - // arr = arr.recentre(); - // } + // recentre for comparison to ensure uniqueness of pieces + if hflip | vflip | (rot != 0) { + arr = arr.recentre(); + } return arr; }) + // skip duplicate orientations + .filter(move |arr| { + let text = arr.to_string(); + let dupl = used.contains(&text); + used.push(text); + return !dupl; + }) // by fixing an anchor point and viewing the non-occupied positions // get all possible shifts of the array .map(move |arr| { diff --git a/src/bin/games/genius_square/models/board/models.rs b/src/bin/games/genius_square/models/board/models.rs index 115af43..3556a76 100644 --- a/src/bin/games/genius_square/models/board/models.rs +++ b/src/bin/games/genius_square/models/board/models.rs @@ -40,7 +40,6 @@ impl GameBoard { return Self {block, obstacle_basic, obstacle_dithered, pieces} } - #[allow(unused)] pub fn add_piece(&mut self, symb: &EnumPiece, piece: &Piece) { self.pieces.insert(symb.clone(), piece.clone()); } @@ -54,34 +53,39 @@ impl GameBoard { &self.block } - pub fn get_obstacle(&self) -> &Piece { - &self.obstacle_basic - } - - #[allow(unused)] - pub fn get_obstacle_weight(&self) -> isize { - self.obstacle_basic.get_weight() - } - - pub fn get_obstacle_coweight(&self) -> isize { - self.obstacle_basic.get_coweight() - } - pub fn initialise_obstacle(&mut self) { self.obstacle_basic = self.block.to_owned(); self.obstacle_dithered = self.block.to_owned(); } + pub fn get_obstacle(&self, kind: &EnumPiece) -> &Piece { + if NON_ADJACENT.contains(&kind) { + &self.obstacle_dithered + } else { + &self.obstacle_basic + } + } + pub fn update_obstacle(&mut self, piece: &Piece) { let symb = piece.get_kind(); self.obstacle_basic += piece.to_owned(); if NON_ADJACENT.contains(&symb) { - self.obstacle_dithered += piece.transform_dither().to_owned(); + let piece_dithered = piece.transform_dither(); + self.obstacle_dithered += piece_dithered; } else { self.obstacle_dithered += piece.to_owned(); } } + #[allow(unused)] + pub fn get_obstacle_weight(&self) -> isize { + self.obstacle_basic.get_weight() + } + + pub fn get_obstacle_coweight(&self) -> isize { + self.obstacle_basic.get_coweight() + } + pub fn to_string(&self) -> String { let field = self.to_array_of_strings(false); let text = Self::array_to_string(&field); @@ -184,29 +188,19 @@ impl GameBoard { /// /// - no collisions occur with already placed pieces (marked by `obst`) /// - the piece is not adjacent to certain other pieces. - pub fn get_configurations( - &self, - piece: &Piece, - ) -> impl Iterator { - let mut used: Vec = vec![]; - let obst_positions = self.get_obstacle().get_positions(); + pub fn get_configurations(&self, piece: &Piece) -> impl Iterator { + // get obstacle in depenence on type of piece + let kind = piece.get_kind(); + let obst = self.get_obstacle(&kind).get_positions(); + + // construct iterator let it = piece // convert to positions .get_positions() // get all possible orientations + shifts which do not collide with obstacle - .get_configurations(Some(obst_positions)) + .get_configurations(Some(obst)) // convert to piece - .map(|pos| { - let kind = piece.get_kind(); - Piece::from_kind(&kind, Some(pos)) - }) - // skip duplicates - .filter(move |p| { - let value = p.to_string(); - let dupl = used.contains(&value); - used.push(value); - return !dupl; - }); + .map(move |pos| Piece::from_kind(&kind, Some(pos))); return it; } } From c1a5551e28eda0f607831637d89d7a0001c6d1e8 Mon Sep 17 00:00:00 2001 From: raj-open Date: Fri, 5 Sep 2025 14:52:54 +0100 Subject: [PATCH 06/41] story-gs > staging: upgrade algorithm to have adaptive sorting --- src/bin/games/genius_square/algorithms/solve.rs | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/bin/games/genius_square/algorithms/solve.rs b/src/bin/games/genius_square/algorithms/solve.rs index d551c7b..65c7b06 100644 --- a/src/bin/games/genius_square/algorithms/solve.rs +++ b/src/bin/games/genius_square/algorithms/solve.rs @@ -4,6 +4,7 @@ use indicatif::ProgressBar; use indicatif::ProgressStyle; +use itertools::Itertools; use std::time::Duration; use crate::models::constants::enums::ENUM_PIECES; @@ -58,6 +59,19 @@ fn recursion( return (dt, Some(board.to_owned())); } } else { + // find the next piece which has the fewest number of next possible moves + let kinds: Vec = kinds.iter() + .map(|kind| { + let piece = Piece::from_kind(kind, None); + let iterator = board.get_configurations(&piece); + let n = iterator.count(); + return (kind, n); + }) + // sort by ascending values of size of possibilities + .sorted_by_key(|&(_, n)| n as isize) + .map(|(kind, _)| kind.clone()) + .collect(); + // otherwise go through all permissible moves for next piece and then proceed recursively let kind = &kinds[0].clone(); let kinds = &kinds[1..]; From 26fdfee4c4f2850aa9af6f811a6064b988494b77 Mon Sep 17 00:00:00 2001 From: raj-open Date: Fri, 5 Sep 2025 14:53:02 +0100 Subject: [PATCH 07/41] story-gs > staging: updated README --- README.md | 37 ++++++++++++++++++++++++------------- 1 file changed, 24 insertions(+), 13 deletions(-) diff --git a/README.md b/README.md index ca3ea8a..1f08859 100644 --- a/README.md +++ b/README.md @@ -143,6 +143,13 @@ The standalone binary can be called as above: ./target/release/GeniusSquare B1 C4 D6 F1 F2 F3 F5 ``` +#### Note on the algorithm #### + +The solver currently relies on a depth-first tree-search algorithm, +with adaptive sorting, i.e. once pieces have been placed, +the order of computation of the remaining pieces +are locally sorted (in ascending order) based on the number of next possible moves. + #### Example #### Calling @@ -154,6 +161,7 @@ just run-rust GeniusSquare B1 C4 D6 F1 F2 F3 F5 results in ```bash + Roll: B1, C4, D6, F1, F2, F3, F5. @@ -174,37 +182,40 @@ Problem: ║ 6 ║ │ │ │ ■ │ │ │ ╙───╨───┴───┴───┴───┴───┴───┘ -Compute solution... +Compute solution ... -...completed in 725.18ms +... completed in 22.44ms Solution: ╔═══╦═══╤═══╤═══╤═══╤═══╤═══╕ ║ ║ A │ B │ C │ D │ E │ F │ ╠═══╬═══╪═══╪═══╪═══╪═══╪═══╡ -║ 1 ║ 1 │ ■ │ 2 │ 2 │ Z │ ■ │ +║ 1 ║ C │ ■ │ X │ X │ 2 │ ■ │ ╠───╬───┼───┼───┼───┼───┼───┤ -║ 2 ║ L │ X │ X │ Z │ Z │ ■ │ +║ 2 ║ C │ C │ X │ X │ 2 │ ■ │ ╠───╬───┼───┼───┼───┼───┼───┤ -║ 3 ║ L │ X │ X │ Z │ T │ ■ │ +║ 3 ║ 4 │ 4 │ 4 │ 4 │ T │ ■ │ ╠───╬───┼───┼───┼───┼───┼───┤ -║ 4 ║ L │ L │ ■ │ T │ T │ T │ +║ 4 ║ L │ 1 │ ■ │ T │ T │ T │ ╠───╬───┼───┼───┼───┼───┼───┤ -║ 5 ║ 4 │ 4 │ 4 │ 4 │ C │ ■ │ +║ 5 ║ L │ L │ L │ Z │ Z │ ■ │ ╠───╬───┼───┼───┼───┼───┼───┤ -║ 6 ║ 3 │ 3 │ 3 │ ■ │ C │ C │ +║ 6 ║ 3 │ 3 │ 3 │ ■ │ Z │ Z │ ╙───╨───┴───┴───┴───┴───┴───┘ ``` in the console. -The solver currently relies on a brute force tree-search algorithm, -and provides solutions at the `Wizard` level, +The algoirithm provides solutions at the `Wizard` level, viz. no collisions occur and none of the pieces ```text -1 2 3 CC - 2 3 C - 3 +┌───┐ ┌───┐ ┌───┐ ┌───┬───┐ +│ 1 │ │ 2 │ │ 3 │ │ C │ C │ +└───┘ ├───┤ ├───┤ ├───┼───┘ + │ 2 │ │ 3 │ │ C │ + └───┘ ├───┤ └───┘ + │ 3 │ + └───┘ ``` are adjacent (in the sense of touching edges). From 57b4a6bb559a27e70ce8b041ce06e03c62d920a0 Mon Sep 17 00:00:00 2001 From: raj-open Date: Fri, 5 Sep 2025 16:22:57 +0100 Subject: [PATCH 08/41] story-gs > staging: used channels / send-receive structure to get all solution NOTE: currently we just get 1 solution instead of all --- .../games/genius_square/algorithms/solve.rs | 42 +++++++++++-------- .../genius_square/features/setup_game.rs | 16 +++---- 2 files changed, 30 insertions(+), 28 deletions(-) diff --git a/src/bin/games/genius_square/algorithms/solve.rs b/src/bin/games/genius_square/algorithms/solve.rs index 65c7b06..41e4461 100644 --- a/src/bin/games/genius_square/algorithms/solve.rs +++ b/src/bin/games/genius_square/algorithms/solve.rs @@ -6,12 +6,22 @@ use indicatif::ProgressBar; use indicatif::ProgressStyle; use itertools::Itertools; use std::time::Duration; +use std::thread::spawn; +use std::sync::mpsc::channel; +use std::sync::mpsc::Sender; +use std::sync::mpsc::Receiver; use crate::models::constants::enums::ENUM_PIECES; use crate::models::constants::enums::EnumPiece; use crate::models::pieces::models::Piece; use crate::models::board::models::GameBoard; +/// ---------------------------------------------------------------- +/// TYPES +/// ---------------------------------------------------------------- + +type CHAN = (Duration, GameBoard); + /// ---------------------------------------------------------------- /// METHODS /// ---------------------------------------------------------------- @@ -19,11 +29,15 @@ use crate::models::board::models::GameBoard; /// Recursively solves by check all possibilities pub fn solve_brute_force( board: &GameBoard, -) -> (Duration, Option) { +) -> Receiver { + let (tx, rx) = channel::(); let mut board = board.clone(); board.initialise_obstacle(); - let result = recursion(&board, None, None); - return result; + // DEV-NOTE: This is necessary to ensure that no locking occurs. + spawn(move || { + recursion(&tx, &board, None, None); + }); + return rx; } /// ---------------------------------------------------------------- @@ -31,10 +45,11 @@ pub fn solve_brute_force( /// ---------------------------------------------------------------- fn recursion( + tx: &Sender, board: &GameBoard, option_kinds: Option<&[EnumPiece]>, option_pbar: Option<&ProgressBar>, -) -> (Duration, Option) { +) { let kinds = option_kinds.unwrap_or(ENUM_PIECES); let n = kinds.len() as u64; @@ -56,7 +71,8 @@ fn recursion( if board.get_obstacle_coweight() == 0 { pbar.finish_and_clear(); let dt = pbar.elapsed(); - return (dt, Some(board.to_owned())); + let message = (dt, board.to_owned()); + tx.send(message).unwrap(); } } else { // find the next piece which has the fewest number of next possible moves @@ -87,19 +103,9 @@ fn recursion( board_.update_obstacle(&piece); // compute remainder of solution recursively - let (dt, result) = recursion(&board_, Some(kinds), Some(&pbar)); - match result { - Some(_) => { - return (dt, result); - }, - None => { - let k = pbar.position(); - pbar.set_position((k - 1).max(0)); - }, - } + recursion(tx, &board_, Some(kinds), Some(&pbar)); + let k = pbar.position(); + pbar.set_position((k - 1).max(0)); } } - - let dt = pbar.elapsed(); - return (dt, None); } diff --git a/src/bin/games/genius_square/features/setup_game.rs b/src/bin/games/genius_square/features/setup_game.rs index 8a3315e..637d1c4 100644 --- a/src/bin/games/genius_square/features/setup_game.rs +++ b/src/bin/games/genius_square/features/setup_game.rs @@ -34,15 +34,11 @@ pub fn feature_setup_game( // Solve the problem println!("\nCompute solution ...\n"); - let (dt, result) = solve_brute_force(&board); - match result { - Some(board) => { - println!("... completed in {:.2?}", dt); - println!("\nSolution:\n{}\n", board.pretty()); - }, - None => { - println!("... terminated after {:.2?}", dt); - println!("\n\x1b[91mNo solution found!\x1b[0m\n"); - } + let rx = solve_brute_force(&board); + if let Ok((dt, board)) = rx.recv() { + println!("... completed in {:.2?}", dt); + println!("\nSolution:\n{}\n", board.pretty()); + } else { + println!("\n\x1b[91mNo solution found!\x1b[0m\n"); } } From e246a51557b176f8c663852e7943e63b3465b224 Mon Sep 17 00:00:00 2001 From: raj-open Date: Fri, 5 Sep 2025 16:39:38 +0100 Subject: [PATCH 09/41] story-gs > staging: added in means to read all solutions --- .../genius_square/features/setup_game.rs | 21 +++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/src/bin/games/genius_square/features/setup_game.rs b/src/bin/games/genius_square/features/setup_game.rs index 637d1c4..6f45a53 100644 --- a/src/bin/games/genius_square/features/setup_game.rs +++ b/src/bin/games/genius_square/features/setup_game.rs @@ -35,10 +35,23 @@ pub fn feature_setup_game( // Solve the problem println!("\nCompute solution ...\n"); let rx = solve_brute_force(&board); - if let Ok((dt, board)) = rx.recv() { - println!("... completed in {:.2?}", dt); - println!("\nSolution:\n{}\n", board.pretty()); - } else { + let mut n = 0; + #[allow(while_true)] + while true { + match rx.recv() { + Ok((dt, board)) => { + n += 1; + println!("... completed in {:.2?}", dt); + println!("\nSolution {n}:\n{}\n", board.pretty()); + // NOTE: Currently stop on first solution + break; + }, + Err(_) => { + break; + } + } + } + if n == 0 { println!("\n\x1b[91mNo solution found!\x1b[0m\n"); } } From a6e8490d48598cfa0f90db478366068e0af22720 Mon Sep 17 00:00:00 2001 From: raj-open Date: Sat, 6 Sep 2025 13:30:27 +0100 Subject: [PATCH 10/41] story-gs > staging: added dependency for parallelisation --- Cargo.lock | 46 ++++++++++++++++++++++++++++++++++++++++++++++ Cargo.toml | 1 + 2 files changed, 47 insertions(+) diff --git a/Cargo.lock b/Cargo.lock index 92af14d..4e1d338 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -285,6 +285,31 @@ version = "2.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "19d374276b40fb8bbdee95aef7c7fa6b5316ec764510eb64b8dd0e2ed0d7e7f5" +[[package]] +name = "crossbeam-deque" +version = "0.8.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9dd111b7b7f7d55b72c0a6ae361660ee5853c9af73f70c3c2ef6858b950e2e51" +dependencies = [ + "crossbeam-epoch", + "crossbeam-utils", +] + +[[package]] +name = "crossbeam-epoch" +version = "0.9.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5b82ac4a3c2ca9c3460964f020e1402edd5753411d7737aa39c3714ad1b5420e" +dependencies = [ + "crossbeam-utils", +] + +[[package]] +name = "crossbeam-utils" +version = "0.8.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d0a5c400df2834b80a4c3327b3aad3a4c4cd4de0629063962b03235697506a28" + [[package]] name = "dedent" version = "0.1.1" @@ -471,6 +496,7 @@ dependencies = [ "ndarray", "rand 0.9.2", "rand_chacha 0.9.0", + "rayon", "rstest", "rustfmt", "serde", @@ -944,6 +970,26 @@ version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "60a357793950651c4ed0f3f52338f53b2f809f32d83a07f72909fa13e4c6c1e3" +[[package]] +name = "rayon" +version = "1.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "368f01d005bf8fd9b1206fb6fa653e6c4a81ceb1466406b81792d87c5677a58f" +dependencies = [ + "either", + "rayon-core", +] + +[[package]] +name = "rayon-core" +version = "1.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "22e18b0f0062d30d4230b2e85ff77fdfe4326feb054b9783a3460d8435c8ab91" +dependencies = [ + "crossbeam-deque", + "crossbeam-utils", +] + [[package]] name = "rdrand" version = "0.4.0" diff --git a/Cargo.toml b/Cargo.toml index 85a5fcc..a78acd9 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -62,6 +62,7 @@ dedent = {version="^0.1.1"} itertools = {version = "^0.14.0"} indoc = {version="^2.0.6"} indicatif = {version = "^0.18.0"} +rayon = {version = "^1.11.0"} strip-ansi-escapes = {version="^0.2.1"} rand = {version="^0.9.2"} rand_chacha = {version = "^0.9.0"} From 510ef8efc86b06a9798aa3bf3be3c57d86b77dec Mon Sep 17 00:00:00 2001 From: raj-open Date: Sat, 6 Sep 2025 13:31:04 +0100 Subject: [PATCH 11/41] story-gs > staging: used `rayon` to implement parallelisation --- .../games/genius_square/algorithms/solve.rs | 32 +++++++++++-------- 1 file changed, 19 insertions(+), 13 deletions(-) diff --git a/src/bin/games/genius_square/algorithms/solve.rs b/src/bin/games/genius_square/algorithms/solve.rs index 41e4461..1ca9868 100644 --- a/src/bin/games/genius_square/algorithms/solve.rs +++ b/src/bin/games/genius_square/algorithms/solve.rs @@ -10,6 +10,8 @@ use std::thread::spawn; use std::sync::mpsc::channel; use std::sync::mpsc::Sender; use std::sync::mpsc::Receiver; +use rayon::iter::IntoParallelIterator; +use rayon::iter::ParallelIterator; use crate::models::constants::enums::ENUM_PIECES; use crate::models::constants::enums::EnumPiece; @@ -63,7 +65,7 @@ fn recursion( pbar = &pbar0; let style = ProgressStyle::with_template("{spinner:.white} [{elapsed_precise}] [{wide_bar:.white}] {pos}/{len} ({eta_precise})"); pbar.set_style(style.unwrap()) - } + }, } if n == 0 { @@ -92,20 +94,24 @@ fn recursion( let kind = &kinds[0].clone(); let kinds = &kinds[1..]; let piece0 = Piece::from_kind(kind, None); // initialised piece - for piece in board.get_configurations(&piece0) { - pbar.inc(1); - let mut board_ = board.clone(); + board.get_configurations(&piece0) + .collect::>() + // DEV-NOTE: uses from Rayon + .into_par_iter() + .for_each(|piece| { + pbar.inc(1); + let mut board_ = board.clone(); - // update the solution - board_.add_piece(&kind.clone(), &piece); + // update the solution + board_.add_piece(&kind.clone(), &piece); - // update the obstacle - board_.update_obstacle(&piece); + // update the obstacle + board_.update_obstacle(&piece); - // compute remainder of solution recursively - recursion(tx, &board_, Some(kinds), Some(&pbar)); - let k = pbar.position(); - pbar.set_position((k - 1).max(0)); - } + // compute remainder of solution recursively + recursion(tx, &board_, Some(kinds), Some(&pbar)); + let k = pbar.position(); + pbar.set_position((k - 1).max(0)); + }); } } From 6711f0d17e11b1f333e85ecef1eb5affc269afbe Mon Sep 17 00:00:00 2001 From: raj-open Date: Sat, 6 Sep 2025 13:31:13 +0100 Subject: [PATCH 12/41] story-gs > staging: reactivated all solutions --- src/bin/games/genius_square/features/setup_game.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/bin/games/genius_square/features/setup_game.rs b/src/bin/games/genius_square/features/setup_game.rs index 6f45a53..e18e0b3 100644 --- a/src/bin/games/genius_square/features/setup_game.rs +++ b/src/bin/games/genius_square/features/setup_game.rs @@ -44,7 +44,7 @@ pub fn feature_setup_game( println!("... completed in {:.2?}", dt); println!("\nSolution {n}:\n{}\n", board.pretty()); // NOTE: Currently stop on first solution - break; + // break; }, Err(_) => { break; From 007da31c00117f624128af87f21620225eb4e838 Mon Sep 17 00:00:00 2001 From: raj-open Date: Sat, 6 Sep 2025 21:27:44 +0200 Subject: [PATCH 13/41] story-gs > staging: compute statistics and display only 1st solution --- README.md | 31 ++++++------ .../genius_square/features/setup_game.rs | 49 ++++++++++++------- 2 files changed, 46 insertions(+), 34 deletions(-) diff --git a/README.md b/README.md index 1f08859..c951266 100644 --- a/README.md +++ b/README.md @@ -155,15 +155,13 @@ are locally sorted (in ascending order) based on the number of next possible mov Calling ```bash -just run-rust GeniusSquare B1 C4 D6 F1 F2 F3 F5 +just run-rust GeniusSquare B1 C4 D2 D6 E5 F1 F3 ``` results in ```bash - -Roll: B1, C4, D6, F1, F2, F3, F5. - +Roll: B1, C4, D2, D6, E5, F1, F3. Problem: ╔═══╦═══╤═══╤═══╤═══╤═══╤═══╕ @@ -171,36 +169,37 @@ Problem: ╠═══╬═══╪═══╪═══╪═══╪═══╪═══╡ ║ 1 ║ │ ■ │ │ │ │ ■ │ ╠───╬───┼───┼───┼───┼───┼───┤ -║ 2 ║ │ │ │ │ │ ■ │ +║ 2 ║ │ │ │ ■ │ │ │ ╠───╬───┼───┼───┼───┼───┼───┤ ║ 3 ║ │ │ │ │ │ ■ │ ╠───╬───┼───┼───┼───┼───┼───┤ ║ 4 ║ │ │ ■ │ │ │ │ ╠───╬───┼───┼───┼───┼───┼───┤ -║ 5 ║ │ │ │ │ │ ■ │ +║ 5 ║ │ │ │ │ ■ │ │ ╠───╬───┼───┼───┼───┼───┼───┤ ║ 6 ║ │ │ │ ■ │ │ │ ╙───╨───┴───┴───┴───┴───┴───┘ -Compute solution ... - -... completed in 22.44ms +Compute solution ... found 33 solutions. +Time for 1st solution: 11.459ms +Average time per solution: 2.83ms +Total time: 93.39ms -Solution: +Solution 1: ╔═══╦═══╤═══╤═══╤═══╤═══╤═══╕ ║ ║ A │ B │ C │ D │ E │ F │ ╠═══╬═══╪═══╪═══╪═══╪═══╪═══╡ -║ 1 ║ C │ ■ │ X │ X │ 2 │ ■ │ +║ 1 ║ 2 │ ■ │ Z │ Z │ C │ ■ │ ╠───╬───┼───┼───┼───┼───┼───┤ -║ 2 ║ C │ C │ X │ X │ 2 │ ■ │ +║ 2 ║ 2 │ Z │ Z │ ■ │ C │ C │ ╠───╬───┼───┼───┼───┼───┼───┤ -║ 3 ║ 4 │ 4 │ 4 │ 4 │ T │ ■ │ +║ 3 ║ X │ X │ T │ T │ T │ ■ │ ╠───╬───┼───┼───┼───┼───┼───┤ -║ 4 ║ L │ 1 │ ■ │ T │ T │ T │ +║ 4 ║ X │ X │ ■ │ T │ L │ L │ ╠───╬───┼───┼───┼───┼───┼───┤ -║ 5 ║ L │ L │ L │ Z │ Z │ ■ │ +║ 5 ║ 4 │ 4 │ 4 │ 4 │ ■ │ L │ ╠───╬───┼───┼───┼───┼───┼───┤ -║ 6 ║ 3 │ 3 │ 3 │ ■ │ Z │ Z │ +║ 6 ║ 3 │ 3 │ 3 │ ■ │ 1 │ L │ ╙───╨───┴───┴───┴───┴───┴───┘ ``` diff --git a/src/bin/games/genius_square/features/setup_game.rs b/src/bin/games/genius_square/features/setup_game.rs index e18e0b3..7e6db24 100644 --- a/src/bin/games/genius_square/features/setup_game.rs +++ b/src/bin/games/genius_square/features/setup_game.rs @@ -3,6 +3,8 @@ /// ---------------------------------------------------------------- use rand_chacha::ChaCha8Rng; +use std::time::Duration; +use std::time::SystemTime; use crate::models::dice::methods::roll_dice; use crate::models::dice::models::Die; @@ -15,6 +17,8 @@ use crate::algorithms::solve::solve_brute_force; /// METHODS /// ---------------------------------------------------------------- +const TIMEOUT: Duration = Duration::from_secs(10); + pub fn feature_setup_game( rng: &mut ChaCha8Rng, option_roll: Option>, @@ -24,7 +28,7 @@ pub fn feature_setup_game( let dice: Vec = faces.iter() .map(|face| Die::from_string(face)) .collect(); - println!("\nRoll: {}.\n", faces.join(", ")); + println!("\nRoll: {}.", faces.join(", ")); // Establish the problem let coords = dice.iter().map(|die| die.to_coords()).collect(); @@ -33,25 +37,34 @@ pub fn feature_setup_game( println!("\nProblem:\n{}", board.pretty()); // Solve the problem - println!("\nCompute solution ...\n"); - let rx = solve_brute_force(&board); + print!("\nCompute solution ... "); + let rx = solve_brute_force(&board, true); + let mut solution: Option = None; + let mut dt: Option = None; let mut n = 0; - #[allow(while_true)] - while true { - match rx.recv() { - Ok((dt, board)) => { - n += 1; - println!("... completed in {:.2?}", dt); - println!("\nSolution {n}:\n{}\n", board.pretty()); - // NOTE: Currently stop on first solution - // break; - }, - Err(_) => { - break; - } + let time = SystemTime::now(); + + while let Ok(board) = rx.recv_timeout(TIMEOUT) { + if n == 0 { + dt = Some(time.elapsed().unwrap()); + solution = Some(board); } + n += 1; } - if n == 0 { - println!("\n\x1b[91mNo solution found!\x1b[0m\n"); + + let dt_total = time.elapsed().unwrap(); + let dt_mean: Duration = if n > 0 {dt_total/n} else {Duration::from_secs(0)}; + let dt = dt.unwrap_or(dt_total); + match solution { + Some(board) => { + println!("found {n} solutions."); + println!("Time for 1st solution: {dt:2?}"); + println!("Average time per solution: {dt_mean:2?}"); + println!("Total time: {dt_total:2?}"); + println!("\nSolution 1:\n{}\n", board.pretty()); + }, + None => { + println!("\x1b[91mno solution found!\x1b[0m\n"); + } } } From e879858610593d555dd667a7c536af2d92ebf88e Mon Sep 17 00:00:00 2001 From: raj-open Date: Sat, 6 Sep 2025 21:28:16 +0200 Subject: [PATCH 14/41] story-gs > staging: refactored - added option to toggle parallelisation --- .../games/genius_square/algorithms/solve.rs | 70 ++++++++++++------- 1 file changed, 43 insertions(+), 27 deletions(-) diff --git a/src/bin/games/genius_square/algorithms/solve.rs b/src/bin/games/genius_square/algorithms/solve.rs index 1ca9868..4ad77e9 100644 --- a/src/bin/games/genius_square/algorithms/solve.rs +++ b/src/bin/games/genius_square/algorithms/solve.rs @@ -5,7 +5,6 @@ use indicatif::ProgressBar; use indicatif::ProgressStyle; use itertools::Itertools; -use std::time::Duration; use std::thread::spawn; use std::sync::mpsc::channel; use std::sync::mpsc::Sender; @@ -18,12 +17,6 @@ use crate::models::constants::enums::EnumPiece; use crate::models::pieces::models::Piece; use crate::models::board::models::GameBoard; -/// ---------------------------------------------------------------- -/// TYPES -/// ---------------------------------------------------------------- - -type CHAN = (Duration, GameBoard); - /// ---------------------------------------------------------------- /// METHODS /// ---------------------------------------------------------------- @@ -31,26 +24,28 @@ type CHAN = (Duration, GameBoard); /// Recursively solves by check all possibilities pub fn solve_brute_force( board: &GameBoard, -) -> Receiver { - let (tx, rx) = channel::(); + with_parallelisation: bool, +) -> Receiver { + let (tx, rx) = channel::(); let mut board = board.clone(); board.initialise_obstacle(); // DEV-NOTE: This is necessary to ensure that no locking occurs. spawn(move || { - recursion(&tx, &board, None, None); + recursion(&tx, &board, None, None, with_parallelisation); }); return rx; } /// ---------------------------------------------------------------- -/// AUXILIARY METHODS +/// SECONDARY METHODS /// ---------------------------------------------------------------- fn recursion( - tx: &Sender, + tx: &Sender, board: &GameBoard, option_kinds: Option<&[EnumPiece]>, option_pbar: Option<&ProgressBar>, + with_parallelisation: bool, ) { let kinds = option_kinds.unwrap_or(ENUM_PIECES); let n = kinds.len() as u64; @@ -72,8 +67,7 @@ fn recursion( // if nothing left to solve, then return pieces, provide everything is filled if board.get_obstacle_coweight() == 0 { pbar.finish_and_clear(); - let dt = pbar.elapsed(); - let message = (dt, board.to_owned()); + let message = board.to_owned(); tx.send(message).unwrap(); } } else { @@ -94,24 +88,46 @@ fn recursion( let kind = &kinds[0].clone(); let kinds = &kinds[1..]; let piece0 = Piece::from_kind(kind, None); // initialised piece - board.get_configurations(&piece0) + if with_parallelisation { + board + .get_configurations(&piece0) .collect::>() // DEV-NOTE: uses from Rayon .into_par_iter() .for_each(|piece| { - pbar.inc(1); - let mut board_ = board.clone(); + recursion_body(tx, board, &piece, kinds, kind, pbar, with_parallelisation); + }) + } else { + board + .get_configurations(&piece0) + .for_each(|piece| { + recursion_body(tx, board, &piece, kinds, kind, pbar, with_parallelisation); + }) + } + } +} - // update the solution - board_.add_piece(&kind.clone(), &piece); - // update the obstacle - board_.update_obstacle(&piece); +fn recursion_body( + tx: &Sender, + board: &GameBoard, + piece: &Piece, + kinds: &[EnumPiece], + kind: &EnumPiece, + pbar: &ProgressBar, + with_parallelisation: bool, +) { + pbar.inc(1); + let mut board_ = board.clone(); - // compute remainder of solution recursively - recursion(tx, &board_, Some(kinds), Some(&pbar)); - let k = pbar.position(); - pbar.set_position((k - 1).max(0)); - }); - } + // update the solution + board_.add_piece(&kind.clone(), &piece); + + // update the obstacle + board_.update_obstacle(&piece); + + // compute remainder of solution recursively + recursion(tx, &board_, Some(kinds), Some(&pbar), with_parallelisation); + let k = pbar.position(); + pbar.set_position((k - 1).max(0)); } From 5c56015d1ee00544bf03bf804e5f8655a8f29f05 Mon Sep 17 00:00:00 2001 From: raj-open Date: Sat, 6 Sep 2025 21:29:06 +0200 Subject: [PATCH 15/41] story-gs > staging: `bugfix` -corrected used of terminal fonts Main mistake was use of e.g. `\x1b[92,1m` instead of `\x1b[92;1m`. --- .../genius_square/models/constants/dice.rs | 24 +++++++++---------- .../genius_square/models/constants/pieces.rs | 18 +++++++------- 2 files changed, 21 insertions(+), 21 deletions(-) diff --git a/src/bin/games/genius_square/models/constants/dice.rs b/src/bin/games/genius_square/models/constants/dice.rs index e2c50a9..cc64697 100644 --- a/src/bin/games/genius_square/models/constants/dice.rs +++ b/src/bin/games/genius_square/models/constants/dice.rs @@ -27,21 +27,21 @@ pub const FACE2: &[&str] = &[ ]; pub const FACE1_FMT: &[&str] = &[ - "\x1b[91,1mA\x1b[0m", - "\x1b[91,1mB\x1b[0m", - "\x1b[91,1mC\x1b[0m", - "\x1b[91,1mD\x1b[0m", - "\x1b[91,1mE\x1b[0m", - "\x1b[91,1mF\x1b[0m", + "\x1b[3mA\x1b[0m", + "\x1b[3mB\x1b[0m", + "\x1b[3mC\x1b[0m", + "\x1b[3mD\x1b[0m", + "\x1b[3mE\x1b[0m", + "\x1b[3mF\x1b[0m", ]; pub const FACE2_FMT: &[&str] = &[ - "\x1b[91,1m1\x1b[0m", - "\x1b[91,1m2\x1b[0m", - "\x1b[91,1m3\x1b[0m", - "\x1b[91,1m4\x1b[0m", - "\x1b[91,1m5\x1b[0m", - "\x1b[91,1m6\x1b[0m", + "\x1b[3m1\x1b[0m", + "\x1b[3m2\x1b[0m", + "\x1b[3m3\x1b[0m", + "\x1b[3m4\x1b[0m", + "\x1b[3m5\x1b[0m", + "\x1b[3m6\x1b[0m", ]; pub const DICE: &[&[&str]] = &[ diff --git a/src/bin/games/genius_square/models/constants/pieces.rs b/src/bin/games/genius_square/models/constants/pieces.rs index 01b890f..30885ce 100644 --- a/src/bin/games/genius_square/models/constants/pieces.rs +++ b/src/bin/games/genius_square/models/constants/pieces.rs @@ -19,7 +19,7 @@ pub const BLOCK: &str = indoc! {" "}; pub const SYMB_PIECE_1: &str = "1"; -pub const SYMB_FMT_PIECE_1: &str = "1"; +pub const SYMB_FMT_PIECE_1: &str = "\x1b[94;1;4m1\x1b[0m"; pub const PIECE_1: &str = indoc! {" +..... ...... @@ -29,7 +29,7 @@ pub const PIECE_1: &str = indoc! {" "}; pub const SYMB_PIECE_2: &str = "2"; -pub const SYMB_FMT_PIECE_2: &str = "2"; +pub const SYMB_FMT_PIECE_2: &str = "\x1b[1;4m2\x1b[0m"; pub const PIECE_2: &str = indoc! {" ++.... ...... @@ -39,7 +39,7 @@ pub const PIECE_2: &str = indoc! {" "}; pub const SYMB_PIECE_3: &str = "3"; -pub const SYMB_FMT_PIECE_3: &str = "3"; +pub const SYMB_FMT_PIECE_3: &str = "\x1b[1;4m3\x1b[0m"; pub const PIECE_3: &str = indoc! {" +++... ...... @@ -49,7 +49,7 @@ pub const PIECE_3: &str = indoc! {" "}; pub const SYMB_PIECE_4: &str = "4"; -pub const SYMB_FMT_PIECE_4: &str = "4"; +pub const SYMB_FMT_PIECE_4: &str = "\x1b[90m4\x1b[0m"; pub const PIECE_4: &str = indoc! {" ++++.. ...... @@ -59,7 +59,7 @@ pub const PIECE_4: &str = indoc! {" "}; pub const SYMB_PIECE_C: &str = "C"; -pub const SYMB_FMT_PIECE_C: &str = "C"; +pub const SYMB_FMT_PIECE_C: &str = "\x1b[95;1;4mC\x1b[0m"; pub const PIECE_C: &str = indoc! {" ++.... +..... @@ -69,7 +69,7 @@ pub const PIECE_C: &str = indoc! {" "}; pub const SYMB_PIECE_L: &str = "L"; -pub const SYMB_FMT_PIECE_L: &str = "L"; +pub const SYMB_FMT_PIECE_L: &str = "\x1b[96mL\x1b[0m"; pub const PIECE_L: &str = indoc! {" ++.... +..... @@ -79,7 +79,7 @@ pub const PIECE_L: &str = indoc! {" "}; pub const SYMB_PIECE_T: &str = "T"; -pub const SYMB_FMT_PIECE_T: &str = "T"; +pub const SYMB_FMT_PIECE_T: &str = "\x1b[93mT\x1b[0m"; pub const PIECE_T: &str = indoc! {" +++... .+.... @@ -89,7 +89,7 @@ pub const PIECE_T: &str = indoc! {" "}; pub const SYMB_PIECE_X: &str = "X"; -pub const SYMB_FMT_PIECE_X: &str = "X"; +pub const SYMB_FMT_PIECE_X: &str = "\x1b[92mX\x1b[0m"; pub const PIECE_X: &str = indoc! {" ++.... ++.... @@ -99,7 +99,7 @@ pub const PIECE_X: &str = indoc! {" "}; pub const SYMB_PIECE_Z: &str = "Z"; -pub const SYMB_FMT_PIECE_Z: &str = "Z"; +pub const SYMB_FMT_PIECE_Z: &str = "\x1b[91mZ\x1b[0m"; pub const PIECE_Z: &str = indoc! {" .++... ++.... From 8c1e1a0893c94ab370c8fbe0523fb5a9e51655d5 Mon Sep 17 00:00:00 2001 From: raj-open Date: Sun, 7 Sep 2025 10:02:42 +0200 Subject: [PATCH 16/41] story-gs > staging: refactored steps and exports --- .../games/genius_square/features/constants.rs | 11 ++++++ .../features/feat_initialise_game.rs | 36 +++++++++++++++++++ .../{setup_game.rs => feat_solve_game.rs} | 35 +++++------------- src/bin/games/genius_square/features/mod.rs | 7 +++- src/bin/games/genius_square/main.rs | 6 ++-- 5 files changed, 66 insertions(+), 29 deletions(-) create mode 100644 src/bin/games/genius_square/features/constants.rs create mode 100644 src/bin/games/genius_square/features/feat_initialise_game.rs rename src/bin/games/genius_square/features/{setup_game.rs => feat_solve_game.rs} (62%) diff --git a/src/bin/games/genius_square/features/constants.rs b/src/bin/games/genius_square/features/constants.rs new file mode 100644 index 0000000..cdcf823 --- /dev/null +++ b/src/bin/games/genius_square/features/constants.rs @@ -0,0 +1,11 @@ +/// ---------------------------------------------------------------- +/// IMPORTS +/// ---------------------------------------------------------------- + +use std::time::Duration; + +/// ---------------------------------------------------------------- +/// CONSTANTS +/// ---------------------------------------------------------------- + +pub const TIMEOUT: Duration = Duration::from_secs(10); diff --git a/src/bin/games/genius_square/features/feat_initialise_game.rs b/src/bin/games/genius_square/features/feat_initialise_game.rs new file mode 100644 index 0000000..a9ff1e8 --- /dev/null +++ b/src/bin/games/genius_square/features/feat_initialise_game.rs @@ -0,0 +1,36 @@ +/// ---------------------------------------------------------------- +/// IMPORTS +/// ---------------------------------------------------------------- + +use rand_chacha::ChaCha8Rng; + +use crate::models::dice::methods::roll_dice; +use crate::models::dice::models::Die; +use crate::models::constants::enums::EnumPiece; +use crate::models::pieces::models::Piece; +use crate::models::board::models::GameBoard; + +/// ---------------------------------------------------------------- +/// METHODS +/// ---------------------------------------------------------------- + +/// Feature to set up the game +pub fn feature_initialise_game( + rng: &mut ChaCha8Rng, + option_roll: Option>, +) -> GameBoard { + // Roll the dice + let faces = option_roll.unwrap_or_else(|| roll_dice(rng)); + let dice: Vec = faces.iter() + .map(|face| Die::from_string(face)) + .collect(); + println!("\nRoll: {}.", faces.join(", ")); + + // Establish the problem + let coords = dice.iter().map(|die| die.to_coords()).collect(); + let block = Piece::from_coords(coords, Some(EnumPiece::Block)); + let board = GameBoard::new(&block); + println!("\nProblem:\n{}", board.pretty()); + + return board; +} diff --git a/src/bin/games/genius_square/features/setup_game.rs b/src/bin/games/genius_square/features/feat_solve_game.rs similarity index 62% rename from src/bin/games/genius_square/features/setup_game.rs rename to src/bin/games/genius_square/features/feat_solve_game.rs index 7e6db24..2eb7aa1 100644 --- a/src/bin/games/genius_square/features/setup_game.rs +++ b/src/bin/games/genius_square/features/feat_solve_game.rs @@ -2,41 +2,21 @@ /// IMPORTS /// ---------------------------------------------------------------- -use rand_chacha::ChaCha8Rng; use std::time::Duration; use std::time::SystemTime; -use crate::models::dice::methods::roll_dice; -use crate::models::dice::models::Die; -use crate::models::constants::enums::EnumPiece; -use crate::models::pieces::models::Piece; use crate::models::board::models::GameBoard; use crate::algorithms::solve::solve_brute_force; +use super::constants::TIMEOUT; /// ---------------------------------------------------------------- /// METHODS /// ---------------------------------------------------------------- -const TIMEOUT: Duration = Duration::from_secs(10); - -pub fn feature_setup_game( - rng: &mut ChaCha8Rng, - option_roll: Option>, -) { - // Roll the dice - let faces = option_roll.unwrap_or_else(|| roll_dice(rng)); - let dice: Vec = faces.iter() - .map(|face| Die::from_string(face)) - .collect(); - println!("\nRoll: {}.", faces.join(", ")); - - // Establish the problem - let coords = dice.iter().map(|die| die.to_coords()).collect(); - let block = Piece::from_coords(coords, Some(EnumPiece::Block)); - let board = GameBoard::new(&block); - println!("\nProblem:\n{}", board.pretty()); - - // Solve the problem +/// Feature to solve the problem +pub fn feature_solve_game( + board: &GameBoard, +) -> Option { print!("\nCompute solution ... "); let rx = solve_brute_force(&board, true); let mut solution: Option = None; @@ -56,7 +36,8 @@ pub fn feature_setup_game( let dt_mean: Duration = if n > 0 {dt_total/n} else {Duration::from_secs(0)}; let dt = dt.unwrap_or(dt_total); match solution { - Some(board) => { + // DEV-NOTE: use 'ref' to borrow + Some(ref board) => { println!("found {n} solutions."); println!("Time for 1st solution: {dt:2?}"); println!("Average time per solution: {dt_mean:2?}"); @@ -67,4 +48,6 @@ pub fn feature_setup_game( println!("\x1b[91mno solution found!\x1b[0m\n"); } } + + return solution; } diff --git a/src/bin/games/genius_square/features/mod.rs b/src/bin/games/genius_square/features/mod.rs index aee96f5..6aa3f76 100644 --- a/src/bin/games/genius_square/features/mod.rs +++ b/src/bin/games/genius_square/features/mod.rs @@ -1,3 +1,8 @@ /// Highest logic of application. -pub mod setup_game; +pub mod constants; +pub mod feat_initialise_game; +pub mod feat_solve_game; + +pub use feat_initialise_game::feature_initialise_game; +pub use feat_solve_game::feature_solve_game; diff --git a/src/bin/games/genius_square/main.rs b/src/bin/games/genius_square/main.rs index 760e790..2df50bf 100644 --- a/src/bin/games/genius_square/main.rs +++ b/src/bin/games/genius_square/main.rs @@ -12,7 +12,8 @@ mod models; mod features; use models::constants::dice::NUM_DICE; -use features::setup_game::feature_setup_game; +use features::feature_initialise_game; +use features::feature_solve_game; /// ---------------------------------------------------------------- /// MAIN @@ -24,5 +25,6 @@ fn main() { let option_seed = if args.len() >= 1 { Some(args[args.len() - 1].clone()) } else { None }; let mut rng = _core::rand::seed_rng(option_seed); welcome_screen(); - feature_setup_game(&mut rng, option_roll); + let board = feature_initialise_game(&mut rng, option_roll); + feature_solve_game(&board); } From c20fcd98caa59f5e24128f5cb0db8e9297735739 Mon Sep 17 00:00:00 2001 From: raj-open Date: Sun, 7 Sep 2025 10:13:29 +0200 Subject: [PATCH 17/41] story-gs > staging: refactored exports --- src/bin/games/genius_square/algorithms/solve.rs | 8 ++++---- .../genius_square/features/feat_initialise_game.rs | 10 +++++----- .../genius_square/features/feat_solve_game.rs | 2 +- src/bin/games/genius_square/main.rs | 2 +- src/bin/games/genius_square/models/arrays/mod.rs | 2 ++ src/bin/games/genius_square/models/board/mod.rs | 2 ++ src/bin/games/genius_square/models/board/models.rs | 11 +++++++---- .../games/genius_square/models/constants/enums.rs | 2 +- .../games/genius_square/models/constants/mod.rs | 6 ++++++ src/bin/games/genius_square/models/dice/methods.rs | 2 +- src/bin/games/genius_square/models/dice/mod.rs | 3 +++ src/bin/games/genius_square/models/dice/models.rs | 3 ++- .../games/genius_square/models/pieces/methods.rs | 14 -------------- src/bin/games/genius_square/models/pieces/mod.rs | 3 ++- .../games/genius_square/models/pieces/models.rs | 7 ++++--- 15 files changed, 41 insertions(+), 36 deletions(-) delete mode 100644 src/bin/games/genius_square/models/pieces/methods.rs diff --git a/src/bin/games/genius_square/algorithms/solve.rs b/src/bin/games/genius_square/algorithms/solve.rs index 4ad77e9..fb6dc7f 100644 --- a/src/bin/games/genius_square/algorithms/solve.rs +++ b/src/bin/games/genius_square/algorithms/solve.rs @@ -12,10 +12,10 @@ use std::sync::mpsc::Receiver; use rayon::iter::IntoParallelIterator; use rayon::iter::ParallelIterator; -use crate::models::constants::enums::ENUM_PIECES; -use crate::models::constants::enums::EnumPiece; -use crate::models::pieces::models::Piece; -use crate::models::board::models::GameBoard; +use crate::models::constants::ENUM_PIECES; +use crate::models::constants::EnumPiece; +use crate::models::pieces::Piece; +use crate::models::board::GameBoard; /// ---------------------------------------------------------------- /// METHODS diff --git a/src/bin/games/genius_square/features/feat_initialise_game.rs b/src/bin/games/genius_square/features/feat_initialise_game.rs index a9ff1e8..2a5a3db 100644 --- a/src/bin/games/genius_square/features/feat_initialise_game.rs +++ b/src/bin/games/genius_square/features/feat_initialise_game.rs @@ -4,11 +4,11 @@ use rand_chacha::ChaCha8Rng; -use crate::models::dice::methods::roll_dice; -use crate::models::dice::models::Die; -use crate::models::constants::enums::EnumPiece; -use crate::models::pieces::models::Piece; -use crate::models::board::models::GameBoard; +use crate::models::dice::roll_dice; +use crate::models::dice::Die; +use crate::models::constants::EnumPiece; +use crate::models::pieces::Piece; +use crate::models::board::GameBoard; /// ---------------------------------------------------------------- /// METHODS diff --git a/src/bin/games/genius_square/features/feat_solve_game.rs b/src/bin/games/genius_square/features/feat_solve_game.rs index 2eb7aa1..531c1bc 100644 --- a/src/bin/games/genius_square/features/feat_solve_game.rs +++ b/src/bin/games/genius_square/features/feat_solve_game.rs @@ -5,7 +5,7 @@ use std::time::Duration; use std::time::SystemTime; -use crate::models::board::models::GameBoard; +use crate::models::board::GameBoard; use crate::algorithms::solve::solve_brute_force; use super::constants::TIMEOUT; diff --git a/src/bin/games/genius_square/main.rs b/src/bin/games/genius_square/main.rs index 2df50bf..acfb853 100644 --- a/src/bin/games/genius_square/main.rs +++ b/src/bin/games/genius_square/main.rs @@ -11,7 +11,7 @@ mod algorithms; mod models; mod features; -use models::constants::dice::NUM_DICE; +use models::constants::NUM_DICE; use features::feature_initialise_game; use features::feature_solve_game; diff --git a/src/bin/games/genius_square/models/arrays/mod.rs b/src/bin/games/genius_square/models/arrays/mod.rs index 93e2fc4..731bfc2 100644 --- a/src/bin/games/genius_square/models/arrays/mod.rs +++ b/src/bin/games/genius_square/models/arrays/mod.rs @@ -1,3 +1,5 @@ /// Models for handling arrays pub mod models; + +pub use models::BinArray; diff --git a/src/bin/games/genius_square/models/board/mod.rs b/src/bin/games/genius_square/models/board/mod.rs index a5034f1..c606a33 100644 --- a/src/bin/games/genius_square/models/board/mod.rs +++ b/src/bin/games/genius_square/models/board/mod.rs @@ -1,3 +1,5 @@ /// Models for handling game board pub mod models; + +pub use models::GameBoard; diff --git a/src/bin/games/genius_square/models/board/models.rs b/src/bin/games/genius_square/models/board/models.rs index 3556a76..c0ae015 100644 --- a/src/bin/games/genius_square/models/board/models.rs +++ b/src/bin/games/genius_square/models/board/models.rs @@ -9,10 +9,13 @@ use std::fmt::Formatter; use std::fmt::Result; use std::collections::HashMap; -use crate::models::constants::board::*; -use crate::models::constants::dice::*; -use crate::models::constants::enums::*; -use crate::models::pieces::models::*; +use crate::models::constants::EnumPiece; +use crate::models::constants::FACE1_FMT; +use crate::models::constants::FACE2_FMT; +use crate::models::constants::GRID_HEIGHT; +use crate::models::constants::GRID_WIDTH; +use crate::models::constants::NON_ADJACENT; +use crate::models::pieces::Piece; /// ---------------------------------------------------------------- /// STRUCTS diff --git a/src/bin/games/genius_square/models/constants/enums.rs b/src/bin/games/genius_square/models/constants/enums.rs index 2f27ee6..4d895ba 100644 --- a/src/bin/games/genius_square/models/constants/enums.rs +++ b/src/bin/games/genius_square/models/constants/enums.rs @@ -7,7 +7,7 @@ use std::fmt::Display; use std::fmt::Formatter; use std::fmt::Result; -use crate::models::arrays::models::BinArray; +use crate::models::arrays::BinArray; use super::board::*; use super::pieces::*; diff --git a/src/bin/games/genius_square/models/constants/mod.rs b/src/bin/games/genius_square/models/constants/mod.rs index 416606a..2c38f3a 100644 --- a/src/bin/games/genius_square/models/constants/mod.rs +++ b/src/bin/games/genius_square/models/constants/mod.rs @@ -4,3 +4,9 @@ pub mod board; pub mod dice; pub mod enums; pub mod pieces; + +pub use board::*; +pub use dice::*; +pub use enums::*; +#[allow(unused)] +pub use pieces::*; diff --git a/src/bin/games/genius_square/models/dice/methods.rs b/src/bin/games/genius_square/models/dice/methods.rs index d4839a1..b001cc5 100644 --- a/src/bin/games/genius_square/models/dice/methods.rs +++ b/src/bin/games/genius_square/models/dice/methods.rs @@ -5,7 +5,7 @@ use rand_chacha::ChaCha8Rng; use rand::prelude::IndexedRandom; -use crate::models::constants::dice::*; +use crate::models::constants::DICE; /// ---------------------------------------------------------------- /// METHODS diff --git a/src/bin/games/genius_square/models/dice/mod.rs b/src/bin/games/genius_square/models/dice/mod.rs index d66666c..21d59c4 100644 --- a/src/bin/games/genius_square/models/dice/mod.rs +++ b/src/bin/games/genius_square/models/dice/mod.rs @@ -2,3 +2,6 @@ pub mod methods; pub mod models; + +pub use models::Die; +pub use methods::roll_dice; diff --git a/src/bin/games/genius_square/models/dice/models.rs b/src/bin/games/genius_square/models/dice/models.rs index 650325f..799ff83 100644 --- a/src/bin/games/genius_square/models/dice/models.rs +++ b/src/bin/games/genius_square/models/dice/models.rs @@ -7,7 +7,8 @@ use std::fmt::Display; use std::fmt::Formatter; use std::fmt::Result; -use crate::models::constants::dice::*; +use crate::models::constants::FACE1; +use crate::models::constants::FACE2; /// ---------------------------------------------------------------- /// STRUCTS diff --git a/src/bin/games/genius_square/models/pieces/methods.rs b/src/bin/games/genius_square/models/pieces/methods.rs deleted file mode 100644 index 9e382d4..0000000 --- a/src/bin/games/genius_square/models/pieces/methods.rs +++ /dev/null @@ -1,14 +0,0 @@ -/// ---------------------------------------------------------------- -/// IMPORTS -/// ---------------------------------------------------------------- - -// use super::constants; - -/// ---------------------------------------------------------------- -/// METHODS -/// ---------------------------------------------------------------- - -#[allow(unused)] -pub fn method() { - panic!("not implemented"); -} diff --git a/src/bin/games/genius_square/models/pieces/mod.rs b/src/bin/games/genius_square/models/pieces/mod.rs index 2ea0b25..666e0a2 100644 --- a/src/bin/games/genius_square/models/pieces/mod.rs +++ b/src/bin/games/genius_square/models/pieces/mod.rs @@ -1,4 +1,5 @@ /// Models for handling pieces -pub mod methods; pub mod models; + +pub use models::Piece; diff --git a/src/bin/games/genius_square/models/pieces/models.rs b/src/bin/games/genius_square/models/pieces/models.rs index 1674e94..7bc2bf2 100644 --- a/src/bin/games/genius_square/models/pieces/models.rs +++ b/src/bin/games/genius_square/models/pieces/models.rs @@ -11,9 +11,10 @@ use std::ops::AddAssign; use std::ops::Mul; use std::ops::MulAssign; -use crate::models::arrays::models::BinArray; -use crate::models::constants::board::*; -use crate::models::constants::enums::*; +use crate::models::arrays::BinArray; +use crate::models::constants::EnumPiece; +use crate::models::constants::GRID_HEIGHT; +use crate::models::constants::GRID_WIDTH; /// ---------------------------------------------------------------- /// STRUCTS From ae60d76c170db819aac9acc0c17cd53251b0297f Mon Sep 17 00:00:00 2001 From: raj-open Date: Sun, 7 Sep 2025 11:42:25 +0200 Subject: [PATCH 18/41] story-gs > staging: added dependency --- Cargo.lock | 7 ++++--- Cargo.toml | 1 + 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 4e1d338..2f9f790 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -497,6 +497,7 @@ dependencies = [ "rand 0.9.2", "rand_chacha 0.9.0", "rayon", + "regex 1.11.2", "rstest", "rustfmt", "serde", @@ -1025,9 +1026,9 @@ dependencies = [ [[package]] name = "regex" -version = "1.11.1" +version = "1.11.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b544ef1b4eac5dc2db33ea63606ae9ffcfac26c1416a2806ae0bf5f56b201191" +checksum = "23d7fd106d8c02486a8d64e778353d1cffe08ce79ac2e82f540c86d0facf6912" dependencies = [ "aho-corasick 1.1.3", "memchr", @@ -1089,7 +1090,7 @@ dependencies = [ "proc-macro-crate", "proc-macro2", "quote", - "regex 1.11.1", + "regex 1.11.2", "relative-path", "rustc_version 0.4.1", "syn 2.0.101", diff --git a/Cargo.toml b/Cargo.toml index a78acd9..6852dda 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -55,6 +55,7 @@ lto = false # link-time optimisation # ] [dependencies] +regex = {version = "^1.11.2"} serde = {version = "^1.0.219", features = ["derive"]} serde_json = {version = "^1.0.143"} dict_derive = {version = "^0.6.0" } From c05d818a82a49889a40c4df93c184cc53f685b14 Mon Sep 17 00:00:00 2001 From: raj-open Date: Sun, 7 Sep 2025 11:42:56 +0200 Subject: [PATCH 19/41] story-gs > staging: added multiline string join --- src/_core/strings.rs | 61 +++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 60 insertions(+), 1 deletion(-) diff --git a/src/_core/strings.rs b/src/_core/strings.rs index 9673e89..3f49f01 100644 --- a/src/_core/strings.rs +++ b/src/_core/strings.rs @@ -2,6 +2,8 @@ /// IMPORTS /// ---------------------------------------------------------------- +use itertools::Itertools; +use regex::Regex; use strip_ansi_escapes::strip; /// ---------------------------------------------------------------- @@ -21,5 +23,62 @@ pub fn purify_string(text: &String) -> String { #[allow(unused)] /// Computes length of purified string pub fn purify_string_length(text: &String) -> usize { - purify_string(text).len() + // remove ansii characters + let text = purify_string(text); + // since unicode chars can have length > 1, convert to chars + let chars = text.chars(); + let n = chars.count(); + return n; +} + +#[allow(unused)] +/// Performs a horizontal string join for multline strings +pub fn join_multiline_strings( + blocks: &Vec, + sep: &str, +) -> String { + // split blocks into lines and pad to ensure consistency of widths + let re = Regex::new(r"\r?\n").unwrap(); + let blocks: Vec> = blocks + .iter() + .map(|x| { + let lines: Vec = re.split(x).map(|x| x.to_string()).collect(); + let width = lines.iter().map(purify_string_length).max().unwrap_or(0); + let lines: Vec = lines + .iter() + .map(|x| { + let n = purify_string_length(x); + let space = " ".repeat(width - n); + return format!("{x}{space}"); + }) + .collect(); + return lines; + }) + .collect(); + + // pad to ensure consistencey of heights + let height = blocks.iter().map(|lines| lines.len()).max().unwrap_or(0); + let blocks: Vec> = blocks + .iter() + .map(|lines| { + let n = lines.len(); + let line = lines.get(0).map(|x| x.clone()).unwrap_or("".to_string()); + let width = purify_string_length(&line); + let space = " ".repeat(width); + let pad = vec![space.clone(); height - n]; + let lines = [lines.to_owned(), pad].concat(); + return lines; + }) + .collect(); + + let result = (0.. height) + .map(|i| { + blocks + .iter() + .map(|lines| lines.get(i).unwrap()) + .join(sep) + }) + .join("\n"); + + return result; } From 8d8dec726ef1b2545e62d99c6160d489cde81719 Mon Sep 17 00:00:00 2001 From: raj-open Date: Sun, 7 Sep 2025 11:43:48 +0200 Subject: [PATCH 20/41] story-gs > staging: changed display to grid of boxes --- README.md | 78 +++++++++++-------- .../genius_square/models/board/models.rs | 57 ++++++++------ 2 files changed, 79 insertions(+), 56 deletions(-) diff --git a/README.md b/README.md index c951266..4b40b76 100644 --- a/README.md +++ b/README.md @@ -164,43 +164,55 @@ results in Roll: B1, C4, D2, D6, E5, F1, F3. Problem: -╔═══╦═══╤═══╤═══╤═══╤═══╤═══╕ -║ ║ A │ B │ C │ D │ E │ F │ -╠═══╬═══╪═══╪═══╪═══╪═══╪═══╡ -║ 1 ║ │ ■ │ │ │ │ ■ │ -╠───╬───┼───┼───┼───┼───┼───┤ -║ 2 ║ │ │ │ ■ │ │ │ -╠───╬───┼───┼───┼───┼───┼───┤ -║ 3 ║ │ │ │ │ │ ■ │ -╠───╬───┼───┼───┼───┼───┼───┤ -║ 4 ║ │ │ ■ │ │ │ │ -╠───╬───┼───┼───┼───┼───┼───┤ -║ 5 ║ │ │ │ │ ■ │ │ -╠───╬───┼───┼───┼───┼───┼───┤ -║ 6 ║ │ │ │ ■ │ │ │ -╙───╨───┴───┴───┴───┴───┴───┘ + ╔═══╗ ╔═══╗ ╔═══╗ ╔═══╗ ╔═══╗ ╔═══╗ + ║ A ║ ║ B ║ ║ C ║ ║ D ║ ║ E ║ ║ F ║ + ╚═══╝ ╚═══╝ ╚═══╝ ╚═══╝ ╚═══╝ ╚═══╝ +╔═══╗ ┌───┐ ┌───┐ ┌───┐ ┌───┐ ┌───┐ ┌───┐ +║ 1 ║ │ │ │ ■ │ │ │ │ │ │ │ │ ■ │ +╚═══╝ └───┘ └───┘ └───┘ └───┘ └───┘ └───┘ +╔═══╗ ┌───┐ ┌───┐ ┌───┐ ┌───┐ ┌───┐ ┌───┐ +║ 2 ║ │ │ │ │ │ │ │ ■ │ │ │ │ │ +╚═══╝ └───┘ └───┘ └───┘ └───┘ └───┘ └───┘ +╔═══╗ ┌───┐ ┌───┐ ┌───┐ ┌───┐ ┌───┐ ┌───┐ +║ 3 ║ │ │ │ │ │ │ │ │ │ │ │ ■ │ +╚═══╝ └───┘ └───┘ └───┘ └───┘ └───┘ └───┘ +╔═══╗ ┌───┐ ┌───┐ ┌───┐ ┌───┐ ┌───┐ ┌───┐ +║ 4 ║ │ │ │ │ │ ■ │ │ │ │ │ │ │ +╚═══╝ └───┘ └───┘ └───┘ └───┘ └───┘ └───┘ +╔═══╗ ┌───┐ ┌───┐ ┌───┐ ┌───┐ ┌───┐ ┌───┐ +║ 5 ║ │ │ │ │ │ │ │ │ │ ■ │ │ │ +╚═══╝ └───┘ └───┘ └───┘ └───┘ └───┘ └───┘ +╔═══╗ ┌───┐ ┌───┐ ┌───┐ ┌───┐ ┌───┐ ┌───┐ +║ 6 ║ │ │ │ │ │ │ │ ■ │ │ │ │ │ +╚═══╝ └───┘ └───┘ └───┘ └───┘ └───┘ └───┘ Compute solution ... found 33 solutions. -Time for 1st solution: 11.459ms -Average time per solution: 2.83ms -Total time: 93.39ms +Time for 1st solution: 4.429ms +Average time per solution: 2.551757ms +Total time: 84.208ms Solution 1: -╔═══╦═══╤═══╤═══╤═══╤═══╤═══╕ -║ ║ A │ B │ C │ D │ E │ F │ -╠═══╬═══╪═══╪═══╪═══╪═══╪═══╡ -║ 1 ║ 2 │ ■ │ Z │ Z │ C │ ■ │ -╠───╬───┼───┼───┼───┼───┼───┤ -║ 2 ║ 2 │ Z │ Z │ ■ │ C │ C │ -╠───╬───┼───┼───┼───┼───┼───┤ -║ 3 ║ X │ X │ T │ T │ T │ ■ │ -╠───╬───┼───┼───┼───┼───┼───┤ -║ 4 ║ X │ X │ ■ │ T │ L │ L │ -╠───╬───┼───┼───┼───┼───┼───┤ -║ 5 ║ 4 │ 4 │ 4 │ 4 │ ■ │ L │ -╠───╬───┼───┼───┼───┼───┼───┤ -║ 6 ║ 3 │ 3 │ 3 │ ■ │ 1 │ L │ -╙───╨───┴───┴───┴───┴───┴───┘ + ╔═══╗ ╔═══╗ ╔═══╗ ╔═══╗ ╔═══╗ ╔═══╗ + ║ A ║ ║ B ║ ║ C ║ ║ D ║ ║ E ║ ║ F ║ + ╚═══╝ ╚═══╝ ╚═══╝ ╚═══╝ ╚═══╝ ╚═══╝ +╔═══╗ ┌───┐ ┌───┐ ┌───┐ ┌───┐ ┌───┐ ┌───┐ +║ 1 ║ │ 2 │ │ ■ │ │ Z │ │ Z │ │ C │ │ ■ │ +╚═══╝ └───┘ └───┘ └───┘ └───┘ └───┘ └───┘ +╔═══╗ ┌───┐ ┌───┐ ┌───┐ ┌───┐ ┌───┐ ┌───┐ +║ 2 ║ │ 2 │ │ Z │ │ Z │ │ ■ │ │ C │ │ C │ +╚═══╝ └───┘ └───┘ └───┘ └───┘ └───┘ └───┘ +╔═══╗ ┌───┐ ┌───┐ ┌───┐ ┌───┐ ┌───┐ ┌───┐ +║ 3 ║ │ T │ │ T │ │ T │ │ X │ │ X │ │ ■ │ +╚═══╝ └───┘ └───┘ └───┘ └───┘ └───┘ └───┘ +╔═══╗ ┌───┐ ┌───┐ ┌───┐ ┌───┐ ┌───┐ ┌───┐ +║ 4 ║ │ 1 │ │ T │ │ ■ │ │ X │ │ X │ │ L │ +╚═══╝ └───┘ └───┘ └───┘ └───┘ └───┘ └───┘ +╔═══╗ ┌───┐ ┌───┐ ┌───┐ ┌───┐ ┌───┐ ┌───┐ +║ 5 ║ │ 4 │ │ 4 │ │ 4 │ │ 4 │ │ ■ │ │ L │ +╚═══╝ └───┘ └───┘ └───┘ └───┘ └───┘ └───┘ +╔═══╗ ┌───┐ ┌───┐ ┌───┐ ┌───┐ ┌───┐ ┌───┐ +║ 6 ║ │ 3 │ │ 3 │ │ 3 │ │ ■ │ │ L │ │ L │ +╚═══╝ └───┘ └───┘ └───┘ └───┘ └───┘ └───┘ ``` in the console. diff --git a/src/bin/games/genius_square/models/board/models.rs b/src/bin/games/genius_square/models/board/models.rs index c0ae015..05e2781 100644 --- a/src/bin/games/genius_square/models/board/models.rs +++ b/src/bin/games/genius_square/models/board/models.rs @@ -9,6 +9,8 @@ use std::fmt::Formatter; use std::fmt::Result; use std::collections::HashMap; +use general::_core::strings::join_multiline_strings; + use crate::models::constants::EnumPiece; use crate::models::constants::FACE1_FMT; use crate::models::constants::FACE2_FMT; @@ -103,43 +105,52 @@ impl GameBoard { } pub fn pretty(&self) -> String { - let _m = GRID_HEIGHT; - let n = GRID_WIDTH; let field = self.to_array_of_strings(true); - fn create_border( - lcorner1: &str, - fill1: &str, - lcorner2: &str, - fill2: &str, - mid2: &str, - rcorner: &str, - n: usize, + fn create_box( + char: &String, + ulcorner: &str, + urcorner: &str, + blcorner: &str, + brcorner: &str, + hbar: &str, + vbar: &str, ) -> String { - let middle = format!("{fill2}{mid2}{fill2}{fill2}").repeat(n-1); - format!("{lcorner1}{fill1}{fill1}{fill1}{lcorner2}{fill2}{fill2}{middle}{fill2}{rcorner}") + let top = format!("{ulcorner}{hbar}{hbar}{hbar}{urcorner}"); + let mid = format!("{vbar} {char} {vbar}"); + let bot = format!("{blcorner}{hbar}{hbar}{hbar}{brcorner}"); + format!("{top}\n{mid}\n{bot}") + } + + fn create_box_head(char: &str) -> String { + create_box(&char.to_string(), "\u{02554}", "\u{02557}", "\u{0255A}", "\u{0255D}", "\u{02550}", "\u{02551}") } - let top1 = create_border("\u{02554}", "\u{2550}", "\u{02566}", "\u{2550}", "\u{2564}", "\u{2555}", n); - let top2 = create_border("\u{02560}", "\u{2550}", "\u{0256C}", "\u{2550}", "\u{256A}", "\u{2561}", n); - let mid = create_border("\u{02560}", "\u{2500}", "\u{0256C}", "\u{2500}", "\u{253C}", "\u{2524}", n); - let bot = create_border("\u{02559}", "\u{2500}", "\u{02568}", "\u{2500}", "\u{02534}", "\u{02518}", n); + #[allow(unused)] + fn create_box_body(char: &String) -> String { + create_box(char, "\u{0250C}", "\u{02510}", "\u{02514}", "\u{02518}", "\u{2500}", "\u{2502}") + } - let head = FACE1_FMT.join(" \u{2502} ").to_string(); - let head = format!("{top1}\n\u{02551} \u{02551} {head} \u{2502}\n{top2}"); + let corner = create_box(&" ".to_string(), " ", " ", " ", " ", " ", " "); + let mut head_blocks: Vec = FACE1_FMT.iter().map(|&x| x).map(create_box_head).collect(); + head_blocks.insert(0, corner); + let head = join_multiline_strings(&head_blocks, " "); let middle = field.rows() .into_iter() .enumerate() .map(|(i, row)| { - let index = FACE2_FMT[i]; - let line = row.iter().map(|s| s.to_string()).collect::>().join(" \u{2502} "); - return format!("\u{02551} {index} \u{02551} {line} \u{2502}"); + let char = FACE2_FMT[i]; + let block = create_box_head(char); + let mut blocks: Vec = row.iter().map(create_box_body).collect(); + blocks.insert(0, block); + let line = join_multiline_strings(&blocks, " "); + return line; }) .collect::>() - .join(format!("\n{mid}\n").as_str()); + .join("\n"); - let text = format!("{head}\n{middle}\n{bot}"); + let text = format!("{head}\n{middle}"); return text; } From 1e11030232ba69adbd22614b5f745097164a4f27 Mon Sep 17 00:00:00 2001 From: raj-open Date: Sun, 7 Sep 2025 19:05:05 +0200 Subject: [PATCH 21/41] story-gs > staging: multiline join with multiline sep --- src/_core/strings.rs | 76 ++++++++++++++++++++++++++++---------------- 1 file changed, 48 insertions(+), 28 deletions(-) diff --git a/src/_core/strings.rs b/src/_core/strings.rs index 3f49f01..c4e1bba 100644 --- a/src/_core/strings.rs +++ b/src/_core/strings.rs @@ -35,50 +35,70 @@ pub fn purify_string_length(text: &String) -> usize { /// Performs a horizontal string join for multline strings pub fn join_multiline_strings( blocks: &Vec, - sep: &str, + sep_block: Option<&String>, + sep_single: &str, ) -> String { + // split blocks into lines and pad to ensure consistency of widths - let re = Regex::new(r"\r?\n").unwrap(); - let blocks: Vec> = blocks - .iter() - .map(|x| { - let lines: Vec = re.split(x).map(|x| x.to_string()).collect(); - let width = lines.iter().map(purify_string_length).max().unwrap_or(0); - let lines: Vec = lines - .iter() - .map(|x| { - let n = purify_string_length(x); - let space = " ".repeat(width - n); - return format!("{x}{space}"); - }) - .collect(); - return lines; - }) - .collect(); + let blocks: Vec> = blocks.iter().map(pad_widths).collect(); // pad to ensure consistencey of heights let height = blocks.iter().map(|lines| lines.len()).max().unwrap_or(0); let blocks: Vec> = blocks .iter() - .map(|lines| { - let n = lines.len(); - let line = lines.get(0).map(|x| x.clone()).unwrap_or("".to_string()); - let width = purify_string_length(&line); - let space = " ".repeat(width); - let pad = vec![space.clone(); height - n]; - let lines = [lines.to_owned(), pad].concat(); - return lines; - }) + .map(|lines| pad_height(lines, height)) .collect(); + // determine a separator + let sep_block0 = ([sep_single].repeat(height)).join("\n"); + let sep_block = sep_block.map_or_else(|| sep_block0, |x| x.clone()); + let sep_block = pad_widths(&sep_block); + let sep_block = pad_height(&sep_block, height); + + // join blocks line-wise let result = (0.. height) .map(|i| { + let empty = "".to_string(); + let sep = sep_block.get(i).unwrap_or(&empty); blocks .iter() - .map(|lines| lines.get(i).unwrap()) + .map(|lines| lines.get(i).unwrap_or(&empty)) .join(sep) }) .join("\n"); return result; } + +/// Splits a string into lines and pads to ensure uniformity of widths +fn pad_widths(text: &String) -> Vec { + let re = Regex::new(r"\r?\n").unwrap(); + let lines: Vec = re.split(text).map(|x| x.to_string()).collect(); + let width = lines.iter().map(purify_string_length).max().unwrap_or(0); + let lines: Vec = lines + .iter() + .map(|x| { + let n = purify_string_length(x); + let space = " ".repeat(width - n); + return format!("{x}{space}"); + }) + .collect(); + return lines; +} + +/// Splits a string into lines and pads to ensure uniformity of widths +fn pad_height( + lines: &Vec, + height: usize, +) -> Vec { + let n = lines.len(); + if n >= height { + return lines.clone(); + } + let line = lines.get(0).map(|x| x.clone()).unwrap_or("".to_string()); + let width = purify_string_length(&line); + let space = " ".repeat(width); + let pad = vec![space.clone(); height - n]; + let lines = [lines.to_owned(), pad].concat(); + return lines; +} From 1bc4043d0309acd61dd38e96b8b176f0ed2bea90 Mon Sep 17 00:00:00 2001 From: raj-open Date: Sun, 7 Sep 2025 19:05:47 +0200 Subject: [PATCH 22/41] story-gs > staging: added models to deal with borders of grid points --- .../models/binary_arrays/models_grids.rs | 338 ++++++++++++++++++ 1 file changed, 338 insertions(+) create mode 100644 src/bin/games/genius_square/models/binary_arrays/models_grids.rs diff --git a/src/bin/games/genius_square/models/binary_arrays/models_grids.rs b/src/bin/games/genius_square/models/binary_arrays/models_grids.rs new file mode 100644 index 0000000..b8ea69d --- /dev/null +++ b/src/bin/games/genius_square/models/binary_arrays/models_grids.rs @@ -0,0 +1,338 @@ +use itertools::Itertools; +/// ---------------------------------------------------------------- +/// IMPORTS +/// ---------------------------------------------------------------- + +use ndarray::Array2; +use ndarray::s as slice; +use std::fmt::Debug; +use std::fmt::Display; +use std::fmt::Formatter; +use std::fmt::Result; +use std::ops::Add; +use std::ops::AddAssign; + +use general::_core::strings::join_multiline_strings; + +use super::models_arrays::BinArray; + +/// ---------------------------------------------------------------- +/// STRUCTS +/// ---------------------------------------------------------------- + +#[derive(Clone, Debug)] +pub struct Boundary { + prev: i8, + next: i8, +} + +#[derive(Clone, Debug)] +pub struct Boundaries { + h: Boundary, + v: Boundary, +} + +#[derive(Clone, Debug)] +pub struct Node { + label: Option, + bd: Boundaries, +} + +#[derive(Clone, Debug)] +/// A binary grid encases a elements of a binary array with boxes +pub struct BinGrid { + m: usize, + n: usize, + clusters: Vec>, +} + +/// ---------------------------------------------------------------- +/// IMPLEMENTATIONS +/// ---------------------------------------------------------------- + +impl Boundary { + pub fn new(prev: i8, next: i8) -> Self { + Self {prev, next} + } + + pub fn empty() -> Self { + Self::new(0, 0) + } +} + +impl Boundaries { + pub fn new(left: i8, right: i8, top: i8, bot: i8) -> Self { + let h = Boundary::new(left, right); + let v = Boundary::new(bot, top); + Self {h, v} + } + + pub fn empty() -> Self { + let h = Boundary::empty(); + let v = Boundary::empty(); + Self {h, v} + } +} + +impl Node { + pub fn new(label: Option, bd: &Boundaries) -> Self { + let bd = bd.clone(); + Self {label, bd} + } + + pub fn empty() -> Self { + Node::new(None, &Boundaries::empty()) + } + + pub fn from_label(label: &String) -> Self { + Node::new(Some(label.clone()), &Boundaries::new(-1, 1, -1, 1)) + } + + pub fn display_in_grid(&self) -> Array2 { + let mut field = Array2::from_elem((3, 5), " ".to_string()); + field[(1, 2)] = self.label.clone().map_or_else(|| " ".to_string(), |x| x); + + let bd = self.bd.clone(); + let has_top_boundary = bd.v.prev != 0; + let has_bot_boundary = bd.v.next != 0; + let has_left_boundary = bd.h.prev != 0; + let has_right_boundary = bd.h.next != 0; + + if has_top_boundary { + field[(0, 0)] = "\u{0253C}".to_string(); + field[(0, 1)] = "\u{02500}".to_string(); + field[(0, 2)] = "\u{02500}".to_string(); + field[(0, 3)] = "\u{02500}".to_string(); + field[(0, 4)] = "\u{0253C}".to_string(); + } + + if has_bot_boundary { + field[(2, 0)] = "\u{0253C}".to_string(); + field[(2, 1)] = "\u{02500}".to_string(); + field[(2, 2)] = "\u{02500}".to_string(); + field[(2, 3)] = "\u{02500}".to_string(); + field[(2, 4)] = "\u{0253C}".to_string(); + } + + if has_left_boundary { + field[(0, 0)] = "\u{0253C}".to_string(); + field[(1, 0)] = "\u{02502}".to_string(); + field[(2, 0)] = "\u{0253C}".to_string(); + } + + if has_right_boundary { + field[(0, 4)] = "\u{0253C}".to_string(); + field[(1, 4)] = "\u{02502}".to_string(); + field[(2, 4)] = "\u{0253C}".to_string(); + } + + return field; + } +} + +impl BinGrid { + pub fn new(m: usize, n: usize) -> Self { + let clusters = vec![]; + Self {m, n, clusters} + } + + #[allow(unused)] + pub fn get_shape(&self) -> (usize, usize) { + (self.m, self.n) + } + + pub fn get_edge_orientation_top(cluster: &Array2) -> Array2 { + cluster.mapv(|x| x.bd.v.prev) + } + + pub fn get_edge_orientation_bottom(cluster: &Array2) -> Array2 { + cluster.mapv(|x| x.bd.v.next) + } + + pub fn get_edge_orientation_left(cluster: &Array2) -> Array2 { + cluster.mapv(|x| x.bd.h.prev) + } + + pub fn get_edge_orientation_right(cluster: &Array2) -> Array2 { + cluster.mapv(|x| x.bd.h.next) + } + + pub fn from_coord( + label: &String, + i: usize, + j: usize, + m: usize, + n: usize, + ) -> Self { + let object = BinArray::from_coords(vec![(i, j)], m, n); + return Self::from_array(label, &object); + } + + pub fn from_array( + label: &String, + object: &BinArray, + ) -> Self { + let (m, n) = object.get_shape(); + let mut cluster = Array2::from_elem((m, n), Node::empty()); + let mut result = Self::new(m, n); + object.get_values().indexed_iter().for_each(|((i, j), &v)| { + if v != 0 { + cluster[(i, j)] = Node::from_label(label); + } + }); + + // coalesce edges + let edges_top = Self::get_edge_orientation_top(&cluster); + let edges_bot = Self::get_edge_orientation_bottom(&cluster); + let edges_left = Self::get_edge_orientation_left(&cluster); + let edges_right = Self::get_edge_orientation_right(&cluster); + + let mut coallesce_top = edges_top.clone(); + let mut coallesce_bot = edges_bot.clone(); + let curr = edges_top.slice(slice![1.., ..]); + let other = edges_bot.slice(slice![..-1, ..]); + let sum = &curr + &other; + coallesce_top.slice_mut(slice![1.., ..]).assign(&sum); + coallesce_bot.slice_mut(slice![..-1, ..]).assign(&sum); + + let mut coallesce_left = edges_left.clone(); + let mut coallesce_right = edges_right.clone(); + let curr = edges_left.slice(slice![.., 1..]); + let other = edges_right.slice(slice![.., ..-1]); + let sum = &curr + &other; + coallesce_left.slice_mut(slice![.., 1..]).assign(&sum); + coallesce_right.slice_mut(slice![.., ..-1]).assign(&sum); + + coallesce_top.indexed_iter().for_each(|((i, j), &v)| { + cluster[(i, j)].bd.v.prev = v; + }); + + coallesce_bot.indexed_iter().for_each(|((i, j), &v)| { + cluster[(i, j)].bd.v.next = v; + }); + + coallesce_left.indexed_iter().for_each(|((i, j), &v)| { + cluster[(i, j)].bd.h.prev = v; + }); + + coallesce_right.indexed_iter().for_each(|((i, j), &v)| { + cluster[(i, j)].bd.h.next = v; + }); + + result.clusters = vec![cluster]; + + return result; + } + + pub fn get_node(&self, i: usize, j: usize) -> Node { + let mut bd = Boundaries::empty(); + let mut label: Option = None; + for cluster in self.clusters.iter() { + let node_ = cluster[(i, j)].clone(); + let label_ = node_.label; + let bd_ = node_.bd; + if let Some(x) = label_ { + label = Some(x); + } + if bd.v.next == 0 { bd.v.next = bd_.v.next; } + if bd.v.prev == 0 { bd.v.prev = bd_.v.prev; } + if bd.h.next == 0 { bd.h.next = bd_.h.next; } + if bd.h.prev == 0 { bd.h.prev = bd_.h.prev; } + } + let node = Node::new(label, &bd); + return node; + } +} + +impl Display for BinGrid { + fn fmt(&self, f: &mut Formatter<'_>) -> Result { + let (m, n) = self.get_shape(); + + // compute fields of characters + let fields: Vec> = (0.. m).map(|i| { + // compute fields of characters + let fields: Vec> = (0.. n) + // get array of chars representing part of grid + .map(|j| self.get_node(i, j).display_in_grid()) + .collect(); + + // determine size of merge + let m = fields.iter().map(|field_| field_.nrows()).max().unwrap_or(0); + let n = 1 + fields.iter().map(|field_| field_.ncols() - 1).sum::(); + let mut field = Array2::from_elem((m, n), " ".to_string()); + + // h-join chars in grid, taking care of boundaries + let mut j0 = 0; + for (k, field_) in fields.iter().enumerate() { + let m_ = field_.nrows(); + let n_ = field_.ncols(); + let j1 = if k > 0 && n_ > 0 { j0 + n_ - 1 } else { j0 + n_ }; + let mut view = field.slice_mut(slice![..m_, j0.. j1]); + if k == 0 { + view.assign(&field_); + } else { + view.assign(&field_.slice(slice![.., 1..])); + } + // on boundary allow empty values to be overwritten + if j0 > 0 { + for i in 0.. m_ { + if field[(i, j0 - 1)].trim() == "" { + field[(i, j0 - 1)] = field_[(i, 0)].clone(); + } + } + } + j0 = j1; + } + + return field; + }).collect(); + + // determine size of merge + let m = 1 + fields.iter().map(|field_| field_.nrows() - 1).sum::(); + let n = fields.iter().map(|field_| field_.ncols()).max().unwrap_or(0); + let mut field = Array2::from_elem((m, n), " ".to_string()); + + // v-join chars in grid, taking care of boundaries + let mut i0 = 0; + for (k, field_) in fields.iter().enumerate() { + let m_ = field_.nrows(); + let n_ = field_.ncols(); + let i1 = if k > 0 && m_ > 0 { i0 + m_ - 1 } else { i0 + m_ }; + let mut view = field.slice_mut(slice![i0..i1, ..n_]); + if k == 0 { + view.assign(&field_); + } else { + view.assign(&field_.slice(slice![1.., ..])); + } + // on boundary allow empty values to be overwritten + if i0 > 0 { + for j in 0.. n_ { + if field[(i0 - 1, j)].trim() == "" { + field[(i0 - 1, j)] = field_[(0, j)].clone(); + } + } + } + i0 = i1; + } + + // finally, join field chars: + let text = field.rows().into_iter().map(|row| row.iter().join("")).join("\n"); + write!(f, "{}", text) + } +} + +impl AddAssign for BinGrid { + fn add_assign(&mut self, other: Self) { + self.clusters.extend(other.clusters.clone()); + } +} + +impl Add for BinGrid { + type Output = Self; + + fn add(self, other: Self) -> Self::Output { + let mut result = self.clone(); + result += other; + return result; + } +} From 56aecf1c808aedbdb20a696b9645d9b7acaa1df8 Mon Sep 17 00:00:00 2001 From: raj-open Date: Sun, 7 Sep 2025 19:06:12 +0200 Subject: [PATCH 23/41] story-gs > staging: refactored --- src/bin/games/genius_square/models/arrays/mod.rs | 5 ----- src/bin/games/genius_square/models/binary_arrays/mod.rs | 7 +++++++ .../{arrays/models.rs => binary_arrays/models_arrays.rs} | 0 src/bin/games/genius_square/models/constants/enums.rs | 2 +- src/bin/games/genius_square/models/mod.rs | 2 +- src/bin/games/genius_square/models/pieces/models.rs | 6 +++++- 6 files changed, 14 insertions(+), 8 deletions(-) delete mode 100644 src/bin/games/genius_square/models/arrays/mod.rs create mode 100644 src/bin/games/genius_square/models/binary_arrays/mod.rs rename src/bin/games/genius_square/models/{arrays/models.rs => binary_arrays/models_arrays.rs} (100%) diff --git a/src/bin/games/genius_square/models/arrays/mod.rs b/src/bin/games/genius_square/models/arrays/mod.rs deleted file mode 100644 index 731bfc2..0000000 --- a/src/bin/games/genius_square/models/arrays/mod.rs +++ /dev/null @@ -1,5 +0,0 @@ -/// Models for handling arrays - -pub mod models; - -pub use models::BinArray; diff --git a/src/bin/games/genius_square/models/binary_arrays/mod.rs b/src/bin/games/genius_square/models/binary_arrays/mod.rs new file mode 100644 index 0000000..b56cd21 --- /dev/null +++ b/src/bin/games/genius_square/models/binary_arrays/mod.rs @@ -0,0 +1,7 @@ +/// Models for handling arrays + +pub mod models_arrays; +pub mod models_grids; + +pub use models_arrays::BinArray; +pub use models_grids::BinGrid; diff --git a/src/bin/games/genius_square/models/arrays/models.rs b/src/bin/games/genius_square/models/binary_arrays/models_arrays.rs similarity index 100% rename from src/bin/games/genius_square/models/arrays/models.rs rename to src/bin/games/genius_square/models/binary_arrays/models_arrays.rs diff --git a/src/bin/games/genius_square/models/constants/enums.rs b/src/bin/games/genius_square/models/constants/enums.rs index 4d895ba..efb1f93 100644 --- a/src/bin/games/genius_square/models/constants/enums.rs +++ b/src/bin/games/genius_square/models/constants/enums.rs @@ -7,7 +7,7 @@ use std::fmt::Display; use std::fmt::Formatter; use std::fmt::Result; -use crate::models::arrays::BinArray; +use crate::models::binary_arrays::BinArray; use super::board::*; use super::pieces::*; diff --git a/src/bin/games/genius_square/models/mod.rs b/src/bin/games/genius_square/models/mod.rs index 33a3833..fc7eabe 100644 --- a/src/bin/games/genius_square/models/mod.rs +++ b/src/bin/games/genius_square/models/mod.rs @@ -1,6 +1,6 @@ /// Models used in game. -pub mod arrays; +pub mod binary_arrays; pub mod board; pub mod constants; pub mod dice; diff --git a/src/bin/games/genius_square/models/pieces/models.rs b/src/bin/games/genius_square/models/pieces/models.rs index 7bc2bf2..2c6e989 100644 --- a/src/bin/games/genius_square/models/pieces/models.rs +++ b/src/bin/games/genius_square/models/pieces/models.rs @@ -11,7 +11,7 @@ use std::ops::AddAssign; use std::ops::Mul; use std::ops::MulAssign; -use crate::models::arrays::BinArray; +use crate::models::binary_arrays::BinArray; use crate::models::constants::EnumPiece; use crate::models::constants::GRID_HEIGHT; use crate::models::constants::GRID_WIDTH; @@ -37,6 +37,10 @@ impl Piece { Self {kind, positions} } + pub fn get_shape(&self) -> (usize, usize) { + self.positions.get_shape() + } + pub fn from_coords( coords: Vec<(usize, usize)>, option_kind: Option, From 0cde5ecbffa3510ffbdacfd1fdf0b68d45cc85bf Mon Sep 17 00:00:00 2001 From: raj-open Date: Sun, 7 Sep 2025 19:06:31 +0200 Subject: [PATCH 24/41] story-gs > staging: `pretty` now uses grid new class --- .../genius_square/models/board/models.rs | 76 +++++++++---------- 1 file changed, 35 insertions(+), 41 deletions(-) diff --git a/src/bin/games/genius_square/models/board/models.rs b/src/bin/games/genius_square/models/board/models.rs index 05e2781..f48f7c8 100644 --- a/src/bin/games/genius_square/models/board/models.rs +++ b/src/bin/games/genius_square/models/board/models.rs @@ -8,6 +8,7 @@ use std::fmt::Display; use std::fmt::Formatter; use std::fmt::Result; use std::collections::HashMap; +use std::ops::AddAssign; use general::_core::strings::join_multiline_strings; @@ -18,6 +19,7 @@ use crate::models::constants::GRID_HEIGHT; use crate::models::constants::GRID_WIDTH; use crate::models::constants::NON_ADJACENT; use crate::models::pieces::Piece; +use crate::models::binary_arrays::BinGrid; /// ---------------------------------------------------------------- /// STRUCTS @@ -45,6 +47,10 @@ impl GameBoard { return Self {block, obstacle_basic, obstacle_dithered, pieces} } + pub fn get_shape(&self) -> (usize, usize) { + self.block.get_shape() + } + pub fn add_piece(&mut self, symb: &EnumPiece, piece: &Piece) { self.pieces.insert(symb.clone(), piece.clone()); } @@ -105,52 +111,40 @@ impl GameBoard { } pub fn pretty(&self) -> String { - let field = self.to_array_of_strings(true); + let (m, n) = self.get_shape(); - fn create_box( - char: &String, - ulcorner: &str, - urcorner: &str, - blcorner: &str, - brcorner: &str, - hbar: &str, - vbar: &str, - ) -> String { - let top = format!("{ulcorner}{hbar}{hbar}{hbar}{urcorner}"); - let mid = format!("{vbar} {char} {vbar}"); - let bot = format!("{blcorner}{hbar}{hbar}{hbar}{brcorner}"); - format!("{top}\n{mid}\n{bot}") - } + let space = " "; + let end1 = format!("{space}\u{02554}\u{02550}\n{space}\u{02551} \n{space}\u{0255A}\u{02550}"); + let end2 = format!("\u{02550}\u{02557}\n \u{02551}\n\u{02550}\u{0255D}"); + let blocks: Vec = FACE1_FMT.iter().map(|&x| format!("\u{02550}\n{x}\n\u{02550}")).collect(); + let sep = format!("\u{02550}\u{02566}\u{02550}\n \u{02551} \n\u{02550}\u{02569}\u{02550}"); + let xlabels = join_multiline_strings(&blocks, Some(&sep), ""); + let xlabels = join_multiline_strings(&[end1, xlabels, end2].to_vec(), None, ""); - fn create_box_head(char: &str) -> String { - create_box(&char.to_string(), "\u{02554}", "\u{02557}", "\u{0255A}", "\u{0255D}", "\u{02550}", "\u{02551}") - } + let end1 = format!("\u{02554}\u{02550}\u{02550}\u{02550}\u{02557}"); + let end2 = format!("\u{0255A}\u{02550}\u{02550}\u{02550}\u{0255D}"); + let blocks: Vec = FACE2_FMT.iter().map(|&x| format!("\u{02551} {x} \u{02551}")).collect(); + let sep = format!("\n\u{02560}\u{02550}\u{02550}\u{02550}\u{02563}\n"); + let ylabels = blocks.join(&sep); + let ylabels = [end1, ylabels, end2].join("\n"); - #[allow(unused)] - fn create_box_body(char: &String) -> String { - create_box(char, "\u{0250C}", "\u{02510}", "\u{02514}", "\u{02518}", "\u{2500}", "\u{2502}") - } + let mut grid = BinGrid::new(m, n); + let symb = self.block.get_symb_fmt(); + self.block.to_coords().iter().for_each(|&(i, j)| { + grid += BinGrid::from_coord(&symb, i, j, m, n); + }); - let corner = create_box(&" ".to_string(), " ", " ", " ", " ", " ", " "); - let mut head_blocks: Vec = FACE1_FMT.iter().map(|&x| x).map(create_box_head).collect(); - head_blocks.insert(0, corner); - let head = join_multiline_strings(&head_blocks, " "); + self.pieces.values().for_each(|piece| { + let symb = piece.get_symb_fmt(); + let pos = piece.get_positions(); + grid += BinGrid::from_array(&symb, pos); + }); - let middle = field.rows() - .into_iter() - .enumerate() - .map(|(i, row)| { - let char = FACE2_FMT[i]; - let block = create_box_head(char); - let mut blocks: Vec = row.iter().map(create_box_body).collect(); - blocks.insert(0, block); - let line = join_multiline_strings(&blocks, " "); - return line; - }) - .collect::>() - .join("\n"); + let middle = grid.to_string(); + + let middle = join_multiline_strings(&[ylabels.to_owned(), middle].to_vec(), None, " "); - let text = format!("{head}\n{middle}"); + let text = format!("{xlabels}\n{middle}"); return text; } @@ -158,7 +152,7 @@ impl GameBoard { fn to_array_of_strings(&self, formatted: bool) -> Array2 { let m = GRID_HEIGHT; let n = GRID_WIDTH; - let mut trace: Array2 = Array2::from_elem((m, n), " ".to_string()); + let mut trace = Array2::from_elem((m, n), " ".to_string()); let piece = self.get_block(); for (i, j) in piece.to_coords() { let alpha = if formatted { piece.get_symb_fmt() } else { piece.get_symb() }; From f86f7c37ca4043d32811ad1db61136e4ff197ad3 Mon Sep 17 00:00:00 2001 From: raj-open Date: Sun, 7 Sep 2025 19:06:42 +0200 Subject: [PATCH 25/41] story-gs > staging: updated example in README --- README.md | 80 ++++++++++++++++++++++++------------------------------- 1 file changed, 35 insertions(+), 45 deletions(-) diff --git a/README.md b/README.md index 4b40b76..b75661e 100644 --- a/README.md +++ b/README.md @@ -164,55 +164,45 @@ results in Roll: B1, C4, D2, D6, E5, F1, F3. Problem: - ╔═══╗ ╔═══╗ ╔═══╗ ╔═══╗ ╔═══╗ ╔═══╗ - ║ A ║ ║ B ║ ║ C ║ ║ D ║ ║ E ║ ║ F ║ - ╚═══╝ ╚═══╝ ╚═══╝ ╚═══╝ ╚═══╝ ╚═══╝ -╔═══╗ ┌───┐ ┌───┐ ┌───┐ ┌───┐ ┌───┐ ┌───┐ -║ 1 ║ │ │ │ ■ │ │ │ │ │ │ │ │ ■ │ -╚═══╝ └───┘ └───┘ └───┘ └───┘ └───┘ └───┘ -╔═══╗ ┌───┐ ┌───┐ ┌───┐ ┌───┐ ┌───┐ ┌───┐ -║ 2 ║ │ │ │ │ │ │ │ ■ │ │ │ │ │ -╚═══╝ └───┘ └───┘ └───┘ └───┘ └───┘ └───┘ -╔═══╗ ┌───┐ ┌───┐ ┌───┐ ┌───┐ ┌───┐ ┌───┐ -║ 3 ║ │ │ │ │ │ │ │ │ │ │ │ ■ │ -╚═══╝ └───┘ └───┘ └───┘ └───┘ └───┘ └───┘ -╔═══╗ ┌───┐ ┌───┐ ┌───┐ ┌───┐ ┌───┐ ┌───┐ -║ 4 ║ │ │ │ │ │ ■ │ │ │ │ │ │ │ -╚═══╝ └───┘ └───┘ └───┘ └───┘ └───┘ └───┘ -╔═══╗ ┌───┐ ┌───┐ ┌───┐ ┌───┐ ┌───┐ ┌───┐ -║ 5 ║ │ │ │ │ │ │ │ │ │ ■ │ │ │ -╚═══╝ └───┘ └───┘ └───┘ └───┘ └───┘ └───┘ -╔═══╗ ┌───┐ ┌───┐ ┌───┐ ┌───┐ ┌───┐ ┌───┐ -║ 6 ║ │ │ │ │ │ │ │ ■ │ │ │ │ │ -╚═══╝ └───┘ └───┘ └───┘ └───┘ └───┘ └───┘ + ╔═══╦═══╦═══╦═══╦═══╦═══╗ + ║ A ║ B ║ C ║ D ║ E ║ F ║ + ╚═══╩═══╩═══╩═══╩═══╩═══╝ +╔═══╗ ┼───┼ ┼───┼ +║ 1 ║ │ ■ │ │ ■ │ +╠═══╣ ┼───┼ ┼───┼ ┼───┼ +║ 2 ║ │ ■ │ +╠═══╣ ┼───┼ ┼───┼ +║ 3 ║ │ ■ │ +╠═══╣ ┼───┼ ┼───┼ +║ 4 ║ │ ■ │ +╠═══╣ ┼───┼ ┼───┼ +║ 5 ║ │ ■ │ +╠═══╣ ┼───┼───┼ +║ 6 ║ │ ■ │ +╚═══╝ ┼───┼ Compute solution ... found 33 solutions. -Time for 1st solution: 4.429ms -Average time per solution: 2.551757ms -Total time: 84.208ms +Time for 1st solution: 3.929ms +Average time per solution: 2.48506ms +Total time: 82.007ms Solution 1: - ╔═══╗ ╔═══╗ ╔═══╗ ╔═══╗ ╔═══╗ ╔═══╗ - ║ A ║ ║ B ║ ║ C ║ ║ D ║ ║ E ║ ║ F ║ - ╚═══╝ ╚═══╝ ╚═══╝ ╚═══╝ ╚═══╝ ╚═══╝ -╔═══╗ ┌───┐ ┌───┐ ┌───┐ ┌───┐ ┌───┐ ┌───┐ -║ 1 ║ │ 2 │ │ ■ │ │ Z │ │ Z │ │ C │ │ ■ │ -╚═══╝ └───┘ └───┘ └───┘ └───┘ └───┘ └───┘ -╔═══╗ ┌───┐ ┌───┐ ┌───┐ ┌───┐ ┌───┐ ┌───┐ -║ 2 ║ │ 2 │ │ Z │ │ Z │ │ ■ │ │ C │ │ C │ -╚═══╝ └───┘ └───┘ └───┘ └───┘ └───┘ └───┘ -╔═══╗ ┌───┐ ┌───┐ ┌───┐ ┌───┐ ┌───┐ ┌───┐ -║ 3 ║ │ T │ │ T │ │ T │ │ X │ │ X │ │ ■ │ -╚═══╝ └───┘ └───┘ └───┘ └───┘ └───┘ └───┘ -╔═══╗ ┌───┐ ┌───┐ ┌───┐ ┌───┐ ┌───┐ ┌───┐ -║ 4 ║ │ 1 │ │ T │ │ ■ │ │ X │ │ X │ │ L │ -╚═══╝ └───┘ └───┘ └───┘ └───┘ └───┘ └───┘ -╔═══╗ ┌───┐ ┌───┐ ┌───┐ ┌───┐ ┌───┐ ┌───┐ -║ 5 ║ │ 4 │ │ 4 │ │ 4 │ │ 4 │ │ ■ │ │ L │ -╚═══╝ └───┘ └───┘ └───┘ └───┘ └───┘ └───┘ -╔═══╗ ┌───┐ ┌───┐ ┌───┐ ┌───┐ ┌───┐ ┌───┐ -║ 6 ║ │ 3 │ │ 3 │ │ 3 │ │ ■ │ │ L │ │ L │ -╚═══╝ └───┘ └───┘ └───┘ └───┘ └───┘ └───┘ + ╔═══╦═══╦═══╦═══╦═══╦═══╗ + ║ A ║ B ║ C ║ D ║ E ║ F ║ + ╚═══╩═══╩═══╩═══╩═══╩═══╝ +╔═══╗ ┼───┼───┼───┼───┼───┼───┼ +║ 1 ║ │ 2 │ ■ │ Z Z │ C │ ■ │ +╠═══╣ ┼ ┼───┼ ┼───┼ ┼───┼ +║ 2 ║ │ 2 │ Z Z │ ■ │ C C │ +╠═══╣ ┼───┼───┼───┼───┼───┼───┼ +║ 3 ║ │ T T T │ X X │ ■ │ +╠═══╣ ┼───┼ ┼───┼ ┼───┼ +║ 4 ║ │ 1 │ T │ ■ │ X X │ L │ +╠═══╣ ┼───┼───┼───┼───┼───┼ ┼ +║ 5 ║ │ 4 4 4 4 │ ■ │ L │ +╠═══╣ ┼───┼───┼───┼───┼───┼ ┼ +║ 6 ║ │ 3 3 3 │ ■ │ L L │ +╚═══╝ ┼───┼───┼───┼───┼───┼───┼ ``` in the console. From 152868163c009f784f16d92f5984bae20699500d Mon Sep 17 00:00:00 2001 From: raj-open Date: Sun, 7 Sep 2025 19:07:15 +0200 Subject: [PATCH 26/41] story-gs > staging: removed unused imports --- .../games/genius_square/models/binary_arrays/models_grids.rs | 2 -- src/bin/games/genius_square/models/board/models.rs | 1 - 2 files changed, 3 deletions(-) diff --git a/src/bin/games/genius_square/models/binary_arrays/models_grids.rs b/src/bin/games/genius_square/models/binary_arrays/models_grids.rs index b8ea69d..6a62d2f 100644 --- a/src/bin/games/genius_square/models/binary_arrays/models_grids.rs +++ b/src/bin/games/genius_square/models/binary_arrays/models_grids.rs @@ -12,8 +12,6 @@ use std::fmt::Result; use std::ops::Add; use std::ops::AddAssign; -use general::_core::strings::join_multiline_strings; - use super::models_arrays::BinArray; /// ---------------------------------------------------------------- diff --git a/src/bin/games/genius_square/models/board/models.rs b/src/bin/games/genius_square/models/board/models.rs index f48f7c8..c0efe76 100644 --- a/src/bin/games/genius_square/models/board/models.rs +++ b/src/bin/games/genius_square/models/board/models.rs @@ -8,7 +8,6 @@ use std::fmt::Display; use std::fmt::Formatter; use std::fmt::Result; use std::collections::HashMap; -use std::ops::AddAssign; use general::_core::strings::join_multiline_strings; From c3c2f7ddbb2e87d78cdd0a459a22923c18764488 Mon Sep 17 00:00:00 2001 From: raj-open Date: Sun, 7 Sep 2025 19:08:45 +0200 Subject: [PATCH 27/41] story-gs > staging: minor --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index b75661e..2e3f865 100644 --- a/README.md +++ b/README.md @@ -211,10 +211,10 @@ viz. no collisions occur and none of the pieces ```text ┌───┐ ┌───┐ ┌───┐ ┌───┬───┐ -│ 1 │ │ 2 │ │ 3 │ │ C │ C │ -└───┘ ├───┤ ├───┤ ├───┼───┘ +│ 1 │ │ 2 │ │ 3 │ │ C C │ +└───┘ ├ ┤ ├ ┤ ├ ┼───┘ │ 2 │ │ 3 │ │ C │ - └───┘ ├───┤ └───┘ + └───┘ ├ ┤ └───┘ │ 3 │ └───┘ ``` From d0837b5d17656629869a3bdb9267d0584e11f22e Mon Sep 17 00:00:00 2001 From: raj-open Date: Sun, 7 Sep 2025 19:55:45 +0200 Subject: [PATCH 28/41] story-gs > staging: sort dice roll and display without commata --- src/bin/games/genius_square/features/feat_initialise_game.rs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/bin/games/genius_square/features/feat_initialise_game.rs b/src/bin/games/genius_square/features/feat_initialise_game.rs index 2a5a3db..f90af51 100644 --- a/src/bin/games/genius_square/features/feat_initialise_game.rs +++ b/src/bin/games/genius_square/features/feat_initialise_game.rs @@ -20,11 +20,12 @@ pub fn feature_initialise_game( option_roll: Option>, ) -> GameBoard { // Roll the dice - let faces = option_roll.unwrap_or_else(|| roll_dice(rng)); + let mut faces = option_roll.unwrap_or_else(|| roll_dice(rng)); + faces.sort(); let dice: Vec = faces.iter() .map(|face| Die::from_string(face)) .collect(); - println!("\nRoll: {}.", faces.join(", ")); + println!("\nRoll: {}", faces.join(" ")); // Establish the problem let coords = dice.iter().map(|die| die.to_coords()).collect(); From fedd8832fac28d125add874bba56c351d67ed424 Mon Sep 17 00:00:00 2001 From: raj-open Date: Sun, 7 Sep 2025 19:56:24 +0200 Subject: [PATCH 29/41] story-gs > staging: updated recipes to store binary in `dist` --- justfile | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/justfile b/justfile index 3b6a9a7..b54fe26 100644 --- a/justfile +++ b/justfile @@ -134,7 +134,9 @@ build-requirements-dependencies: build-compile module="${MAIN_MODULE}": @# cargo zigbuild --target-dir "target" --release --lib - @cargo zigbuild --target-dir "target" --release --bin "${MAIN_MODULE}" + @- rm "dist/{{module}}" 2> /dev/null + @cargo zigbuild --target-dir "target" --release --bin "{{module}}" + @cp "target/release/{{module}}" dist # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # TARGETS: execution @@ -145,7 +147,7 @@ run-py module="main" *args="": run-rust module="${MAIN_MODULE}" *args="": @just build-compile "{{module}}" - @# "./target/release/{{module}}" {{args}} + @# "dist/{{module}}" {{args}} @cargo run --release --bin "{{module}}" {{args}} # -------------------------------- From a2268794b3a50daa899f69356cbf827cb27ab9d8 Mon Sep 17 00:00:00 2001 From: raj-open Date: Sun, 7 Sep 2025 19:56:55 +0200 Subject: [PATCH 30/41] story-gs > staging: cleanup --- README.md | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index 2e3f865..0d487c8 100644 --- a/README.md +++ b/README.md @@ -130,17 +130,17 @@ To perform this separately, use just build-compile GeniusSquare ``` -which produces the binary in [target/release/GeniusSquare](target/release/GeniusSquare). +which copy the binary in [target/release/GeniusSquare](target/release/GeniusSquare) to the [dist](dist) folder. The standalone binary can be called as above: ```bash -./target/release/GeniusSquare +./dist/GeniusSquare # with random seed -./target/release/GeniusSquare {Seed} -./target/release/GeniusSquare 1234 +./dist/GeniusSquare {Seed} +./dist/GeniusSquare 1234 # with given initialisation -./target/release/GeniusSquare {Dice1} {Dice2} ... {Dice7} -./target/release/GeniusSquare B1 C4 D6 F1 F2 F3 F5 +./dist/GeniusSquare {Dice1} {Dice2} ... {Dice7} +./dist/GeniusSquare B1 C4 D6 F1 F2 F3 F5 ``` #### Note on the algorithm #### @@ -161,7 +161,7 @@ just run-rust GeniusSquare B1 C4 D2 D6 E5 F1 F3 results in ```bash -Roll: B1, C4, D2, D6, E5, F1, F3. +Roll: B1 C4 D2 D6 E5 F1 F3. Problem: ╔═══╦═══╦═══╦═══╦═══╦═══╗ From 74b4800ada05ad7017b243f63a00b5edabdf9e41 Mon Sep 17 00:00:00 2001 From: raj-open Date: Sun, 7 Sep 2025 20:28:22 +0200 Subject: [PATCH 31/41] story-gs > staging: updated setup + prettify recipes --- justfile | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/justfile b/justfile index b54fe26..b60acda 100644 --- a/justfile +++ b/justfile @@ -101,6 +101,9 @@ _rust_path_to_test_module path: setup: @echo "TASK: SETUP" @- cp -n "templates/template.env" ".env" + @rustup toolchain install stable + @rustup update + @rustup override set stable build: @just build-venv @@ -203,7 +206,9 @@ tests-unit-optimised *args: # -------------------------------- prettify: - @cargo fmt --verbose + @rustup override set nightly + @- cargo +nightly fmt --all --verbose -- --config-path rustfmt.toml + @rustup override set stable prettify-dry: @echo "Not yet implemented" From 9b0bf72684088df0be3680a215f7c8effd1c43c9 Mon Sep 17 00:00:00 2001 From: raj-open Date: Sun, 7 Sep 2025 20:37:31 +0200 Subject: [PATCH 32/41] story-gs > staging: used comments instead of docstrings --- src/_core/errors.rs | 12 +++--- src/_core/rand.rs | 12 +++--- src/_core/strings.rs | 12 +++--- src/_core/time.rs | 12 +++--- src/app/messages.rs | 18 ++++---- .../games/genius_square/algorithms/solve.rs | 18 ++++---- .../games/genius_square/features/constants.rs | 12 +++--- .../features/feat_initialise_game.rs | 12 +++--- .../genius_square/features/feat_solve_game.rs | 12 +++--- src/bin/games/genius_square/main.rs | 12 +++--- .../models/binary_arrays/models_arrays.rs | 18 ++++---- .../models/binary_arrays/models_grids.rs | 18 ++++---- .../genius_square/models/board/models.rs | 18 ++++---- .../genius_square/models/constants/board.rs | 12 +++--- .../genius_square/models/constants/dice.rs | 12 +++--- .../genius_square/models/constants/enums.rs | 18 ++++---- .../genius_square/models/constants/pieces.rs | 12 +++--- .../genius_square/models/dice/methods.rs | 12 +++--- .../games/genius_square/models/dice/models.rs | 18 ++++---- .../genius_square/models/pieces/models.rs | 18 ++++---- src/main.rs | 12 +++--- src/models/tree/base.rs | 12 +++--- src/models/tree/model.rs | 18 ++++---- src/models/tree/tests_model.rs | 6 +-- src/problems/hackerrank/mathematics/main.rs | 12 +++--- .../mathematics/scalar_products/approach1.rs | 24 +++++------ .../mathematics/scalar_products/approach2.rs | 42 +++++++++---------- .../scalar_products/tests_approach1.rs | 12 +++--- .../scalar_products/tests_approach2.rs | 12 +++--- .../problem10_prime_summation/approach1.rs | 24 +++++------ .../tests_approach1.rs | 12 +++--- 31 files changed, 237 insertions(+), 237 deletions(-) diff --git a/src/_core/errors.rs b/src/_core/errors.rs index d991c12..a350b5c 100644 --- a/src/_core/errors.rs +++ b/src/_core/errors.rs @@ -1,12 +1,12 @@ -/// ---------------------------------------------------------------- -/// IMPORTS -/// ---------------------------------------------------------------- +// ---------------------------------------------------------------- +// IMPORTS +// ---------------------------------------------------------------- use std::fmt::Debug; -/// ---------------------------------------------------------------- -/// METHODS -/// ---------------------------------------------------------------- +// ---------------------------------------------------------------- +// METHODS +// ---------------------------------------------------------------- /// Converts error-like entities to strings #[allow(unused)] diff --git a/src/_core/rand.rs b/src/_core/rand.rs index 5191f06..db20657 100644 --- a/src/_core/rand.rs +++ b/src/_core/rand.rs @@ -1,14 +1,14 @@ -/// ---------------------------------------------------------------- -/// IMPORTS -/// ---------------------------------------------------------------- +// ---------------------------------------------------------------- +// IMPORTS +// ---------------------------------------------------------------- use rand; use rand::SeedableRng; use rand_chacha::ChaCha8Rng; -/// ---------------------------------------------------------------- -/// METHODS -/// ---------------------------------------------------------------- +// ---------------------------------------------------------------- +// METHODS +// ---------------------------------------------------------------- #[allow(unused)] pub fn seed_rng(x: Option) -> ChaCha8Rng { diff --git a/src/_core/strings.rs b/src/_core/strings.rs index c4e1bba..4bcd08f 100644 --- a/src/_core/strings.rs +++ b/src/_core/strings.rs @@ -1,14 +1,14 @@ -/// ---------------------------------------------------------------- -/// IMPORTS -/// ---------------------------------------------------------------- +// ---------------------------------------------------------------- +// IMPORTS +// ---------------------------------------------------------------- use itertools::Itertools; use regex::Regex; use strip_ansi_escapes::strip; -/// ---------------------------------------------------------------- -/// METHODS -/// ---------------------------------------------------------------- +// ---------------------------------------------------------------- +// METHODS +// ---------------------------------------------------------------- pub fn greet(name: &str) { println!("Hello, {}!", name); diff --git a/src/_core/time.rs b/src/_core/time.rs index 3a1b901..d5b57db 100644 --- a/src/_core/time.rs +++ b/src/_core/time.rs @@ -1,13 +1,13 @@ -/// ---------------------------------------------------------------- -/// IMPORTS -/// ---------------------------------------------------------------- +// ---------------------------------------------------------------- +// IMPORTS +// ---------------------------------------------------------------- use std::thread; use std::time::Duration; -/// ---------------------------------------------------------------- -/// METHODS -/// ---------------------------------------------------------------- +// ---------------------------------------------------------------- +// METHODS +// ---------------------------------------------------------------- #[allow(unused)] pub fn sleep_ms(time_ms: u64) { diff --git a/src/app/messages.rs b/src/app/messages.rs index b6ea18c..82361a1 100644 --- a/src/app/messages.rs +++ b/src/app/messages.rs @@ -1,14 +1,14 @@ -/// ---------------------------------------------------------------- -/// IMPORTS -/// ---------------------------------------------------------------- +// ---------------------------------------------------------------- +// IMPORTS +// ---------------------------------------------------------------- use std::env; use super::super::_core::strings::purify_string_length; -/// ---------------------------------------------------------------- -/// METHODS -/// ---------------------------------------------------------------- +// ---------------------------------------------------------------- +// METHODS +// ---------------------------------------------------------------- #[allow(unused)] pub fn welcome_screen() { @@ -23,9 +23,9 @@ pub fn welcome_screen() { display_bordered_message(lines); } -/// ---------------------------------------------------------------- -/// AUXILIARY METHODS -/// ---------------------------------------------------------------- +// ---------------------------------------------------------------- +// AUXILIARY METHODS +// ---------------------------------------------------------------- fn display_bordered_message(lines: Vec) { // determine padding diff --git a/src/bin/games/genius_square/algorithms/solve.rs b/src/bin/games/genius_square/algorithms/solve.rs index fb6dc7f..87ff905 100644 --- a/src/bin/games/genius_square/algorithms/solve.rs +++ b/src/bin/games/genius_square/algorithms/solve.rs @@ -1,6 +1,6 @@ -/// ---------------------------------------------------------------- -/// IMPORTS -/// ---------------------------------------------------------------- +// ---------------------------------------------------------------- +// IMPORTS +// ---------------------------------------------------------------- use indicatif::ProgressBar; use indicatif::ProgressStyle; @@ -17,9 +17,9 @@ use crate::models::constants::EnumPiece; use crate::models::pieces::Piece; use crate::models::board::GameBoard; -/// ---------------------------------------------------------------- -/// METHODS -/// ---------------------------------------------------------------- +// ---------------------------------------------------------------- +// METHODS +// ---------------------------------------------------------------- /// Recursively solves by check all possibilities pub fn solve_brute_force( @@ -36,9 +36,9 @@ pub fn solve_brute_force( return rx; } -/// ---------------------------------------------------------------- -/// SECONDARY METHODS -/// ---------------------------------------------------------------- +// ---------------------------------------------------------------- +// SECONDARY METHODS +// ---------------------------------------------------------------- fn recursion( tx: &Sender, diff --git a/src/bin/games/genius_square/features/constants.rs b/src/bin/games/genius_square/features/constants.rs index cdcf823..d55d0ec 100644 --- a/src/bin/games/genius_square/features/constants.rs +++ b/src/bin/games/genius_square/features/constants.rs @@ -1,11 +1,11 @@ -/// ---------------------------------------------------------------- -/// IMPORTS -/// ---------------------------------------------------------------- +// ---------------------------------------------------------------- +// IMPORTS +// ---------------------------------------------------------------- use std::time::Duration; -/// ---------------------------------------------------------------- -/// CONSTANTS -/// ---------------------------------------------------------------- +// ---------------------------------------------------------------- +// CONSTANTS +// ---------------------------------------------------------------- pub const TIMEOUT: Duration = Duration::from_secs(10); diff --git a/src/bin/games/genius_square/features/feat_initialise_game.rs b/src/bin/games/genius_square/features/feat_initialise_game.rs index f90af51..3175eb6 100644 --- a/src/bin/games/genius_square/features/feat_initialise_game.rs +++ b/src/bin/games/genius_square/features/feat_initialise_game.rs @@ -1,6 +1,6 @@ -/// ---------------------------------------------------------------- -/// IMPORTS -/// ---------------------------------------------------------------- +// ---------------------------------------------------------------- +// IMPORTS +// ---------------------------------------------------------------- use rand_chacha::ChaCha8Rng; @@ -10,9 +10,9 @@ use crate::models::constants::EnumPiece; use crate::models::pieces::Piece; use crate::models::board::GameBoard; -/// ---------------------------------------------------------------- -/// METHODS -/// ---------------------------------------------------------------- +// ---------------------------------------------------------------- +// METHODS +// ---------------------------------------------------------------- /// Feature to set up the game pub fn feature_initialise_game( diff --git a/src/bin/games/genius_square/features/feat_solve_game.rs b/src/bin/games/genius_square/features/feat_solve_game.rs index 531c1bc..ec7b26c 100644 --- a/src/bin/games/genius_square/features/feat_solve_game.rs +++ b/src/bin/games/genius_square/features/feat_solve_game.rs @@ -1,6 +1,6 @@ -/// ---------------------------------------------------------------- -/// IMPORTS -/// ---------------------------------------------------------------- +// ---------------------------------------------------------------- +// IMPORTS +// ---------------------------------------------------------------- use std::time::Duration; use std::time::SystemTime; @@ -9,9 +9,9 @@ use crate::models::board::GameBoard; use crate::algorithms::solve::solve_brute_force; use super::constants::TIMEOUT; -/// ---------------------------------------------------------------- -/// METHODS -/// ---------------------------------------------------------------- +// ---------------------------------------------------------------- +// METHODS +// ---------------------------------------------------------------- /// Feature to solve the problem pub fn feature_solve_game( diff --git a/src/bin/games/genius_square/main.rs b/src/bin/games/genius_square/main.rs index acfb853..6a9525d 100644 --- a/src/bin/games/genius_square/main.rs +++ b/src/bin/games/genius_square/main.rs @@ -1,6 +1,6 @@ -/// ---------------------------------------------------------------- -/// IMPORTS -/// ---------------------------------------------------------------- +// ---------------------------------------------------------------- +// IMPORTS +// ---------------------------------------------------------------- use std::env; @@ -15,9 +15,9 @@ use models::constants::NUM_DICE; use features::feature_initialise_game; use features::feature_solve_game; -/// ---------------------------------------------------------------- -/// MAIN -/// ---------------------------------------------------------------- +// ---------------------------------------------------------------- +// MAIN +// ---------------------------------------------------------------- fn main() { let args: Vec = env::args().skip(1).collect(); diff --git a/src/bin/games/genius_square/models/binary_arrays/models_arrays.rs b/src/bin/games/genius_square/models/binary_arrays/models_arrays.rs index c4d53a0..7351d1c 100644 --- a/src/bin/games/genius_square/models/binary_arrays/models_arrays.rs +++ b/src/bin/games/genius_square/models/binary_arrays/models_arrays.rs @@ -1,6 +1,6 @@ -/// ---------------------------------------------------------------- -/// IMPORTS -/// ---------------------------------------------------------------- +// ---------------------------------------------------------------- +// IMPORTS +// ---------------------------------------------------------------- use ndarray::Array2; use ndarray::s as slice; @@ -15,9 +15,9 @@ use std::ops::MulAssign; use itertools::iproduct; use itertools::Itertools; -/// ---------------------------------------------------------------- -/// STRUCTS -/// ---------------------------------------------------------------- +// ---------------------------------------------------------------- +// STRUCTS +// ---------------------------------------------------------------- #[derive(Clone, Debug)] pub struct BinArray { @@ -26,9 +26,9 @@ pub struct BinArray { values: Array2, } -/// ---------------------------------------------------------------- -/// IMPLEMENTATIONS -/// ---------------------------------------------------------------- +// ---------------------------------------------------------------- +// IMPLEMENTATIONS +// ---------------------------------------------------------------- impl BinArray { pub fn from_coords( diff --git a/src/bin/games/genius_square/models/binary_arrays/models_grids.rs b/src/bin/games/genius_square/models/binary_arrays/models_grids.rs index 6a62d2f..03984c1 100644 --- a/src/bin/games/genius_square/models/binary_arrays/models_grids.rs +++ b/src/bin/games/genius_square/models/binary_arrays/models_grids.rs @@ -1,7 +1,7 @@ use itertools::Itertools; -/// ---------------------------------------------------------------- -/// IMPORTS -/// ---------------------------------------------------------------- +// ---------------------------------------------------------------- +// IMPORTS +// ---------------------------------------------------------------- use ndarray::Array2; use ndarray::s as slice; @@ -14,9 +14,9 @@ use std::ops::AddAssign; use super::models_arrays::BinArray; -/// ---------------------------------------------------------------- -/// STRUCTS -/// ---------------------------------------------------------------- +// ---------------------------------------------------------------- +// STRUCTS +// ---------------------------------------------------------------- #[derive(Clone, Debug)] pub struct Boundary { @@ -44,9 +44,9 @@ pub struct BinGrid { clusters: Vec>, } -/// ---------------------------------------------------------------- -/// IMPLEMENTATIONS -/// ---------------------------------------------------------------- +// ---------------------------------------------------------------- +// IMPLEMENTATIONS +// ---------------------------------------------------------------- impl Boundary { pub fn new(prev: i8, next: i8) -> Self { diff --git a/src/bin/games/genius_square/models/board/models.rs b/src/bin/games/genius_square/models/board/models.rs index c0efe76..38aea32 100644 --- a/src/bin/games/genius_square/models/board/models.rs +++ b/src/bin/games/genius_square/models/board/models.rs @@ -1,6 +1,6 @@ -/// ---------------------------------------------------------------- -/// IMPORTS -/// ---------------------------------------------------------------- +// ---------------------------------------------------------------- +// IMPORTS +// ---------------------------------------------------------------- use ndarray::Array2; use std::fmt::Debug; @@ -20,9 +20,9 @@ use crate::models::constants::NON_ADJACENT; use crate::models::pieces::Piece; use crate::models::binary_arrays::BinGrid; -/// ---------------------------------------------------------------- -/// STRUCTS -/// ---------------------------------------------------------------- +// ---------------------------------------------------------------- +// STRUCTS +// ---------------------------------------------------------------- #[derive(Clone, Debug)] pub struct GameBoard { @@ -33,9 +33,9 @@ pub struct GameBoard { obstacle_dithered: Piece, } -/// ---------------------------------------------------------------- -/// IMPLEMENTATIONS -/// ---------------------------------------------------------------- +// ---------------------------------------------------------------- +// IMPLEMENTATIONS +// ---------------------------------------------------------------- impl GameBoard { pub fn new(block: &Piece) -> Self { diff --git a/src/bin/games/genius_square/models/constants/board.rs b/src/bin/games/genius_square/models/constants/board.rs index 9fb056d..bcc1ad2 100644 --- a/src/bin/games/genius_square/models/constants/board.rs +++ b/src/bin/games/genius_square/models/constants/board.rs @@ -1,12 +1,12 @@ -/// ---------------------------------------------------------------- -/// IMPORTS -/// ---------------------------------------------------------------- +// ---------------------------------------------------------------- +// IMPORTS +// ---------------------------------------------------------------- // -/// ---------------------------------------------------------------- -/// CONSTANTS -/// ---------------------------------------------------------------- +// ---------------------------------------------------------------- +// CONSTANTS +// ---------------------------------------------------------------- pub const GRID_HEIGHT: usize = 6; pub const GRID_WIDTH: usize = 6; diff --git a/src/bin/games/genius_square/models/constants/dice.rs b/src/bin/games/genius_square/models/constants/dice.rs index cc64697..c8302d5 100644 --- a/src/bin/games/genius_square/models/constants/dice.rs +++ b/src/bin/games/genius_square/models/constants/dice.rs @@ -1,12 +1,12 @@ -/// ---------------------------------------------------------------- -/// IMPORTS -/// ---------------------------------------------------------------- +// ---------------------------------------------------------------- +// IMPORTS +// ---------------------------------------------------------------- // -/// ---------------------------------------------------------------- -/// CONSTANTS -/// ---------------------------------------------------------------- +// ---------------------------------------------------------------- +// CONSTANTS +// ---------------------------------------------------------------- pub const FACE1: &[&str] = &[ "A", diff --git a/src/bin/games/genius_square/models/constants/enums.rs b/src/bin/games/genius_square/models/constants/enums.rs index efb1f93..0477577 100644 --- a/src/bin/games/genius_square/models/constants/enums.rs +++ b/src/bin/games/genius_square/models/constants/enums.rs @@ -1,6 +1,6 @@ -/// ---------------------------------------------------------------- -/// IMPORTS -/// ---------------------------------------------------------------- +// ---------------------------------------------------------------- +// IMPORTS +// ---------------------------------------------------------------- use std::fmt::Debug; use std::fmt::Display; @@ -11,9 +11,9 @@ use crate::models::binary_arrays::BinArray; use super::board::*; use super::pieces::*; -/// ---------------------------------------------------------------- -/// STRUCTS AND CONSTANTS -/// ---------------------------------------------------------------- +// ---------------------------------------------------------------- +// STRUCTS AND CONSTANTS +// ---------------------------------------------------------------- #[derive(Clone, Debug, Eq, Hash, PartialEq)] pub enum EnumPiece { @@ -49,9 +49,9 @@ pub const NON_ADJACENT: &[EnumPiece] = &[ EnumPiece::C, ]; -/// ---------------------------------------------------------------- -/// IMPLEMENTATIONS -/// ---------------------------------------------------------------- +// ---------------------------------------------------------------- +// IMPLEMENTATIONS +// ---------------------------------------------------------------- impl EnumPiece { #[allow(unused)] diff --git a/src/bin/games/genius_square/models/constants/pieces.rs b/src/bin/games/genius_square/models/constants/pieces.rs index 30885ce..abdeff9 100644 --- a/src/bin/games/genius_square/models/constants/pieces.rs +++ b/src/bin/games/genius_square/models/constants/pieces.rs @@ -1,12 +1,12 @@ -/// ---------------------------------------------------------------- -/// IMPORTS -/// ---------------------------------------------------------------- +// ---------------------------------------------------------------- +// IMPORTS +// ---------------------------------------------------------------- use indoc::indoc; -/// ---------------------------------------------------------------- -/// CONSTANTS -/// ---------------------------------------------------------------- +// ---------------------------------------------------------------- +// CONSTANTS +// ---------------------------------------------------------------- pub const SYMB_BLOCK: &str = "\u{25A0}"; pub const SYMB_FMT_BLOCK: &str = "\u{25A0}"; diff --git a/src/bin/games/genius_square/models/dice/methods.rs b/src/bin/games/genius_square/models/dice/methods.rs index b001cc5..97b40e3 100644 --- a/src/bin/games/genius_square/models/dice/methods.rs +++ b/src/bin/games/genius_square/models/dice/methods.rs @@ -1,15 +1,15 @@ -/// ---------------------------------------------------------------- -/// IMPORTS -/// ---------------------------------------------------------------- +// ---------------------------------------------------------------- +// IMPORTS +// ---------------------------------------------------------------- use rand_chacha::ChaCha8Rng; use rand::prelude::IndexedRandom; use crate::models::constants::DICE; -/// ---------------------------------------------------------------- -/// METHODS -/// ---------------------------------------------------------------- +// ---------------------------------------------------------------- +// METHODS +// ---------------------------------------------------------------- pub fn roll_dice( rng: &mut ChaCha8Rng, diff --git a/src/bin/games/genius_square/models/dice/models.rs b/src/bin/games/genius_square/models/dice/models.rs index 799ff83..9465c6c 100644 --- a/src/bin/games/genius_square/models/dice/models.rs +++ b/src/bin/games/genius_square/models/dice/models.rs @@ -1,6 +1,6 @@ -/// ---------------------------------------------------------------- -/// IMPORTS -/// ---------------------------------------------------------------- +// ---------------------------------------------------------------- +// IMPORTS +// ---------------------------------------------------------------- use std::fmt::Debug; use std::fmt::Display; @@ -10,9 +10,9 @@ use std::fmt::Result; use crate::models::constants::FACE1; use crate::models::constants::FACE2; -/// ---------------------------------------------------------------- -/// STRUCTS -/// ---------------------------------------------------------------- +// ---------------------------------------------------------------- +// STRUCTS +// ---------------------------------------------------------------- #[derive(Copy, Clone, Debug)] pub struct Die { @@ -20,9 +20,9 @@ pub struct Die { j: usize, } -/// ---------------------------------------------------------------- -/// IMPLEMENTATIONS -/// ---------------------------------------------------------------- +// ---------------------------------------------------------------- +// IMPLEMENTATIONS +// ---------------------------------------------------------------- impl Die { pub fn from_string(face: &String) -> Die { diff --git a/src/bin/games/genius_square/models/pieces/models.rs b/src/bin/games/genius_square/models/pieces/models.rs index 2c6e989..e7a2fd7 100644 --- a/src/bin/games/genius_square/models/pieces/models.rs +++ b/src/bin/games/genius_square/models/pieces/models.rs @@ -1,6 +1,6 @@ -/// ---------------------------------------------------------------- -/// IMPORTS -/// ---------------------------------------------------------------- +// ---------------------------------------------------------------- +// IMPORTS +// ---------------------------------------------------------------- use std::fmt::Debug; use std::fmt::Display; @@ -16,9 +16,9 @@ use crate::models::constants::EnumPiece; use crate::models::constants::GRID_HEIGHT; use crate::models::constants::GRID_WIDTH; -/// ---------------------------------------------------------------- -/// STRUCTS -/// ---------------------------------------------------------------- +// ---------------------------------------------------------------- +// STRUCTS +// ---------------------------------------------------------------- #[derive(Clone, Debug)] pub struct Piece { @@ -26,9 +26,9 @@ pub struct Piece { positions: BinArray, } -/// ---------------------------------------------------------------- -/// IMPLEMENTATIONS -/// ---------------------------------------------------------------- +// ---------------------------------------------------------------- +// IMPLEMENTATIONS +// ---------------------------------------------------------------- impl Piece { pub fn from_kind(kind: &EnumPiece, positions: Option) -> Self { diff --git a/src/main.rs b/src/main.rs index 7510e1c..438e1e3 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,12 +1,12 @@ -/// ---------------------------------------------------------------- -/// IMPORTS -/// ---------------------------------------------------------------- +// ---------------------------------------------------------------- +// IMPORTS +// ---------------------------------------------------------------- mod _core; -/// ---------------------------------------------------------------- -/// MAIN -/// ---------------------------------------------------------------- +// ---------------------------------------------------------------- +// MAIN +// ---------------------------------------------------------------- fn main() { _core::strings::greet("world"); diff --git a/src/models/tree/base.rs b/src/models/tree/base.rs index f5962b2..5cbd02a 100644 --- a/src/models/tree/base.rs +++ b/src/models/tree/base.rs @@ -1,12 +1,12 @@ -/// ---------------------------------------------------------------- -/// IMPORTS -/// ---------------------------------------------------------------- +// ---------------------------------------------------------------- +// IMPORTS +// ---------------------------------------------------------------- /// -/// ---------------------------------------------------------------- -/// TRAITS -/// ---------------------------------------------------------------- +// ---------------------------------------------------------------- +// TRAITS +// ---------------------------------------------------------------- /// Struct to handle generic trees #[allow(unused)] diff --git a/src/models/tree/model.rs b/src/models/tree/model.rs index b918e32..149f550 100644 --- a/src/models/tree/model.rs +++ b/src/models/tree/model.rs @@ -1,15 +1,15 @@ -/// ---------------------------------------------------------------- -/// IMPORTS -/// ---------------------------------------------------------------- +// ---------------------------------------------------------------- +// IMPORTS +// ---------------------------------------------------------------- use std::vec; use super::base::GenericTree; use super::base::GenericTreeOrRoot; use super::base::GenericTreeLike; -/// ---------------------------------------------------------------- -/// BASIC IMPLEMENTATION FOR GenericTree -/// ---------------------------------------------------------------- +// ---------------------------------------------------------------- +// BASIC IMPLEMENTATION FOR GenericTree +// ---------------------------------------------------------------- /// Implementation of a tree #[allow(unused)] @@ -55,9 +55,9 @@ where } } -/// ---------------------------------------------------------------- -/// BASIC IMPLEMENTATION OF TRAIT FOR GenericTree -/// ---------------------------------------------------------------- +// ---------------------------------------------------------------- +// BASIC IMPLEMENTATION OF TRAIT FOR GenericTree +// ---------------------------------------------------------------- impl GenericTreeLike for GenericTree where diff --git a/src/models/tree/tests_model.rs b/src/models/tree/tests_model.rs index 653efc8..a86cba8 100644 --- a/src/models/tree/tests_model.rs +++ b/src/models/tree/tests_model.rs @@ -99,9 +99,9 @@ mod tests { } } -/// ---------------------------------------------------------------- -/// AUXILIARY -/// ---------------------------------------------------------------- +// ---------------------------------------------------------------- +// AUXILIARY +// ---------------------------------------------------------------- /// A dummy node type for test purposes #[derive(Clone)] diff --git a/src/problems/hackerrank/mathematics/main.rs b/src/problems/hackerrank/mathematics/main.rs index c5196c2..5320ed1 100644 --- a/src/problems/hackerrank/mathematics/main.rs +++ b/src/problems/hackerrank/mathematics/main.rs @@ -1,9 +1,9 @@ -/// ---------------------------------------------------------------- -/// IMPORTS -/// ---------------------------------------------------------------- +// ---------------------------------------------------------------- +// IMPORTS +// ---------------------------------------------------------------- -/// ---------------------------------------------------------------- -/// MAIN -/// ---------------------------------------------------------------- +// ---------------------------------------------------------------- +// MAIN +// ---------------------------------------------------------------- fn main() {} diff --git a/src/problems/hackerrank/mathematics/scalar_products/approach1.rs b/src/problems/hackerrank/mathematics/scalar_products/approach1.rs index 47c4f8f..eb20634 100644 --- a/src/problems/hackerrank/mathematics/scalar_products/approach1.rs +++ b/src/problems/hackerrank/mathematics/scalar_products/approach1.rs @@ -5,9 +5,9 @@ /// /// In paricular we rely on constructing iterables. -/// ---------------------------------------------------------------- -/// IMPORTS -/// ---------------------------------------------------------------- +// ---------------------------------------------------------------- +// IMPORTS +// ---------------------------------------------------------------- use core::iter::IntoIterator; use core::iter::Iterator; @@ -20,9 +20,9 @@ use std::io::Stdin; use std::slice::Iter; use std::str::FromStr; -/// ---------------------------------------------------------------- -/// MAIN -/// ---------------------------------------------------------------- +// ---------------------------------------------------------------- +// MAIN +// ---------------------------------------------------------------- /// entry point when used as a script #[allow(unused)] @@ -69,9 +69,9 @@ pub fn run(c: i32, m: i32, n: usize) -> usize { return num_unique; } -/// ---------------------------------------------------------------- -/// SECONDARY -/// ---------------------------------------------------------------- +// ---------------------------------------------------------------- +// SECONDARY +// ---------------------------------------------------------------- #[derive(Clone, Debug)] struct SeqPair { modulus: i64, @@ -138,9 +138,9 @@ impl IntoIterator for SeqPair { } } -/// ---------------------------------------------------------------- -/// AUXILIARY -/// ---------------------------------------------------------------- +// ---------------------------------------------------------------- +// AUXILIARY +// ---------------------------------------------------------------- /// Obtains input lines from stdin /// as a vector of strings. diff --git a/src/problems/hackerrank/mathematics/scalar_products/approach2.rs b/src/problems/hackerrank/mathematics/scalar_products/approach2.rs index 776843e..d47eb13 100644 --- a/src/problems/hackerrank/mathematics/scalar_products/approach2.rs +++ b/src/problems/hackerrank/mathematics/scalar_products/approach2.rs @@ -48,9 +48,9 @@ /// O(n) + O(n) = O(n) /// ``` -/// ---------------------------------------------------------------- -/// IMPORTS -/// ---------------------------------------------------------------- +// ---------------------------------------------------------------- +// IMPORTS +// ---------------------------------------------------------------- use std::fmt::Debug; use std::fmt::Display; @@ -65,9 +65,9 @@ use std::ops::Rem; use std::slice::Iter; use std::str::FromStr; -/// ---------------------------------------------------------------- -/// MAIN -/// ---------------------------------------------------------------- +// ---------------------------------------------------------------- +// MAIN +// ---------------------------------------------------------------- /// entry point when used as a script #[allow(unused)] @@ -118,9 +118,9 @@ pub fn run(c: i64, m: i64, n: usize) -> usize { return values.len(); } -/// ---------------------------------------------------------------- -/// ALGORITHMS -/// ---------------------------------------------------------------- +// ---------------------------------------------------------------- +// ALGORITHMS +// ---------------------------------------------------------------- /// computes x^(2^k) for 1 <= k <= n pub fn power_of_2_powers(x: &T, n: i64) -> HashMap @@ -182,9 +182,9 @@ where return powers; } -/// ---------------------------------------------------------------- -/// STRUCTURES -/// ---------------------------------------------------------------- +// ---------------------------------------------------------------- +// STRUCTURES +// ---------------------------------------------------------------- /// Helper structure for modulo computations #[derive(Copy, Clone, PartialEq, Eq)] @@ -217,9 +217,9 @@ pub struct DynamicalSystem { pub state: Vector2, } -/// ---------------------------------------------------------------- -/// TRAITS -/// ---------------------------------------------------------------- +// ---------------------------------------------------------------- +// TRAITS +// ---------------------------------------------------------------- pub trait NumberLike { fn positive(&self) -> bool; @@ -231,9 +231,9 @@ pub trait BinaryPowers { fn pow2(&self) -> Self; } -/// ---------------------------------------------------------------- -/// IMPLEMENTATIONS -/// ---------------------------------------------------------------- +// ---------------------------------------------------------------- +// IMPLEMENTATIONS +// ---------------------------------------------------------------- impl NumberLike for i64 { fn positive(&self) -> bool { @@ -518,9 +518,9 @@ where } } -/// ---------------------------------------------------------------- -/// AUXILIARY -/// ---------------------------------------------------------------- +// ---------------------------------------------------------------- +// AUXILIARY +// ---------------------------------------------------------------- /// Obtains input lines from stdin /// as a vector of strings. diff --git a/src/problems/hackerrank/mathematics/scalar_products/tests_approach1.rs b/src/problems/hackerrank/mathematics/scalar_products/tests_approach1.rs index a42a044..79830de 100644 --- a/src/problems/hackerrank/mathematics/scalar_products/tests_approach1.rs +++ b/src/problems/hackerrank/mathematics/scalar_products/tests_approach1.rs @@ -1,12 +1,12 @@ -/// ---------------------------------------------------------------- -/// IMPORTS -/// ---------------------------------------------------------------- +// ---------------------------------------------------------------- +// IMPORTS +// ---------------------------------------------------------------- use super::approach1 as approach; -/// ---------------------------------------------------------------- -/// TESTS -/// ---------------------------------------------------------------- +// ---------------------------------------------------------------- +// TESTS +// ---------------------------------------------------------------- /// bundle of tests #[cfg(test)] diff --git a/src/problems/hackerrank/mathematics/scalar_products/tests_approach2.rs b/src/problems/hackerrank/mathematics/scalar_products/tests_approach2.rs index 96e8373..4b66551 100644 --- a/src/problems/hackerrank/mathematics/scalar_products/tests_approach2.rs +++ b/src/problems/hackerrank/mathematics/scalar_products/tests_approach2.rs @@ -1,12 +1,12 @@ -/// ---------------------------------------------------------------- -/// IMPORTS -/// ---------------------------------------------------------------- +// ---------------------------------------------------------------- +// IMPORTS +// ---------------------------------------------------------------- use super::approach2 as approach; -/// ---------------------------------------------------------------- -/// TESTS -/// ---------------------------------------------------------------- +// ---------------------------------------------------------------- +// TESTS +// ---------------------------------------------------------------- /// bundle of tests #[cfg(test)] diff --git a/src/problems/hackerrank/project_euler/problem10_prime_summation/approach1.rs b/src/problems/hackerrank/project_euler/problem10_prime_summation/approach1.rs index 9d18f0c..8981940 100644 --- a/src/problems/hackerrank/project_euler/problem10_prime_summation/approach1.rs +++ b/src/problems/hackerrank/project_euler/problem10_prime_summation/approach1.rs @@ -4,9 +4,9 @@ /// Then efficiently computes the cumulutative sum of primes /// below certain integers. -/// ---------------------------------------------------------------- -/// IMPORTS -/// ---------------------------------------------------------------- +// ---------------------------------------------------------------- +// IMPORTS +// ---------------------------------------------------------------- use std::io; use std::io::BufRead; @@ -17,9 +17,9 @@ use std::collections::HashMap; use std::io::Stdin; use std::str::FromStr; -/// ---------------------------------------------------------------- -/// MAIN -/// ---------------------------------------------------------------- +// ---------------------------------------------------------------- +// MAIN +// ---------------------------------------------------------------- /// entry point when used as a script #[allow(unused)] @@ -44,9 +44,9 @@ pub fn run(numbers: &Vec) -> HashMap { return sums; } -/// ---------------------------------------------------------------- -/// HELPER METHODS -/// ---------------------------------------------------------------- +// ---------------------------------------------------------------- +// HELPER METHODS +// ---------------------------------------------------------------- /// computes the list of primes up to a value fn get_primes(n_max: i64) -> Vec { @@ -78,9 +78,9 @@ fn compute_aggregates(numbers: &Vec, primes: &Vec) -> HashMap Date: Sun, 7 Sep 2025 20:44:51 +0200 Subject: [PATCH 33/41] story-gs > staging: linted general code base --- src/_core/rand.rs | 4 +- src/_core/strings.rs | 18 ++---- src/app/messages.rs | 19 +++--- src/app/mod.rs | 1 - src/lib.rs | 3 +- src/models/tree/model.rs | 6 +- src/models/tree/tests_model.rs | 6 +- src/problems/hackerrank/mathematics/mod.rs | 1 - .../mathematics/scalar_products/approach1.rs | 1 + .../mathematics/scalar_products/approach2.rs | 60 +++++-------------- .../mathematics/scalar_products/mod.rs | 1 - src/problems/hackerrank/mod.rs | 1 - src/problems/hackerrank/project_euler/mod.rs | 1 - .../problem10_prime_summation/approach1.rs | 1 + 14 files changed, 44 insertions(+), 79 deletions(-) diff --git a/src/_core/rand.rs b/src/_core/rand.rs index db20657..9f13423 100644 --- a/src/_core/rand.rs +++ b/src/_core/rand.rs @@ -23,9 +23,9 @@ pub fn seed_rng(x: Option) -> ChaCha8Rng { // create RNG let rng = ChaCha8Rng::from_seed(seed); return rng; - }, + } None => { return ChaCha8Rng::from_os_rng(); - }, + } } } diff --git a/src/_core/strings.rs b/src/_core/strings.rs index 4bcd08f..b7a39eb 100644 --- a/src/_core/strings.rs +++ b/src/_core/strings.rs @@ -38,16 +38,12 @@ pub fn join_multiline_strings( sep_block: Option<&String>, sep_single: &str, ) -> String { - // split blocks into lines and pad to ensure consistency of widths let blocks: Vec> = blocks.iter().map(pad_widths).collect(); // pad to ensure consistencey of heights let height = blocks.iter().map(|lines| lines.len()).max().unwrap_or(0); - let blocks: Vec> = blocks - .iter() - .map(|lines| pad_height(lines, height)) - .collect(); + let blocks: Vec> = blocks.iter().map(|lines| pad_height(lines, height)).collect(); // determine a separator let sep_block0 = ([sep_single].repeat(height)).join("\n"); @@ -56,14 +52,11 @@ pub fn join_multiline_strings( let sep_block = pad_height(&sep_block, height); // join blocks line-wise - let result = (0.. height) + let result = (0..height) .map(|i| { let empty = "".to_string(); let sep = sep_block.get(i).unwrap_or(&empty); - blocks - .iter() - .map(|lines| lines.get(i).unwrap_or(&empty)) - .join(sep) + blocks.iter().map(|lines| lines.get(i).unwrap_or(&empty)).join(sep) }) .join("\n"); @@ -87,10 +80,7 @@ fn pad_widths(text: &String) -> Vec { } /// Splits a string into lines and pads to ensure uniformity of widths -fn pad_height( - lines: &Vec, - height: usize, -) -> Vec { +fn pad_height(lines: &Vec, height: usize) -> Vec { let n = lines.len(); if n >= height { return lines.clone(); diff --git a/src/app/messages.rs b/src/app/messages.rs index 82361a1..6260fe2 100644 --- a/src/app/messages.rs +++ b/src/app/messages.rs @@ -16,10 +16,8 @@ pub fn welcome_screen() { let app_name: &str = exe.file_name().unwrap().to_str().unwrap(); const VERSION: &str = env!("CARGO_PKG_VERSION"); const URL: &str = env!("CARGO_PKG_HOMEPAGE"); - let lines: Vec = vec![ - format!("{app_name} \x1b[92;1mv{VERSION}\x1b[0m"), - format!("{URL}"), - ]; + let lines: Vec = + vec![format!("{app_name} \x1b[92;1mv{VERSION}\x1b[0m"), format!("{URL}")]; display_bordered_message(lines); } @@ -35,11 +33,14 @@ fn display_bordered_message(lines: Vec) { println!("\u{250C}{hbar}\u{2510}"); println!("\u{2502}{hspace}\u{2502}"); - let _: Vec<_> = lines.iter().map(|line| { - let k = purify_string_length(line); - let pad = " ".repeat(n - k); - println!("\u{2502} {line}{pad} \u{2502}"); - }).collect(); + let _: Vec<_> = lines + .iter() + .map(|line| { + let k = purify_string_length(line); + let pad = " ".repeat(n - k); + println!("\u{2502} {line}{pad} \u{2502}"); + }) + .collect(); println!("\u{2502}{hspace}\u{2502}"); println!("\u{2514}{hbar}\u{2518}"); } diff --git a/src/app/mod.rs b/src/app/mod.rs index 2de8453..440f7a3 100644 --- a/src/app/mod.rs +++ b/src/app/mod.rs @@ -1,3 +1,2 @@ /// Submodules for app-level methods - pub mod messages; diff --git a/src/lib.rs b/src/lib.rs index 46446e8..3ec320f 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1,6 +1,5 @@ /// Modules available from General crate for other crates - -pub mod app; pub mod _core; +pub mod app; pub mod models; pub mod problems; diff --git a/src/models/tree/model.rs b/src/models/tree/model.rs index 149f550..e3a6690 100644 --- a/src/models/tree/model.rs +++ b/src/models/tree/model.rs @@ -121,7 +121,11 @@ where let n = self.num_children(); for (k, child) in self.children.iter().enumerate() { let is_final = k == n - 1; - let connector = if child.has_children() { "╮ " } else { "─ " }; + let connector = if child.has_children() { + "╮ " + } else { + "─ " + }; let sep_ = if is_final { format!("╰──{}", connector) } else { diff --git a/src/models/tree/tests_model.rs b/src/models/tree/tests_model.rs index a86cba8..2b96c49 100644 --- a/src/models/tree/tests_model.rs +++ b/src/models/tree/tests_model.rs @@ -53,7 +53,8 @@ mod tests { ├─── alice: 23 ╰─── bob: 24 "# - ).to_string(); + ) + .to_string(); assert_eq!(t.to_string(), expected); } @@ -94,7 +95,8 @@ mod tests { │ ╰─── _: 3 ╰─── bob: 24 "# - ).to_string(); + ) + .to_string(); assert_eq!(t.to_string(), expected); } } diff --git a/src/problems/hackerrank/mathematics/mod.rs b/src/problems/hackerrank/mathematics/mod.rs index 5f03c25..277f45b 100644 --- a/src/problems/hackerrank/mathematics/mod.rs +++ b/src/problems/hackerrank/mathematics/mod.rs @@ -1,5 +1,4 @@ /// Contains solutions to challenges in the Mathematics /// section of Hackerrank. /// Source: . - pub mod scalar_products; diff --git a/src/problems/hackerrank/mathematics/scalar_products/approach1.rs b/src/problems/hackerrank/mathematics/scalar_products/approach1.rs index eb20634..356ea53 100644 --- a/src/problems/hackerrank/mathematics/scalar_products/approach1.rs +++ b/src/problems/hackerrank/mathematics/scalar_products/approach1.rs @@ -5,6 +5,7 @@ /// /// In paricular we rely on constructing iterables. +#[rustfmt::skip] // ---------------------------------------------------------------- // IMPORTS // ---------------------------------------------------------------- diff --git a/src/problems/hackerrank/mathematics/scalar_products/approach2.rs b/src/problems/hackerrank/mathematics/scalar_products/approach2.rs index d47eb13..31db704 100644 --- a/src/problems/hackerrank/mathematics/scalar_products/approach2.rs +++ b/src/problems/hackerrank/mathematics/scalar_products/approach2.rs @@ -48,6 +48,7 @@ /// O(n) + O(n) = O(n) /// ``` +#[rustfmt::skip] // ---------------------------------------------------------------- // IMPORTS // ---------------------------------------------------------------- @@ -96,16 +97,13 @@ pub fn run(c: i64, m: i64, n: usize) -> usize { let matrix_g = matrix_f.pow2(); // compute system[k] = (_, G^k * v0) - let system = DynamicalSystem { - evolution: matrix_g, - state: v0, - }; + let system = DynamicalSystem { evolution: matrix_g, state: v0 }; let n_max = 2 * (n as i64); let system_powers = compute_powers(&system, n_max); // compute all powers of G: let mut values: HashSet = HashSet::new(); - for k in 3.. n_max { + for k in 3..n_max { // k = i + j // compute v := G^k * v_0 let system_pow_k = system_powers.get(&(k as i64)).unwrap(); @@ -130,7 +128,7 @@ where let mut results: HashMap = HashMap::new(); let mut x_pow_2_pow = x.clone(); results.insert(0, x_pow_2_pow.clone()); - (1.. n).for_each(|k| { + (1..n).for_each(|k| { x_pow_2_pow = x_pow_2_pow.pow2(); results.insert(k as i64, x_pow_2_pow.clone()); }); @@ -166,18 +164,15 @@ where let x_pow_2_pow = power_of_2_powers(x, l); // now compute along levels of a binary tree - let powers = (0.. l).fold( - powers, - |mut prev, k| { - let num_leaves = prev.len() as i64; - let x_pow_2_pow_k = x_pow_2_pow.get(&k).unwrap().clone(); - for (&j, value) in prev.clone().iter() { - let value_ = x_pow_2_pow_k.clone() * value.clone(); - prev.insert(j + num_leaves, value_); - }; - return prev; + let powers = (0..l).fold(powers, |mut prev, k| { + let num_leaves = prev.len() as i64; + let x_pow_2_pow_k = x_pow_2_pow.get(&k).unwrap().clone(); + for (&j, value) in prev.clone().iter() { + let value_ = x_pow_2_pow_k.clone() * value.clone(); + prev.insert(j + num_leaves, value_); } - ); + return prev; + }); return powers; } @@ -299,14 +294,7 @@ where impl Add for Modulo where - T: Display - + Copy - + Clone - + PartialEq - + Eq - + NumberLike - + Add - + Rem, + T: Display + Copy + Clone + PartialEq + Eq + NumberLike + Add + Rem, { type Output = Self; @@ -319,14 +307,7 @@ where impl Mul for Modulo where - T: Display - + Copy - + Clone - + PartialEq - + Eq - + NumberLike - + Mul - + Rem, + T: Display + Copy + Clone + PartialEq + Eq + NumberLike + Mul + Rem, { type Output = Self; @@ -390,12 +371,7 @@ where T: Copy + Mul + Add, { fn mul_vector(&self, u: &Vector2) -> Vector2 { - Vector2( - [ - (self.a * u.get(0) + self.b * u.get(1)), - (self.b * u.get(0) + self.d * u.get(1)), - ], - ) + Vector2([(self.a * u.get(0) + self.b * u.get(1)), (self.b * u.get(0) + self.d * u.get(1))]) } } @@ -490,11 +466,7 @@ where impl BinaryPowers for DynamicalSystem where - T: Copy - + Clone - + Add - + Mul - + BinaryPowers, + T: Copy + Clone + Add + Mul + BinaryPowers, { fn zerolike(&self) -> Self { Self { diff --git a/src/problems/hackerrank/mathematics/scalar_products/mod.rs b/src/problems/hackerrank/mathematics/scalar_products/mod.rs index e5293f5..4020928 100644 --- a/src/problems/hackerrank/mathematics/scalar_products/mod.rs +++ b/src/problems/hackerrank/mathematics/scalar_products/mod.rs @@ -1,6 +1,5 @@ /// Solutions to the Hackerrank Mathematics challenge: /// . - pub mod approach1; pub mod approach2; diff --git a/src/problems/hackerrank/mod.rs b/src/problems/hackerrank/mod.rs index 986e5ab..c0e03aa 100644 --- a/src/problems/hackerrank/mod.rs +++ b/src/problems/hackerrank/mod.rs @@ -1,5 +1,4 @@ pub mod mathematics; /// Contains solutions to Hackerrank challenges. /// Source: . - pub mod project_euler; diff --git a/src/problems/hackerrank/project_euler/mod.rs b/src/problems/hackerrank/project_euler/mod.rs index f6972f6..38df9f3 100644 --- a/src/problems/hackerrank/project_euler/mod.rs +++ b/src/problems/hackerrank/project_euler/mod.rs @@ -1,5 +1,4 @@ /// Contains solutions to challenges in the Mathematics /// section of Hackerrank. /// Source: . - pub mod problem10_prime_summation; diff --git a/src/problems/hackerrank/project_euler/problem10_prime_summation/approach1.rs b/src/problems/hackerrank/project_euler/problem10_prime_summation/approach1.rs index 8981940..97bad37 100644 --- a/src/problems/hackerrank/project_euler/problem10_prime_summation/approach1.rs +++ b/src/problems/hackerrank/project_euler/problem10_prime_summation/approach1.rs @@ -4,6 +4,7 @@ /// Then efficiently computes the cumulutative sum of primes /// below certain integers. +#[rustfmt::skip] // ---------------------------------------------------------------- // IMPORTS // ---------------------------------------------------------------- From 42db3d5cda87c31b78dcd5783d4ba0c908a2dd3d Mon Sep 17 00:00:00 2001 From: raj-open Date: Sun, 7 Sep 2025 20:45:04 +0200 Subject: [PATCH 34/41] story-gs > staging: updated linting settings --- rustfmt.toml | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/rustfmt.toml b/rustfmt.toml index 19061f4..49e45a6 100644 --- a/rustfmt.toml +++ b/rustfmt.toml @@ -2,9 +2,9 @@ reorder_imports = false combine_control_expr = false condense_wildcard_suffixes = false disable_all_formatting = false -# use_small_heuristics = "Off" +use_small_heuristics = "Off" -fn_args_layout = "Tall" +fn_params_layout = "Tall" fn_single_line = false hard_tabs = false @@ -19,7 +19,5 @@ fn_call_width = 60 max_width = 100 comment_width = 200 normalize_comments = false -doc_comment_width = 200 normalize_doc_attributes = false wrap_comments = false -wrap_doc_comments = false From 2f880012beb690e503509fe5ca1166f6add5ce2a Mon Sep 17 00:00:00 2001 From: raj-open Date: Sun, 7 Sep 2025 20:49:58 +0200 Subject: [PATCH 35/41] story-gs > staging: linted module --- src/bin/games/genius_square/algorithms/mod.rs | 1 - .../games/genius_square/algorithms/solve.rs | 35 +++--- .../features/feat_initialise_game.rs | 6 +- .../genius_square/features/feat_solve_game.rs | 9 +- src/bin/games/genius_square/features/mod.rs | 1 - src/bin/games/genius_square/main.rs | 14 ++- .../genius_square/models/binary_arrays/mod.rs | 1 - .../models/binary_arrays/models_arrays.rs | 78 ++++++------ .../models/binary_arrays/models_grids.rs | 119 ++++++++++-------- .../games/genius_square/models/board/mod.rs | 1 - .../genius_square/models/board/models.rs | 25 +++- .../genius_square/models/constants/dice.rs | 32 ++--- .../genius_square/models/constants/enums.rs | 2 + .../genius_square/models/constants/mod.rs | 1 - .../genius_square/models/dice/methods.rs | 9 +- .../games/genius_square/models/dice/mod.rs | 1 - .../games/genius_square/models/dice/models.rs | 9 +- src/bin/games/genius_square/models/mod.rs | 1 - .../games/genius_square/models/pieces/mod.rs | 1 - .../genius_square/models/pieces/models.rs | 37 +++--- 20 files changed, 189 insertions(+), 194 deletions(-) diff --git a/src/bin/games/genius_square/algorithms/mod.rs b/src/bin/games/genius_square/algorithms/mod.rs index 06fb1e9..72732cd 100644 --- a/src/bin/games/genius_square/algorithms/mod.rs +++ b/src/bin/games/genius_square/algorithms/mod.rs @@ -1,3 +1,2 @@ /// Algorithms used to solve a game state. - pub mod solve; diff --git a/src/bin/games/genius_square/algorithms/solve.rs b/src/bin/games/genius_square/algorithms/solve.rs index 87ff905..0c789ca 100644 --- a/src/bin/games/genius_square/algorithms/solve.rs +++ b/src/bin/games/genius_square/algorithms/solve.rs @@ -22,10 +22,7 @@ use crate::models::board::GameBoard; // ---------------------------------------------------------------- /// Recursively solves by check all possibilities -pub fn solve_brute_force( - board: &GameBoard, - with_parallelisation: bool, -) -> Receiver { +pub fn solve_brute_force(board: &GameBoard, with_parallelisation: bool) -> Receiver { let (tx, rx) = channel::(); let mut board = board.clone(); board.initialise_obstacle(); @@ -55,12 +52,14 @@ fn recursion( match option_pbar { Some(pbar_) => { pbar = &pbar_; - }, + } None => { pbar = &pbar0; - let style = ProgressStyle::with_template("{spinner:.white} [{elapsed_precise}] [{wide_bar:.white}] {pos}/{len} ({eta_precise})"); + let style = ProgressStyle::with_template( + "{spinner:.white} [{elapsed_precise}] [{wide_bar:.white}] {pos}/{len} ({eta_precise})", + ); pbar.set_style(style.unwrap()) - }, + } } if n == 0 { @@ -72,7 +71,8 @@ fn recursion( } } else { // find the next piece which has the fewest number of next possible moves - let kinds: Vec = kinds.iter() + let kinds: Vec = kinds + .iter() .map(|kind| { let piece = Piece::from_kind(kind, None); let iterator = board.get_configurations(&piece); @@ -90,24 +90,21 @@ fn recursion( let piece0 = Piece::from_kind(kind, None); // initialised piece if with_parallelisation { board - .get_configurations(&piece0) - .collect::>() - // DEV-NOTE: uses from Rayon - .into_par_iter() - .for_each(|piece| { - recursion_body(tx, board, &piece, kinds, kind, pbar, with_parallelisation); - }) + .get_configurations(&piece0) + .collect::>() + // DEV-NOTE: uses from Rayon + .into_par_iter() + .for_each(|piece| { + recursion_body(tx, board, &piece, kinds, kind, pbar, with_parallelisation); + }) } else { - board - .get_configurations(&piece0) - .for_each(|piece| { + board.get_configurations(&piece0).for_each(|piece| { recursion_body(tx, board, &piece, kinds, kind, pbar, with_parallelisation); }) } } } - fn recursion_body( tx: &Sender, board: &GameBoard, diff --git a/src/bin/games/genius_square/features/feat_initialise_game.rs b/src/bin/games/genius_square/features/feat_initialise_game.rs index 3175eb6..ef35846 100644 --- a/src/bin/games/genius_square/features/feat_initialise_game.rs +++ b/src/bin/games/genius_square/features/feat_initialise_game.rs @@ -18,13 +18,11 @@ use crate::models::board::GameBoard; pub fn feature_initialise_game( rng: &mut ChaCha8Rng, option_roll: Option>, -) -> GameBoard { +) -> GameBoard { // Roll the dice let mut faces = option_roll.unwrap_or_else(|| roll_dice(rng)); faces.sort(); - let dice: Vec = faces.iter() - .map(|face| Die::from_string(face)) - .collect(); + let dice: Vec = faces.iter().map(|face| Die::from_string(face)).collect(); println!("\nRoll: {}", faces.join(" ")); // Establish the problem diff --git a/src/bin/games/genius_square/features/feat_solve_game.rs b/src/bin/games/genius_square/features/feat_solve_game.rs index ec7b26c..90f858e 100644 --- a/src/bin/games/genius_square/features/feat_solve_game.rs +++ b/src/bin/games/genius_square/features/feat_solve_game.rs @@ -14,9 +14,7 @@ use super::constants::TIMEOUT; // ---------------------------------------------------------------- /// Feature to solve the problem -pub fn feature_solve_game( - board: &GameBoard, -) -> Option { +pub fn feature_solve_game(board: &GameBoard) -> Option { print!("\nCompute solution ... "); let rx = solve_brute_force(&board, true); let mut solution: Option = None; @@ -33,7 +31,8 @@ pub fn feature_solve_game( } let dt_total = time.elapsed().unwrap(); - let dt_mean: Duration = if n > 0 {dt_total/n} else {Duration::from_secs(0)}; + #[rustfmt::skip] + let dt_mean: Duration = if n > 0 { dt_total / n } else { Duration::from_secs(0) }; let dt = dt.unwrap_or(dt_total); match solution { // DEV-NOTE: use 'ref' to borrow @@ -43,7 +42,7 @@ pub fn feature_solve_game( println!("Average time per solution: {dt_mean:2?}"); println!("Total time: {dt_total:2?}"); println!("\nSolution 1:\n{}\n", board.pretty()); - }, + } None => { println!("\x1b[91mno solution found!\x1b[0m\n"); } diff --git a/src/bin/games/genius_square/features/mod.rs b/src/bin/games/genius_square/features/mod.rs index 6aa3f76..5987a37 100644 --- a/src/bin/games/genius_square/features/mod.rs +++ b/src/bin/games/genius_square/features/mod.rs @@ -1,5 +1,4 @@ /// Highest logic of application. - pub mod constants; pub mod feat_initialise_game; pub mod feat_solve_game; diff --git a/src/bin/games/genius_square/main.rs b/src/bin/games/genius_square/main.rs index 6a9525d..247af42 100644 --- a/src/bin/games/genius_square/main.rs +++ b/src/bin/games/genius_square/main.rs @@ -8,8 +8,8 @@ use general::app::messages::welcome_screen; use general::_core; mod algorithms; -mod models; mod features; +mod models; use models::constants::NUM_DICE; use features::feature_initialise_game; @@ -21,8 +21,16 @@ use features::feature_solve_game; fn main() { let args: Vec = env::args().skip(1).collect(); - let option_roll = if args.len() >= NUM_DICE { Some(args[0..NUM_DICE].to_vec()) } else { None }; - let option_seed = if args.len() >= 1 { Some(args[args.len() - 1].clone()) } else { None }; + let option_roll = if args.len() >= NUM_DICE { + Some(args[0..NUM_DICE].to_vec()) + } else { + None + }; + let option_seed = if args.len() >= 1 { + Some(args[args.len() - 1].clone()) + } else { + None + }; let mut rng = _core::rand::seed_rng(option_seed); welcome_screen(); let board = feature_initialise_game(&mut rng, option_roll); diff --git a/src/bin/games/genius_square/models/binary_arrays/mod.rs b/src/bin/games/genius_square/models/binary_arrays/mod.rs index b56cd21..886c867 100644 --- a/src/bin/games/genius_square/models/binary_arrays/mod.rs +++ b/src/bin/games/genius_square/models/binary_arrays/mod.rs @@ -1,5 +1,4 @@ /// Models for handling arrays - pub mod models_arrays; pub mod models_grids; diff --git a/src/bin/games/genius_square/models/binary_arrays/models_arrays.rs b/src/bin/games/genius_square/models/binary_arrays/models_arrays.rs index 7351d1c..1d831e3 100644 --- a/src/bin/games/genius_square/models/binary_arrays/models_arrays.rs +++ b/src/bin/games/genius_square/models/binary_arrays/models_arrays.rs @@ -31,23 +31,25 @@ pub struct BinArray { // ---------------------------------------------------------------- impl BinArray { - pub fn from_coords( - coords: Vec<(usize, usize)>, - m: usize, - n: usize, - ) -> Self { + pub fn from_coords(coords: Vec<(usize, usize)>, m: usize, n: usize) -> Self { let mut values = Array2::::zeros((m, n)); for coord in coords { values[[coord.0, coord.1]] = 1; } - Self {m, n, values} + Self { m, n, values } } /// Gets the list of co-ordinates of the entries which are non-zero pub fn to_coords(&self) -> Vec<(usize, usize)> { self.values .indexed_iter() - .filter_map(|((i, j), &v)| if v == 0 { None } else { Some((i, j)) }) + .filter_map(|((i, j), &v)| { + if v == 0 { + None + } else { + Some((i, j)) + } + }) .collect() } @@ -62,7 +64,13 @@ impl BinArray { pub fn get_weight(&self) -> isize { self.values - .mapv(|x| if x == 0 {0} else {1}) + .mapv(|x| { + if x == 0 { + 0 + } else { + 1 + } + }) .sum() } @@ -93,19 +101,21 @@ impl BinArray { pub fn transform_invert(&self) -> Self { let m = self.m; let n = self.n; - let values = self.values.mapv(|x| if x == 0 {1} else {0}); - return Self {m, n, values}; + let values = self.values.mapv(|x| { + if x == 0 { + 1 + } else { + 0 + } + }); + return Self { m, n, values }; } - pub fn transform_shift( - &self, - di: isize, - dj: isize, - ) -> Self { + pub fn transform_shift(&self, di: isize, dj: isize) -> Self { // create blank 3 x 3 meta block let m = self.m; let n = self.n; - let mut slate = Array2::::zeros((3*m, 3*n)); + let mut slate = Array2::::zeros((3 * m, 3 * n)); // slot in values in location shifted from the middle let i0 = self.m as isize + di; @@ -121,15 +131,15 @@ impl BinArray { let j0 = self.n; let j1 = self.n + j0; let values = slate.slice_mut(slice![i0..i1, j0..j1]).to_owned(); - let result = Self {m, n, values}; + let result = Self { m, n, values }; return result; } - pub fn transform_hflip(&self, recentre: bool) -> Self{ + pub fn transform_hflip(&self, recentre: bool) -> Self { let m = self.m; let n = self.n; let values = self.values.slice(slice![.., ..;-1]).to_owned(); - let mut result = Self {m, n, values}; + let mut result = Self { m, n, values }; if recentre { result = result.recentre(); } @@ -140,19 +150,18 @@ impl BinArray { let m = self.m; let n = self.n; let values = self.values.slice(slice![..;-1, ..]).to_owned(); - let mut result = Self {m, n, values}; + let mut result = Self { m, n, values }; if recentre { result = result.recentre(); } return result; - } pub fn transform_transpose(&self, recentre: bool) -> Self { let m = self.m; let n = self.n; let values = self.values.t().to_owned(); - let mut result = Self {m, n, values}; + let mut result = Self { m, n, values }; if recentre { result = result.recentre(); } @@ -163,10 +172,10 @@ impl BinArray { match k { 1 => { return self.transform_transpose(false).transform_vflip(recentre); - }, + } -1 => { return self.transform_vflip(false).transform_transpose(recentre); - }, + } _ => { return self.clone(); } @@ -184,10 +193,8 @@ impl BinArray { let arr3 = arr.transform_shift(0, -1); let arr4 = arr.transform_shift(0, 1); arr = arr + arr1 + arr2 + arr3 + arr4; - let values = arr.values - .slice(slice![1..-1, 1..-1]) - .to_owned(); - let result = Self {m, n, values}; + let values = arr.values.slice(slice![1..-1, 1..-1]).to_owned(); + let result = Self { m, n, values }; return result; } @@ -202,20 +209,13 @@ impl BinArray { /// and provided /// /// - no collisions occur with an optional obstacle. - pub fn get_configurations( - &self, - option_obst: Option<&BinArray>, - ) -> impl Iterator { + pub fn get_configurations(&self, option_obst: Option<&BinArray>) -> impl Iterator { let (m, n) = self.get_shape(); let obst = option_obst.map_or_else(|| BinArray::from_coords(vec![], m, n), |x| x.clone()); let free = obst.transform_invert(); let mut used: Vec = vec![]; - let iterator = iproduct!( - [0, 1, -1], - [false, true], - [false, true], - ) + let iterator = iproduct!([0, 1, -1], [false, true], [false, true],) // iterate through all orientations .map(|(rot, vflip, hflip)| { // recover original @@ -293,7 +293,7 @@ impl Add for BinArray { let n = self.n; let mut values = self.values.to_owned() + other.values.to_owned(); values = values.mapv(|x| x.min(1)); - return Self {m, n, values}; + return Self { m, n, values }; } } @@ -310,7 +310,7 @@ impl Mul for BinArray { let m = self.m; let n = self.n; let values = self.values.to_owned() * other.values.to_owned(); - return Self {m, n, values}; + return Self { m, n, values }; } } diff --git a/src/bin/games/genius_square/models/binary_arrays/models_grids.rs b/src/bin/games/genius_square/models/binary_arrays/models_grids.rs index 03984c1..12ff31d 100644 --- a/src/bin/games/genius_square/models/binary_arrays/models_grids.rs +++ b/src/bin/games/genius_square/models/binary_arrays/models_grids.rs @@ -50,7 +50,7 @@ pub struct BinGrid { impl Boundary { pub fn new(prev: i8, next: i8) -> Self { - Self {prev, next} + Self { prev, next } } pub fn empty() -> Self { @@ -62,20 +62,20 @@ impl Boundaries { pub fn new(left: i8, right: i8, top: i8, bot: i8) -> Self { let h = Boundary::new(left, right); let v = Boundary::new(bot, top); - Self {h, v} + Self { h, v } } pub fn empty() -> Self { let h = Boundary::empty(); let v = Boundary::empty(); - Self {h, v} + Self { h, v } } } impl Node { pub fn new(label: Option, bd: &Boundaries) -> Self { let bd = bd.clone(); - Self {label, bd} + Self { label, bd } } pub fn empty() -> Self { @@ -131,7 +131,7 @@ impl Node { impl BinGrid { pub fn new(m: usize, n: usize) -> Self { let clusters = vec![]; - Self {m, n, clusters} + Self { m, n, clusters } } #[allow(unused)] @@ -155,21 +155,12 @@ impl BinGrid { cluster.mapv(|x| x.bd.h.next) } - pub fn from_coord( - label: &String, - i: usize, - j: usize, - m: usize, - n: usize, - ) -> Self { + pub fn from_coord(label: &String, i: usize, j: usize, m: usize, n: usize) -> Self { let object = BinArray::from_coords(vec![(i, j)], m, n); return Self::from_array(label, &object); } - pub fn from_array( - label: &String, - object: &BinArray, - ) -> Self { + pub fn from_array(label: &String, object: &BinArray) -> Self { let (m, n) = object.get_shape(); let mut cluster = Array2::from_elem((m, n), Node::empty()); let mut result = Self::new(m, n); @@ -232,10 +223,18 @@ impl BinGrid { if let Some(x) = label_ { label = Some(x); } - if bd.v.next == 0 { bd.v.next = bd_.v.next; } - if bd.v.prev == 0 { bd.v.prev = bd_.v.prev; } - if bd.h.next == 0 { bd.h.next = bd_.h.next; } - if bd.h.prev == 0 { bd.h.prev = bd_.h.prev; } + if bd.v.next == 0 { + bd.v.next = bd_.v.next; + } + if bd.v.prev == 0 { + bd.v.prev = bd_.v.prev; + } + if bd.h.next == 0 { + bd.h.next = bd_.h.next; + } + if bd.h.prev == 0 { + bd.h.prev = bd_.h.prev; + } } let node = Node::new(label, &bd); return node; @@ -247,43 +246,49 @@ impl Display for BinGrid { let (m, n) = self.get_shape(); // compute fields of characters - let fields: Vec> = (0.. m).map(|i| { - // compute fields of characters - let fields: Vec> = (0.. n) - // get array of chars representing part of grid - .map(|j| self.get_node(i, j).display_in_grid()) - .collect(); - - // determine size of merge - let m = fields.iter().map(|field_| field_.nrows()).max().unwrap_or(0); - let n = 1 + fields.iter().map(|field_| field_.ncols() - 1).sum::(); - let mut field = Array2::from_elem((m, n), " ".to_string()); - - // h-join chars in grid, taking care of boundaries - let mut j0 = 0; - for (k, field_) in fields.iter().enumerate() { - let m_ = field_.nrows(); - let n_ = field_.ncols(); - let j1 = if k > 0 && n_ > 0 { j0 + n_ - 1 } else { j0 + n_ }; - let mut view = field.slice_mut(slice![..m_, j0.. j1]); - if k == 0 { - view.assign(&field_); - } else { - view.assign(&field_.slice(slice![.., 1..])); - } - // on boundary allow empty values to be overwritten - if j0 > 0 { - for i in 0.. m_ { - if field[(i, j0 - 1)].trim() == "" { - field[(i, j0 - 1)] = field_[(i, 0)].clone(); + let fields: Vec> = (0..m) + .map(|i| { + // compute fields of characters + let fields: Vec> = (0..n) + // get array of chars representing part of grid + .map(|j| self.get_node(i, j).display_in_grid()) + .collect(); + + // determine size of merge + let m = fields.iter().map(|field_| field_.nrows()).max().unwrap_or(0); + let n = 1 + fields.iter().map(|field_| field_.ncols() - 1).sum::(); + let mut field = Array2::from_elem((m, n), " ".to_string()); + + // h-join chars in grid, taking care of boundaries + let mut j0 = 0; + for (k, field_) in fields.iter().enumerate() { + let m_ = field_.nrows(); + let n_ = field_.ncols(); + let j1 = if k > 0 && n_ > 0 { + j0 + n_ - 1 + } else { + j0 + n_ + }; + let mut view = field.slice_mut(slice![..m_, j0..j1]); + if k == 0 { + view.assign(&field_); + } else { + view.assign(&field_.slice(slice![.., 1..])); + } + // on boundary allow empty values to be overwritten + if j0 > 0 { + for i in 0..m_ { + if field[(i, j0 - 1)].trim() == "" { + field[(i, j0 - 1)] = field_[(i, 0)].clone(); + } } } + j0 = j1; } - j0 = j1; - } - return field; - }).collect(); + return field; + }) + .collect(); // determine size of merge let m = 1 + fields.iter().map(|field_| field_.nrows() - 1).sum::(); @@ -295,7 +300,11 @@ impl Display for BinGrid { for (k, field_) in fields.iter().enumerate() { let m_ = field_.nrows(); let n_ = field_.ncols(); - let i1 = if k > 0 && m_ > 0 { i0 + m_ - 1 } else { i0 + m_ }; + let i1 = if k > 0 && m_ > 0 { + i0 + m_ - 1 + } else { + i0 + m_ + }; let mut view = field.slice_mut(slice![i0..i1, ..n_]); if k == 0 { view.assign(&field_); @@ -304,7 +313,7 @@ impl Display for BinGrid { } // on boundary allow empty values to be overwritten if i0 > 0 { - for j in 0.. n_ { + for j in 0..n_ { if field[(i0 - 1, j)].trim() == "" { field[(i0 - 1, j)] = field_[(0, j)].clone(); } diff --git a/src/bin/games/genius_square/models/board/mod.rs b/src/bin/games/genius_square/models/board/mod.rs index c606a33..007ab63 100644 --- a/src/bin/games/genius_square/models/board/mod.rs +++ b/src/bin/games/genius_square/models/board/mod.rs @@ -1,5 +1,4 @@ /// Models for handling game board - pub mod models; pub use models::GameBoard; diff --git a/src/bin/games/genius_square/models/board/models.rs b/src/bin/games/genius_square/models/board/models.rs index 38aea32..29c7afa 100644 --- a/src/bin/games/genius_square/models/board/models.rs +++ b/src/bin/games/genius_square/models/board/models.rs @@ -43,7 +43,12 @@ impl GameBoard { let block = block.clone(); let obstacle_basic = block.clone(); let obstacle_dithered = block.clone(); - return Self {block, obstacle_basic, obstacle_dithered, pieces} + return Self { + block, + obstacle_basic, + obstacle_dithered, + pieces, + }; } pub fn get_shape(&self) -> (usize, usize) { @@ -113,8 +118,10 @@ impl GameBoard { let (m, n) = self.get_shape(); let space = " "; + #[rustfmt::skip] let end1 = format!("{space}\u{02554}\u{02550}\n{space}\u{02551} \n{space}\u{0255A}\u{02550}"); let end2 = format!("\u{02550}\u{02557}\n \u{02551}\n\u{02550}\u{0255D}"); + #[rustfmt::skip] let blocks: Vec = FACE1_FMT.iter().map(|&x| format!("\u{02550}\n{x}\n\u{02550}")).collect(); let sep = format!("\u{02550}\u{02566}\u{02550}\n \u{02551} \n\u{02550}\u{02569}\u{02550}"); let xlabels = join_multiline_strings(&blocks, Some(&sep), ""); @@ -122,6 +129,7 @@ impl GameBoard { let end1 = format!("\u{02554}\u{02550}\u{02550}\u{02550}\u{02557}"); let end2 = format!("\u{0255A}\u{02550}\u{02550}\u{02550}\u{0255D}"); + #[rustfmt::skip] let blocks: Vec = FACE2_FMT.iter().map(|&x| format!("\u{02551} {x} \u{02551}")).collect(); let sep = format!("\n\u{02560}\u{02550}\u{02550}\u{02550}\u{02563}\n"); let ylabels = blocks.join(&sep); @@ -154,12 +162,20 @@ impl GameBoard { let mut trace = Array2::from_elem((m, n), " ".to_string()); let piece = self.get_block(); for (i, j) in piece.to_coords() { - let alpha = if formatted { piece.get_symb_fmt() } else { piece.get_symb() }; + let alpha = if formatted { + piece.get_symb_fmt() + } else { + piece.get_symb() + }; trace[[i, j]] = alpha; } for (_, piece) in self.pieces.iter() { for (i, j) in piece.to_coords() { - let alpha = if formatted { piece.get_symb_fmt() } else { piece.get_symb() }; + let alpha = if formatted { + piece.get_symb_fmt() + } else { + piece.get_symb() + }; trace[[i, j]] = alpha; } } @@ -171,7 +187,8 @@ impl GameBoard { let hbar = "\u{2500}".repeat(n + 2); let top = format!("\u{250C}{hbar}\u{2510}"); let bot = format!("\u{2514}{hbar}\u{2518}"); - let middle = field.rows() + let middle = field + .rows() .into_iter() .map(|row| { let line = row.iter().map(|s| s.as_str()).collect::(); diff --git a/src/bin/games/genius_square/models/constants/dice.rs b/src/bin/games/genius_square/models/constants/dice.rs index c8302d5..a6ab8da 100644 --- a/src/bin/games/genius_square/models/constants/dice.rs +++ b/src/bin/games/genius_square/models/constants/dice.rs @@ -8,23 +8,9 @@ // CONSTANTS // ---------------------------------------------------------------- -pub const FACE1: &[&str] = &[ - "A", - "B", - "C", - "D", - "E", - "F", -]; +pub const FACE1: &[&str] = &["A", "B", "C", "D", "E", "F"]; -pub const FACE2: &[&str] = &[ - "1", - "2", - "3", - "4", - "5", - "6", -]; +pub const FACE2: &[&str] = &["1", "2", "3", "4", "5", "6"]; pub const FACE1_FMT: &[&str] = &[ "\x1b[3mA\x1b[0m", @@ -45,13 +31,13 @@ pub const FACE2_FMT: &[&str] = &[ ]; pub const DICE: &[&[&str]] = &[ - &["A5","A5","F2","F2","E1","B6"], - &["A6","A6","A6","F1","F1","F1"], - &["D5","E4","E5","E6","F4","F5"], - &["A2","A3","B1","B2","B3","C2"], - &["A1","C1","D1","D2","E2","F3"], - &["B4","C3","C4","D3","D4","E3"], - &["A4","B5","C5","C6","D6","F6"], + &["A5", "A5", "F2", "F2", "E1", "B6"], + &["A6", "A6", "A6", "F1", "F1", "F1"], + &["D5", "E4", "E5", "E6", "F4", "F5"], + &["A2", "A3", "B1", "B2", "B3", "C2"], + &["A1", "C1", "D1", "D2", "E2", "F3"], + &["B4", "C3", "C4", "D3", "D4", "E3"], + &["A4", "B5", "C5", "C6", "D6", "F6"], ]; pub const NUM_DICE: usize = DICE.len(); diff --git a/src/bin/games/genius_square/models/constants/enums.rs b/src/bin/games/genius_square/models/constants/enums.rs index 0477577..f896b3e 100644 --- a/src/bin/games/genius_square/models/constants/enums.rs +++ b/src/bin/games/genius_square/models/constants/enums.rs @@ -30,6 +30,7 @@ pub enum EnumPiece { Z, } +#[rustfmt::skip] pub const ENUM_PIECES: &[EnumPiece] = &[ EnumPiece::Symb1, EnumPiece::Symb2, @@ -42,6 +43,7 @@ pub const ENUM_PIECES: &[EnumPiece] = &[ EnumPiece::Z, ]; +#[rustfmt::skip] pub const NON_ADJACENT: &[EnumPiece] = &[ EnumPiece::Symb1, EnumPiece::Symb2, diff --git a/src/bin/games/genius_square/models/constants/mod.rs b/src/bin/games/genius_square/models/constants/mod.rs index 2c38f3a..db6cf88 100644 --- a/src/bin/games/genius_square/models/constants/mod.rs +++ b/src/bin/games/genius_square/models/constants/mod.rs @@ -1,5 +1,4 @@ /// Models for handling constants - pub mod board; pub mod dice; pub mod enums; diff --git a/src/bin/games/genius_square/models/dice/methods.rs b/src/bin/games/genius_square/models/dice/methods.rs index 97b40e3..4c751ef 100644 --- a/src/bin/games/genius_square/models/dice/methods.rs +++ b/src/bin/games/genius_square/models/dice/methods.rs @@ -11,11 +11,6 @@ use crate::models::constants::DICE; // METHODS // ---------------------------------------------------------------- -pub fn roll_dice( - rng: &mut ChaCha8Rng, -) -> Vec { - DICE - .iter() - .map(|die| die.choose(rng).unwrap().to_string()) - .collect() +pub fn roll_dice(rng: &mut ChaCha8Rng) -> Vec { + DICE.iter().map(|die| die.choose(rng).unwrap().to_string()).collect() } diff --git a/src/bin/games/genius_square/models/dice/mod.rs b/src/bin/games/genius_square/models/dice/mod.rs index 21d59c4..507e6f8 100644 --- a/src/bin/games/genius_square/models/dice/mod.rs +++ b/src/bin/games/genius_square/models/dice/mod.rs @@ -1,5 +1,4 @@ /// Models for handling dice - pub mod methods; pub mod models; diff --git a/src/bin/games/genius_square/models/dice/models.rs b/src/bin/games/genius_square/models/dice/models.rs index 9465c6c..6265ca3 100644 --- a/src/bin/games/genius_square/models/dice/models.rs +++ b/src/bin/games/genius_square/models/dice/models.rs @@ -31,10 +31,7 @@ impl Die { let char2 = chars.get(1).unwrap(); let index1 = FACE1.iter().position(|x| x == char1).unwrap(); let index2 = FACE2.iter().position(|x| x == char2).unwrap(); - return Die { - i: index2, - j: index1, - } + return Die { i: index2, j: index1 }; } pub fn to_string(&self) -> String { @@ -45,12 +42,12 @@ impl Die { #[allow(unused)] pub fn from_coords(i: usize, j: usize) -> Die { - return Die {i, j} + return Die { i, j }; } #[allow(unused)] pub fn to_coords(&self) -> (usize, usize) { - return (self.i, self.j) + return (self.i, self.j); } } diff --git a/src/bin/games/genius_square/models/mod.rs b/src/bin/games/genius_square/models/mod.rs index fc7eabe..79f0a37 100644 --- a/src/bin/games/genius_square/models/mod.rs +++ b/src/bin/games/genius_square/models/mod.rs @@ -1,5 +1,4 @@ /// Models used in game. - pub mod binary_arrays; pub mod board; pub mod constants; diff --git a/src/bin/games/genius_square/models/pieces/mod.rs b/src/bin/games/genius_square/models/pieces/mod.rs index 666e0a2..7e360fd 100644 --- a/src/bin/games/genius_square/models/pieces/mod.rs +++ b/src/bin/games/genius_square/models/pieces/mod.rs @@ -1,5 +1,4 @@ /// Models for handling pieces - pub mod models; pub use models::Piece; diff --git a/src/bin/games/genius_square/models/pieces/models.rs b/src/bin/games/genius_square/models/pieces/models.rs index e7a2fd7..42079d9 100644 --- a/src/bin/games/genius_square/models/pieces/models.rs +++ b/src/bin/games/genius_square/models/pieces/models.rs @@ -34,22 +34,19 @@ impl Piece { pub fn from_kind(kind: &EnumPiece, positions: Option) -> Self { let kind = kind.clone(); let positions = positions.unwrap_or_else(|| kind.get_positions()); - Self {kind, positions} + Self { kind, positions } } pub fn get_shape(&self) -> (usize, usize) { self.positions.get_shape() } - pub fn from_coords( - coords: Vec<(usize, usize)>, - option_kind: Option, - ) -> Self { + pub fn from_coords(coords: Vec<(usize, usize)>, option_kind: Option) -> Self { let m = GRID_HEIGHT; let n = GRID_WIDTH; let positions = BinArray::from_coords(coords, m, n); let kind = option_kind.unwrap_or(EnumPiece::Blank); - Self {kind, positions} + Self { kind, positions } } pub fn to_coords(&self) -> Vec<(usize, usize)> { @@ -92,7 +89,10 @@ impl Piece { let hbar = "\u{2500}".repeat(n + 2); let top = format!("\u{250C}{hbar}\u{2510}"); let bot = format!("\u{2514}{hbar}\u{2518}"); - let middle = self.positions.get_values().rows() + let middle = self + .positions + .get_values() + .rows() .into_iter() .map(|row| { let line = row @@ -118,7 +118,7 @@ impl Piece { pub fn transform_hflip(&self, recentre: bool) -> Self { let kind = self.get_kind(); let positions = self.positions.transform_hflip(recentre); - let result = Self{kind, positions}; + let result = Self { kind, positions }; return result; } @@ -126,16 +126,15 @@ impl Piece { pub fn transform_vflip(&self, recentre: bool) -> Self { let kind = self.get_kind(); let positions = self.positions.transform_vflip(recentre); - let result = Self {kind, positions}; + let result = Self { kind, positions }; return result; - } #[allow(unused)] pub fn transform_transpose(&self, recentre: bool) -> Self { let kind = self.get_kind(); let positions = self.positions.transform_transpose(recentre); - let result = Self {kind, positions}; + let result = Self { kind, positions }; return result; } @@ -143,19 +142,15 @@ impl Piece { pub fn transform_rotate(&self, k: i8, recentre: bool) -> Self { let kind = self.get_kind(); let positions = self.positions.transform_rotate(k, recentre); - let result = Self {kind, positions}; + let result = Self { kind, positions }; return result; } #[allow(unused)] - pub fn transform_shift( - &self, - di: isize, - dj: isize, - ) -> Self { + pub fn transform_shift(&self, di: isize, dj: isize) -> Self { let kind = self.get_kind(); let positions = self.positions.transform_shift(di, dj); - let result = Self {kind, positions}; + let result = Self { kind, positions }; return result; } @@ -163,7 +158,7 @@ impl Piece { pub fn transform_dither(&self) -> Self { let kind = self.get_kind(); let positions = self.positions.transform_dither(); - let result = Self {kind, positions}; + let result = Self { kind, positions }; return result; } } @@ -180,7 +175,7 @@ impl Add for Piece { fn add(self, other: Self) -> Self::Output { let kind = self.get_kind(); let positions = self.get_positions().to_owned() + other.get_positions().to_owned(); - return Self {kind, positions}; + return Self { kind, positions }; } } @@ -196,7 +191,7 @@ impl Mul for Piece { fn mul(self, other: Self) -> Self::Output { let kind = self.get_kind(); let positions = self.get_positions().to_owned() * other.get_positions().to_owned(); - return Self {kind, positions}; + return Self { kind, positions }; } } From dbbd0165cb566e35dd354fc5b29785b37b5c8e80 Mon Sep 17 00:00:00 2001 From: raj-open Date: Sun, 7 Sep 2025 20:51:29 +0200 Subject: [PATCH 36/41] story-gs > staging: updated workflows --- .github/workflows/auto.yaml | 6 +++--- .github/workflows/deploy.yaml | 6 +++--- .github/workflows/manual.yaml | 6 +++--- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/.github/workflows/auto.yaml b/.github/workflows/auto.yaml index 8ec323c..929b862 100644 --- a/.github/workflows/auto.yaml +++ b/.github/workflows/auto.yaml @@ -41,7 +41,7 @@ jobs: env: {} steps: - - uses: actions/checkout@v4.2.2 + - uses: actions/checkout@v5.0.0 - name: Action - install justfile tool uses: extractions/setup-just@v3 @@ -54,7 +54,7 @@ jobs: version: "0.12.0" # - name: Action - install rust - # uses: actions-rust-lang/setup-rust-toolchain@v1.12.0 + # uses: actions-rust-lang/setup-rust-toolchain@v1.14.1 - name: Action - install rust and set to stable uses: actions-rs/toolchain@v1.0.6 @@ -63,7 +63,7 @@ jobs: override: true - name: Action - install Python - uses: actions/setup-python@v5.6.0 + uses: actions/setup-python@v6.0.0 with: python-version: "${{ env.PYTHON_VERSION }}" diff --git a/.github/workflows/deploy.yaml b/.github/workflows/deploy.yaml index 6980fce..0fd6a00 100644 --- a/.github/workflows/deploy.yaml +++ b/.github/workflows/deploy.yaml @@ -32,7 +32,7 @@ jobs: env: {} steps: - - uses: actions/checkout@v4.2.2 + - uses: actions/checkout@v5.0.0 - name: Action - install justfile tool uses: extractions/setup-just@v3 @@ -45,7 +45,7 @@ jobs: version: "0.12.0" # - name: Action - install rust - # uses: actions-rust-lang/setup-rust-toolchain@v1.12.0 + # uses: actions-rust-lang/setup-rust-toolchain@v1.14.1 - name: Action - install rust and set to stable uses: actions-rs/toolchain@v1.0.6 @@ -54,7 +54,7 @@ jobs: override: true - name: Action - install Python - uses: actions/setup-python@v5.6.0 + uses: actions/setup-python@v6.0.0 with: python-version: "${{ env.PYTHON_VERSION }}" diff --git a/.github/workflows/manual.yaml b/.github/workflows/manual.yaml index c3f7675..e7bd725 100644 --- a/.github/workflows/manual.yaml +++ b/.github/workflows/manual.yaml @@ -39,7 +39,7 @@ jobs: env: {} steps: - - uses: actions/checkout@v4.2.2 + - uses: actions/checkout@v5.0.0 - name: Action - install justfile tool uses: extractions/setup-just@v3 @@ -52,7 +52,7 @@ jobs: version: "0.12.0" # - name: Action - install rust - # uses: actions-rust-lang/setup-rust-toolchain@v1.12.0 + # uses: actions-rust-lang/setup-rust-toolchain@v1.14.1 - name: Action - install rust and set to stable uses: actions-rs/toolchain@v1.0.6 @@ -61,7 +61,7 @@ jobs: override: true - name: Action - install Python - uses: actions/setup-python@v5.6.0 + uses: actions/setup-python@v6.0.0 with: python-version: "${{ env.PYTHON_VERSION }}" From 8c7c164f3ced795d0c0dee125d730364bb6ee045 Mon Sep 17 00:00:00 2001 From: raj-open Date: Sun, 7 Sep 2025 21:03:18 +0200 Subject: [PATCH 37/41] story-gs > staging: removed `#[rustfmt::skip]` as incompatible with tests --- .../games/genius_square/features/feat_solve_game.rs | 7 +++++-- src/bin/games/genius_square/models/board/models.rs | 12 ++++++------ .../games/genius_square/models/constants/enums.rs | 10 ++-------- .../mathematics/scalar_products/approach1.rs | 3 +-- .../mathematics/scalar_products/approach2.rs | 3 +-- .../problem10_prime_summation/approach1.rs | 3 +-- 6 files changed, 16 insertions(+), 22 deletions(-) diff --git a/src/bin/games/genius_square/features/feat_solve_game.rs b/src/bin/games/genius_square/features/feat_solve_game.rs index 90f858e..6f5b38c 100644 --- a/src/bin/games/genius_square/features/feat_solve_game.rs +++ b/src/bin/games/genius_square/features/feat_solve_game.rs @@ -31,8 +31,11 @@ pub fn feature_solve_game(board: &GameBoard) -> Option { } let dt_total = time.elapsed().unwrap(); - #[rustfmt::skip] - let dt_mean: Duration = if n > 0 { dt_total / n } else { Duration::from_secs(0) }; + let dt_mean: Duration = if n > 0 { + dt_total / n + } else { + Duration::from_secs(0) + }; let dt = dt.unwrap_or(dt_total); match solution { // DEV-NOTE: use 'ref' to borrow diff --git a/src/bin/games/genius_square/models/board/models.rs b/src/bin/games/genius_square/models/board/models.rs index 29c7afa..ee37faf 100644 --- a/src/bin/games/genius_square/models/board/models.rs +++ b/src/bin/games/genius_square/models/board/models.rs @@ -118,19 +118,19 @@ impl GameBoard { let (m, n) = self.get_shape(); let space = " "; - #[rustfmt::skip] - let end1 = format!("{space}\u{02554}\u{02550}\n{space}\u{02551} \n{space}\u{0255A}\u{02550}"); + let end1 = + format!("{space}\u{02554}\u{02550}\n{space}\u{02551} \n{space}\u{0255A}\u{02550}"); let end2 = format!("\u{02550}\u{02557}\n \u{02551}\n\u{02550}\u{0255D}"); - #[rustfmt::skip] - let blocks: Vec = FACE1_FMT.iter().map(|&x| format!("\u{02550}\n{x}\n\u{02550}")).collect(); + let blocks: Vec = + FACE1_FMT.iter().map(|&x| format!("\u{02550}\n{x}\n\u{02550}")).collect(); let sep = format!("\u{02550}\u{02566}\u{02550}\n \u{02551} \n\u{02550}\u{02569}\u{02550}"); let xlabels = join_multiline_strings(&blocks, Some(&sep), ""); let xlabels = join_multiline_strings(&[end1, xlabels, end2].to_vec(), None, ""); let end1 = format!("\u{02554}\u{02550}\u{02550}\u{02550}\u{02557}"); let end2 = format!("\u{0255A}\u{02550}\u{02550}\u{02550}\u{0255D}"); - #[rustfmt::skip] - let blocks: Vec = FACE2_FMT.iter().map(|&x| format!("\u{02551} {x} \u{02551}")).collect(); + let blocks: Vec = + FACE2_FMT.iter().map(|&x| format!("\u{02551} {x} \u{02551}")).collect(); let sep = format!("\n\u{02560}\u{02550}\u{02550}\u{02550}\u{02563}\n"); let ylabels = blocks.join(&sep); let ylabels = [end1, ylabels, end2].join("\n"); diff --git a/src/bin/games/genius_square/models/constants/enums.rs b/src/bin/games/genius_square/models/constants/enums.rs index f896b3e..1ae05f7 100644 --- a/src/bin/games/genius_square/models/constants/enums.rs +++ b/src/bin/games/genius_square/models/constants/enums.rs @@ -30,7 +30,6 @@ pub enum EnumPiece { Z, } -#[rustfmt::skip] pub const ENUM_PIECES: &[EnumPiece] = &[ EnumPiece::Symb1, EnumPiece::Symb2, @@ -43,13 +42,8 @@ pub const ENUM_PIECES: &[EnumPiece] = &[ EnumPiece::Z, ]; -#[rustfmt::skip] -pub const NON_ADJACENT: &[EnumPiece] = &[ - EnumPiece::Symb1, - EnumPiece::Symb2, - EnumPiece::Symb3, - EnumPiece::C, -]; +pub const NON_ADJACENT: &[EnumPiece] = + &[EnumPiece::Symb1, EnumPiece::Symb2, EnumPiece::Symb3, EnumPiece::C]; // ---------------------------------------------------------------- // IMPLEMENTATIONS diff --git a/src/problems/hackerrank/mathematics/scalar_products/approach1.rs b/src/problems/hackerrank/mathematics/scalar_products/approach1.rs index 356ea53..4794f13 100644 --- a/src/problems/hackerrank/mathematics/scalar_products/approach1.rs +++ b/src/problems/hackerrank/mathematics/scalar_products/approach1.rs @@ -4,12 +4,11 @@ /// but rather designe do provid a more "rust native" approach. /// /// In paricular we rely on constructing iterables. +// -#[rustfmt::skip] // ---------------------------------------------------------------- // IMPORTS // ---------------------------------------------------------------- - use core::iter::IntoIterator; use core::iter::Iterator; // use core::convert::TryFrom; diff --git a/src/problems/hackerrank/mathematics/scalar_products/approach2.rs b/src/problems/hackerrank/mathematics/scalar_products/approach2.rs index 31db704..211d296 100644 --- a/src/problems/hackerrank/mathematics/scalar_products/approach2.rs +++ b/src/problems/hackerrank/mathematics/scalar_products/approach2.rs @@ -47,12 +47,11 @@ /// ``` /// O(n) + O(n) = O(n) /// ``` +// -#[rustfmt::skip] // ---------------------------------------------------------------- // IMPORTS // ---------------------------------------------------------------- - use std::fmt::Debug; use std::fmt::Display; use std::io; diff --git a/src/problems/hackerrank/project_euler/problem10_prime_summation/approach1.rs b/src/problems/hackerrank/project_euler/problem10_prime_summation/approach1.rs index 97bad37..ee7c642 100644 --- a/src/problems/hackerrank/project_euler/problem10_prime_summation/approach1.rs +++ b/src/problems/hackerrank/project_euler/problem10_prime_summation/approach1.rs @@ -3,12 +3,11 @@ /// Computes Primes using the Sieve of Eratosthenes. /// Then efficiently computes the cumulutative sum of primes /// below certain integers. +// -#[rustfmt::skip] // ---------------------------------------------------------------- // IMPORTS // ---------------------------------------------------------------- - use std::io; use std::io::BufRead; use std::clone::Clone; From fe9927fd278cc7dff7bf5d1fdd7f1fa2ad4293bc Mon Sep 17 00:00:00 2001 From: raj-open Date: Sun, 7 Sep 2025 21:04:37 +0200 Subject: [PATCH 38/41] story-gs > staging: set targets in all uses of cargo --- justfile | 53 ++++++++++++++++++++++++++--------------------------- 1 file changed, 26 insertions(+), 27 deletions(-) diff --git a/justfile b/justfile index b60acda..1d1f00e 100644 --- a/justfile +++ b/justfile @@ -120,9 +120,9 @@ build-requirements: @just build-requirements-dependencies build-requirements-basic: - @cargo update --verbose - @cargo install --locked --force cargo-zigbuild - @# cargo install --locked --force rustfmt + @cargo +stable update --verbose + @cargo +stable install --locked --force cargo +stable-zigbuild + @# cargo +stable install --locked --force rustfmt @{{PYVENV_ON}} && {{PYVENV}} -m pip install --upgrade pip @{{PYVENV_ON}} && {{PYVENV}} -m pip install ruff uv @@ -136,9 +136,10 @@ build-requirements-dependencies: @{{PYVENV_ON}} && {{PYVENV}} -m uv sync build-compile module="${MAIN_MODULE}": - @# cargo zigbuild --target-dir "target" --release --lib + @rustup override set stable + @# cargo +stable zigbuild --target-dir "target" --release --lib @- rm "dist/{{module}}" 2> /dev/null - @cargo zigbuild --target-dir "target" --release --bin "{{module}}" + @cargo +stable zigbuild --target-dir "target" --release --bin "{{module}}" @cp "target/release/{{module}}" dist # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -151,7 +152,7 @@ run-py module="main" *args="": run-rust module="${MAIN_MODULE}" *args="": @just build-compile "{{module}}" @# "dist/{{module}}" {{args}} - @cargo run --release --bin "{{module}}" {{args}} + @cargo +stable run --release --bin "{{module}}" {{args}} # -------------------------------- # TARGETS: development @@ -163,7 +164,7 @@ dev *args: dev-rust module="${MAIN_MODULE}" *args="": @just build-compile "{{module}}" @# "./target/release/{{module}}" {{args}} - @cargo run --bin "{{module}}" {{args}} + @cargo +stable run --bin "{{module}}" {{args}} # -------------------------------- # TARGETS: tests @@ -178,41 +179,39 @@ tests-logs log_path="logs": @just _display-logs test-unit path *args: - @cargo zigbuild --tests + @cargo +stable zigbuild --tests @echo "run unit tests in $( just _rust_path_to_test_module "{{path}}")" - @cargo test --lib "$( just _rust_path_to_test_module "{{path}}")" {{args}} -- --nocapture + @cargo +stable test --lib "$( just _rust_path_to_test_module "{{path}}")" {{args}} -- --nocapture @# echo "run unit tests in $( just _rust_path_to_module "{{path}}")" - @# cargo test --lib "$( just _rust_path_to_module "{{path}}")" {{args}} -- --nocapture + @# cargo +stable test --lib "$( just _rust_path_to_module "{{path}}")" {{args}} -- --nocapture test-unit-optimised path *args: - @cargo zigbuild --tests --release + @cargo +stable zigbuild --tests --release @echo "run unit tests in $( just _rust_path_to_test_module "{{path}}")" - @cargo test --lib "$( just _rust_path_to_test_module "{{path}}")" {{args}} -- --nocapture + @cargo +stable test --lib "$( just _rust_path_to_test_module "{{path}}")" {{args}} -- --nocapture @# echo "run unit tests in $( just _rust_path_to_module "{{path}}")" - @# cargo test --lib "$( just _rust_path_to_module "{{path}}")" {{args}} -- --nocapture + @# cargo +stable test --lib "$( just _rust_path_to_module "{{path}}")" {{args}} -- --nocapture tests-unit *args: @just _reset-logs - @cargo zigbuild --tests - @cargo test --lib {{args}} -- --nocapture + @cargo +stable zigbuild --tests + @cargo +stable test --lib {{args}} -- --nocapture tests-unit-optimised *args: @just _reset-logs - @cargo zigbuild --tests --release - @cargo test --lib {{args}} -- --nocapture + @cargo +stable zigbuild --tests --release + @cargo +stable test --lib {{args}} -- --nocapture # -------------------------------- # TARGETS: prettify # -------------------------------- prettify: - @rustup override set nightly - @- cargo +nightly fmt --all --verbose -- --config-path rustfmt.toml - @rustup override set stable + @cargo +nightly fmt --all --verbose -- --config-path rustfmt.toml prettify-dry: @echo "Not yet implemented" - @# cargo fmt --verbose --check + @# cargo +stable fmt --verbose --check # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # TARGETS: clean @@ -226,7 +225,7 @@ clean-basic log_path="logs": @echo "All system artefacts will be force removed." @- just _clean-all-files "." ".DS_Store" 2> /dev/null @echo "All build artefacts will be force removed." - @cargo clean + @cargo +stable clean @just _clean-all-files "." "*.rs.bk" @- rm -rf ".venv" 2> /dev/null @- rm -rf "target" 2> /dev/null @@ -284,14 +283,14 @@ watch-logs-all n="10": check-system: @echo "Operating System detected: {{os_family()}}" - @echo "Cargo command: $( cargo --version )" + @echo "cargo +stable command: $( cargo +stable --version )" @echo "Rustc command: $( rustc --version )" @echo "Python command used: ${PYTHON_PATH}" @echo "Python command for venv: {{PYVENV}}" @echo "Python path for venv: $( {{PYVENV_ON}} && which {{PYVENV}} )" - @echo "Cargo Zigbuild: $( cargo-zigbuild --version )" + @echo "cargo +stable Zigbuild: $( cargo +stable-zigbuild --version )" check-system-requirements: - @just _check-tool "cargo" "cargo" - @# just _check-tool "cargo fmt -- --force" "cargo fmt" - @just _check-tool "cargo-zigbuild" "cargo-zigbuild" + @just _check-tool "cargo +stable" "cargo +stable" + @# just _check-tool "cargo +stable fmt -- --force" "cargo +stable fmt" + @just _check-tool "cargo +stable-zigbuild" "cargo +stable-zigbuild" From 24515b1b3ad5f8bb2d5e245583d8fb3864d8b962 Mon Sep 17 00:00:00 2001 From: raj-open Date: Sun, 7 Sep 2025 21:11:17 +0200 Subject: [PATCH 39/41] story-gs > staging: minor corrections to recipes --- justfile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/justfile b/justfile index 1d1f00e..b111518 100644 --- a/justfile +++ b/justfile @@ -121,7 +121,7 @@ build-requirements: build-requirements-basic: @cargo +stable update --verbose - @cargo +stable install --locked --force cargo +stable-zigbuild + @cargo +stable install --locked --force cargo-zigbuild @# cargo +stable install --locked --force rustfmt @{{PYVENV_ON}} && {{PYVENV}} -m pip install --upgrade pip @{{PYVENV_ON}} && {{PYVENV}} -m pip install ruff uv @@ -288,9 +288,9 @@ check-system: @echo "Python command used: ${PYTHON_PATH}" @echo "Python command for venv: {{PYVENV}}" @echo "Python path for venv: $( {{PYVENV_ON}} && which {{PYVENV}} )" - @echo "cargo +stable Zigbuild: $( cargo +stable-zigbuild --version )" + @echo "cargo +stable Zigbuild: $( cargo-zigbuild --version )" check-system-requirements: @just _check-tool "cargo +stable" "cargo +stable" @# just _check-tool "cargo +stable fmt -- --force" "cargo +stable fmt" - @just _check-tool "cargo +stable-zigbuild" "cargo +stable-zigbuild" + @just _check-tool "cargo-zigbuild" "cargo-zigbuild" From bb67e1cabc91a1f5047e73f002e7f9afd76e158f Mon Sep 17 00:00:00 2001 From: raj-open Date: Sun, 7 Sep 2025 21:12:06 +0200 Subject: [PATCH 40/41] story-gs > staging: updated locks --- Cargo.lock | 389 ++++++++++++++++++++++++----------------------------- uv.lock | 4 +- 2 files changed, 179 insertions(+), 214 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 2f9f790..d823f33 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -22,9 +22,9 @@ dependencies = [ [[package]] name = "anstream" -version = "0.6.18" +version = "0.6.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8acc5369981196006228e28809f761875c0327210a891e941f4c683b3a99529b" +checksum = "3ae563653d1938f79b1ab1b5e668c87c76a9930414574a6583a7b7e11a8e6192" dependencies = [ "anstyle", "anstyle-parse", @@ -37,44 +37,44 @@ dependencies = [ [[package]] name = "anstyle" -version = "1.0.10" +version = "1.0.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "55cc3b69f167a1ef2e161439aa98aed94e6028e5f9a59be9a6ffb47aef1651f9" +checksum = "862ed96ca487e809f1c8e5a8447f6ee2cf102f846893800b20cebdf541fc6bbd" [[package]] name = "anstyle-parse" -version = "0.2.6" +version = "0.2.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3b2d16507662817a6a20a9ea92df6652ee4f94f914589377d69f3b21bc5798a9" +checksum = "4e7644824f0aa2c7b9384579234ef10eb7efb6a0deb83f9630a49594dd9c15c2" dependencies = [ "utf8parse", ] [[package]] name = "anstyle-query" -version = "1.1.2" +version = "1.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "79947af37f4177cfead1110013d678905c37501914fba0efea834c3fe9a8d60c" +checksum = "9e231f6134f61b71076a3eab506c379d4f36122f2af15a9ff04415ea4c3339e2" dependencies = [ - "windows-sys 0.59.0", + "windows-sys 0.60.2", ] [[package]] name = "anstyle-wincon" -version = "3.0.7" +version = "3.0.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ca3534e77181a9cc07539ad51f2141fe32f6c3ffd4df76db8ad92346b003ae4e" +checksum = "3e0633414522a32ffaac8ac6cc8f748e090c5717661fddeea04219e2344f5f2a" dependencies = [ "anstyle", - "once_cell", - "windows-sys 0.59.0", + "once_cell_polyfill", + "windows-sys 0.60.2", ] [[package]] name = "anyhow" -version = "1.0.98" +version = "1.0.99" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e16d2d3311acee920a9eb8d33b8cbc1787ce4a264e85f964c2404b969bdcd487" +checksum = "b0674a1ddeecb70197781e945de4b3b8ffb61fa939a5597bcf48503737663100" [[package]] name = "autocfg" @@ -82,14 +82,14 @@ version = "0.1.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0dde43e75fd43e8a1bf86103336bc699aa8d17ad1be60c76c0bdfd4828e19b78" dependencies = [ - "autocfg 1.4.0", + "autocfg 1.5.0", ] [[package]] name = "autocfg" -version = "1.4.0" +version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ace50bade8e6234aa140d9a2f552bbee1db4d353f69b8217bc503490fc1a9f26" +checksum = "c08606f8c3cbf4ce6ec8e28fb0014a2c086708fe954eaa885384a6165172e7e8" [[package]] name = "bitflags" @@ -105,9 +105,9 @@ checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" [[package]] name = "bitflags" -version = "2.9.0" +version = "2.9.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5c8214115b7bf84099f1309324e63141d4c5d7cc26862f97a0a857dbefe165bd" +checksum = "2261d10cca569e4643e526d8dc2e62e433cc8aba21ab764233731f8d369bf394" [[package]] name = "bumpalo" @@ -117,30 +117,30 @@ checksum = "46c5e41b57b8bba42a04676d81cb89e9ee8e859a1a66f80a5a72e1cb76b34d43" [[package]] name = "camino" -version = "1.1.9" +version = "1.1.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8b96ec4966b5813e2c0507c1f86115c8c5abaadc3980879c3424042a02fd1ad3" +checksum = "dd0b03af37dad7a14518b7691d81acb0f8222604ad3d1b02f6b4bed5188c0cd5" dependencies = [ "serde", ] [[package]] name = "cargo-config2" -version = "0.1.32" +version = "0.1.36" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6dc3749a36e0423c991f1e7a3e4ab0c36a1f489658313db4b187d401d79cc461" +checksum = "bdb1d44c72604e6dac5d86fb04a07489b78d2e766a6e06c69c0af09af6e294fc" dependencies = [ "serde", "serde_derive", - "toml_edit", - "windows-sys 0.59.0", + "toml 0.9.5", + "windows-sys 0.61.0", ] [[package]] name = "cargo-options" -version = "0.7.5" +version = "0.7.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7488e41578691cf26aa5c8eccd183cb31752fcb68b9c5b1e88e6727a83c78171" +checksum = "f89e1d6d6f65fe04d5e21be9de19d31a074e3b7e43aa39ee5b85f4cee16c3188" dependencies = [ "anstyle", "clap", @@ -192,20 +192,20 @@ dependencies = [ "semver 1.0.26", "serde", "serde_json", - "thiserror 2.0.12", + "thiserror 2.0.16", ] [[package]] name = "cfg-if" -version = "1.0.0" +version = "1.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" +checksum = "2fd1289c04a9ea8cb22300a459a72a385d7c73d3259e2ed7dcb2af674838cfa9" [[package]] name = "clap" -version = "4.5.38" +version = "4.5.47" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ed93b9805f8ba930df42c2590f05453d5ec36cbb85d018868a5b24d31f6ac000" +checksum = "7eac00902d9d136acd712710d71823fb8ac8004ca445a89e73a41d45aa712931" dependencies = [ "clap_builder", "clap_derive", @@ -213,9 +213,9 @@ dependencies = [ [[package]] name = "clap_builder" -version = "4.5.38" +version = "4.5.47" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "379026ff283facf611b0ea629334361c4211d1b12ee01024eec1591133b04120" +checksum = "2ad9bbf750e73b5884fb8a211a9424a1906c1e156724260fdae972f31d70e1d6" dependencies = [ "anstream", "anstyle", @@ -226,21 +226,21 @@ dependencies = [ [[package]] name = "clap_derive" -version = "4.5.32" +version = "4.5.47" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "09176aae279615badda0765c0c0b3f6ed53f4709118af73cf4655d85d1530cd7" +checksum = "bbfd7eae0b0f1a6e63d4b13c9c478de77c2eb546fba158ad50b4203dc24b9f9c" dependencies = [ "heck", "proc-macro2", "quote", - "syn 2.0.101", + "syn 2.0.106", ] [[package]] name = "clap_lex" -version = "0.7.4" +version = "0.7.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f46ad14479a25103f283c0f10005961cf086d8dc42205bb44c46ac563475dca6" +checksum = "b94f61472cee1439c0b966b47e3aca9ae07e45d070759512cd390ea2bebc6675" [[package]] name = "cloudabi" @@ -253,9 +253,9 @@ dependencies = [ [[package]] name = "colorchoice" -version = "1.0.3" +version = "1.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5b63caa9aa9397e2d9480a9b13673856c78d8ac123288526c37d7839f2a86990" +checksum = "b05b61dc5112cbb17e4b6cd61790d9845d13888356391624cbe7e41efeac1e75" [[package]] name = "console" @@ -266,7 +266,7 @@ dependencies = [ "encode_unicode", "libc", "once_cell", - "unicode-width 0.2.1", + "unicode-width", "windows-sys 0.60.2", ] @@ -318,7 +318,7 @@ checksum = "a8a3dee4e932355439992a45dc631b0979abf9c677958674bd94298bf9002870" dependencies = [ "proc-macro2", "quote", - "syn 2.0.101", + "syn 2.0.106", ] [[package]] @@ -395,12 +395,12 @@ checksum = "877a4ace8713b0bcf2a4e7eec82529c029f1d0619886d18145fea96c3ffe5c0f" [[package]] name = "errno" -version = "0.3.11" +version = "0.3.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "976dd42dc7e85965fe702eb8164f21f450704bdde31faefd6471dba214cb594e" +checksum = "778e2ac28f6c47af28e4907f13ffd1e1ddbd400980a9abd7c8df189bf578a5ad" dependencies = [ "libc", - "windows-sys 0.59.0", + "windows-sys 0.60.2", ] [[package]] @@ -427,11 +427,11 @@ dependencies = [ [[package]] name = "fs-err" -version = "3.1.0" +version = "3.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1f89bda4c2a21204059a977ed3bfe746677dfd137b83c339e702b0ac91d482aa" +checksum = "88d7be93788013f265201256d58f04936a8079ad5dc898743aa20525f503b683" dependencies = [ - "autocfg 1.4.0", + "autocfg 1.5.0", ] [[package]] @@ -454,7 +454,7 @@ checksum = "162ee34ebcb7c64a8abebc059ce0fee27c2262618d7b60ed8faf72fef13c3650" dependencies = [ "proc-macro2", "quote", - "syn 2.0.101", + "syn 2.0.106", ] [[package]] @@ -507,11 +507,11 @@ dependencies = [ [[package]] name = "getopts" -version = "0.2.21" +version = "0.2.24" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "14dbbfd5c71d70241ecf9e6f13737f7b5ce823821063188d7e46c41d371eebd5" +checksum = "cfe4fbac503b8d1f88e6676011885f34b7174f46e59956bba534ba83abded4df" dependencies = [ - "unicode-width 0.1.14", + "unicode-width", ] [[package]] @@ -522,7 +522,7 @@ checksum = "335ff9f135e4384c8150d6f27c6daed433577f86b4750418338c01a1a2528592" dependencies = [ "cfg-if", "libc", - "wasi 0.11.0+wasi-snapshot-preview1", + "wasi 0.11.1+wasi-snapshot-preview1", ] [[package]] @@ -534,14 +534,14 @@ dependencies = [ "cfg-if", "libc", "r-efi", - "wasi 0.14.3+wasi-0.2.4", + "wasi 0.14.4+wasi-0.2.4", ] [[package]] name = "glob" -version = "0.3.2" +version = "0.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a8d1add55171497b4705a648c6b583acafb01d58050a51727785f0b2c8e0a2b2" +checksum = "0cc23270f6e1808e30a928bdc84dea0b9b4136a8bc82338574f23baf47bbd280" [[package]] name = "goblin" @@ -549,16 +549,16 @@ version = "0.9.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "daa0a64d21a7eb230583b4c5f4e23b7e4e57974f96620f42a7e75e08ae66d745" dependencies = [ - "log 0.4.27", + "log 0.4.28", "plain", "scroll", ] [[package]] name = "hashbrown" -version = "0.15.3" +version = "0.15.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "84b26c544d002229e640969970a2e74021aadf6e2f96372b9c58eff97de08eb3" +checksum = "9229cfe53dfd69f0609a49f65461bd93001ea1ef889cd5529dd176593f5338a1" [[package]] name = "heck" @@ -568,9 +568,9 @@ checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea" [[package]] name = "indexmap" -version = "2.9.0" +version = "2.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cea70ddb795996207ad57735b50c5982d8844f38ba9ee5f1aedcfb708a2aa11e" +checksum = "f2481980430f9f78649238835720ddccc57e52df14ffce1c6f37391d61b563e9" dependencies = [ "equivalent", "hashbrown", @@ -584,7 +584,7 @@ checksum = "70a646d946d06bedbbc4cac4c218acf4bbf2d87757a784857025f4d447e4e1cd" dependencies = [ "console", "portable-atomic", - "unicode-width 0.2.1", + "unicode-width", "unit-prefix", "web-time", ] @@ -644,17 +644,17 @@ checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe" [[package]] name = "libc" -version = "0.2.172" +version = "0.2.175" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d750af042f7ef4f724306de029d18836c26c1765a54a6a3f094cbd23a7267ffa" +checksum = "6a82ae493e598baaea5209805c49bbf2ea7de956d50d7da0da1164f9c6d28543" [[package]] name = "libredox" -version = "0.1.3" +version = "0.1.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c0ff37bd590ca25063e35af745c343cb7a0271906fb7b37e4813e8f79f00268d" +checksum = "391290121bad3d37fbddad76d8f5d1c1c314cfc646d143d7e07a3086ddff0ce3" dependencies = [ - "bitflags 2.9.0", + "bitflags 2.9.4", "libc", ] @@ -670,14 +670,14 @@ version = "0.3.9" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e19e8d5c34a3e0e2223db8e060f9e8264aeeb5c5fc64a4ee9965c062211c024b" dependencies = [ - "log 0.4.27", + "log 0.4.28", ] [[package]] name = "log" -version = "0.4.27" +version = "0.4.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "13dc2df351e3202783a1fe0d44375f7295ffb4049267b0f3018346dc122a1d94" +checksum = "34080505efa8e45a4b816c349525ebe327ceaa8559756f0356cba97ef3bf7432" [[package]] name = "matrixmultiply" @@ -685,15 +685,15 @@ version = "0.3.10" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a06de3016e9fae57a36fd14dba131fccf49f74b40b7fbdb472f96e361ec71a08" dependencies = [ - "autocfg 1.4.0", + "autocfg 1.5.0", "rawpointer", ] [[package]] name = "memchr" -version = "2.7.4" +version = "2.7.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "78ca9ab1a0babb1e7d5695e3530886289c18cf2f87ec19a575a0abdce112e3a3" +checksum = "32a282da65faaf38286cf3be983213fcf1d2e2a58700e808f83f4ea9a4804bc0" [[package]] name = "ndarray" @@ -734,7 +734,7 @@ version = "0.2.19" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "071dfc062690e90b734c0b2273ce72ad0ffa95f0c74596bc250dcfd960262841" dependencies = [ - "autocfg 1.4.0", + "autocfg 1.5.0", ] [[package]] @@ -743,6 +743,12 @@ version = "1.21.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "42f5e15c9953c5e4ccceeb2e7382a716482c34515315f7b03532b8b4e8393d2d" +[[package]] +name = "once_cell_polyfill" +version = "1.70.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a4895175b425cb1f87721b59f0f286c2092bd4af812243672510e1ac53e2e0ad" + [[package]] name = "option-ext" version = "0.2.0" @@ -808,9 +814,9 @@ dependencies = [ [[package]] name = "proc-macro2" -version = "1.0.95" +version = "1.0.101" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "02b3e5e68a3a1a02aad3ec490a98007cbc13c37cbe84a3cd7b8e406d76e7f778" +checksum = "89ae43fd86e4158d6db51ad8e2b80f313af9cc74f5c0e03ccb87de09998732de" dependencies = [ "unicode-ident", ] @@ -1033,18 +1039,18 @@ dependencies = [ "aho-corasick 1.1.3", "memchr", "regex-automata", - "regex-syntax 0.8.5", + "regex-syntax 0.8.6", ] [[package]] name = "regex-automata" -version = "0.4.9" +version = "0.4.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "809e8dc61f6de73b46c85f4c96486310fe304c434cfa43669d7b40f711150908" +checksum = "6b9458fa0bfeeac22b5ca447c63aaf45f28439a709ccd244698632f9aa6394d6" dependencies = [ "aho-corasick 1.1.3", "memchr", - "regex-syntax 0.8.5", + "regex-syntax 0.8.6", ] [[package]] @@ -1058,9 +1064,9 @@ dependencies = [ [[package]] name = "regex-syntax" -version = "0.8.5" +version = "0.8.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2b15c43186be67a4fd63bee50d0303afffcef381492ebe2c5d87f324e1b8815c" +checksum = "caf4aa5b0f434c91fe5c7f1ecb6a5ece2130b02ad2a590589dda5146df959001" [[package]] name = "relative-path" @@ -1093,7 +1099,7 @@ dependencies = [ "regex 1.11.2", "relative-path", "rustc_version 0.4.1", - "syn 2.0.101", + "syn 2.0.106", "unicode-ident", ] @@ -1141,22 +1147,22 @@ dependencies = [ "syntex_errors", "syntex_syntax", "term", - "toml", + "toml 0.4.10", "unicode-segmentation", "winapi 0.2.8", ] [[package]] name = "rustix" -version = "1.0.7" +version = "1.0.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c71e83d6afe7ff64890ec6b71d6a69bb8a610ab78ce364b3352876bb4c801266" +checksum = "11181fbabf243db407ef8df94a6ce0b2f9a733bd8be4ad02b4eda9602296cac8" dependencies = [ - "bitflags 2.9.0", + "bitflags 2.9.4", "errno", "libc", "linux-raw-sys", - "windows-sys 0.59.0", + "windows-sys 0.60.2", ] [[package]] @@ -1182,7 +1188,7 @@ checksum = "1783eabc414609e28a5ba76aee5ddd52199f7107a0b24c2e9746a1ecc34a683d" dependencies = [ "proc-macro2", "quote", - "syn 2.0.101", + "syn 2.0.106", ] [[package]] @@ -1226,7 +1232,7 @@ checksum = "5b0276cf7f2c73365f7157c8123c21cd9a50fbbd844757af28ca1f5925fc2a00" dependencies = [ "proc-macro2", "quote", - "syn 2.0.101", + "syn 2.0.106", ] [[package]] @@ -1243,9 +1249,9 @@ dependencies = [ [[package]] name = "serde_spanned" -version = "0.6.8" +version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "87607cb1398ed59d48732e575a4c28a7a8ebf2454b964fe3f224f2afc07909e1" +checksum = "40734c41988f7306bb04f0ecf60ec0f3f1caa34290e4e8ea471dcd3346483b83" dependencies = [ "serde", ] @@ -1258,12 +1264,9 @@ checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64" [[package]] name = "slab" -version = "0.4.9" +version = "0.4.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8f92a496fb766b417c996b9c5e57daf2f7ad3b0bebe1ccfca4856390e3d3bb67" -dependencies = [ - "autocfg 1.4.0", -] +checksum = "7a2ae44ef20feb57a68b23d846850f861394c2e02dc425a50098ae8c90267589" [[package]] name = "strings" @@ -1302,9 +1305,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.101" +version = "2.0.106" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8ce2b7fc941b3a24138a0a7cf8e858bfc6a992e7978a068a5c760deb0ed43caf" +checksum = "ede7c438028d4436d71104916910f5bb611972c5cfd7f89b8300a8186e6fada6" dependencies = [ "proc-macro2", "quote", @@ -1370,12 +1373,12 @@ dependencies = [ [[package]] name = "terminal_size" -version = "0.4.2" +version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "45c6481c4829e4cc63825e62c49186a34538b7b2750b73b266581ffb612fb5ed" +checksum = "60b8cb979cb11c32ce1603f8137b22262a9d131aaa5c37b5678025f22b8becd0" dependencies = [ "rustix", - "windows-sys 0.59.0", + "windows-sys 0.60.2", ] [[package]] @@ -1389,11 +1392,11 @@ dependencies = [ [[package]] name = "thiserror" -version = "2.0.12" +version = "2.0.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "567b8a2dae586314f7be2a752ec7474332959c6460e02bde30d702a66d488708" +checksum = "3467d614147380f2e4e374161426ff399c91084acd2363eaf549172b3d5e60c0" dependencies = [ - "thiserror-impl 2.0.12", + "thiserror-impl 2.0.16", ] [[package]] @@ -1404,18 +1407,18 @@ checksum = "4fee6c4efc90059e10f81e6d42c60a18f76588c3d74cb83a0b242a2b6c7504c1" dependencies = [ "proc-macro2", "quote", - "syn 2.0.101", + "syn 2.0.106", ] [[package]] name = "thiserror-impl" -version = "2.0.12" +version = "2.0.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7f7cf42b4507d8ea322120659672cf1b9dbb93f8f2d4ecfd6e51350ff5b17a1d" +checksum = "6c5e1be1c48b9172ee610da68fd9cd2770e7a4056cb3fc98710ee6906f0c7960" dependencies = [ "proc-macro2", "quote", - "syn 2.0.101", + "syn 2.0.106", ] [[package]] @@ -1436,25 +1439,51 @@ dependencies = [ "serde", ] +[[package]] +name = "toml" +version = "0.9.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "75129e1dc5000bfbaa9fee9d1b21f974f9fbad9daec557a521ee6e080825f6e8" +dependencies = [ + "serde", + "serde_spanned", + "toml_datetime 0.7.0", + "toml_parser", + "winnow", +] + +[[package]] +name = "toml_datetime" +version = "0.6.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "22cddaf88f4fbc13c51aebbf5f8eceb5c7c5a9da2ac40a13519eb5b0a0e8f11c" + [[package]] name = "toml_datetime" -version = "0.6.9" +version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3da5db5a963e24bc68be8b17b6fa82814bb22ee8660f192bb182771d498f09a3" +checksum = "bade1c3e902f58d73d3f294cd7f20391c1cb2fbcb643b73566bc773971df91e3" dependencies = [ "serde", ] [[package]] name = "toml_edit" -version = "0.22.26" +version = "0.22.27" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "310068873db2c5b3e7659d2cc35d21855dbafa50d1ce336397c666e3cb08137e" +checksum = "41fe8c660ae4257887cf66394862d21dbca4a6ddd26f04a3560410406a2f819a" dependencies = [ "indexmap", - "serde", - "serde_spanned", - "toml_datetime", + "toml_datetime 0.6.11", + "winnow", +] + +[[package]] +name = "toml_parser" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b551886f449aa90d4fe2bdaa9f4a2577ad2dde302c61ecf262d80b116db95c10" +dependencies = [ "winnow", ] @@ -1476,12 +1505,6 @@ version = "1.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f6ccf251212114b54433ec949fd6a7841275f9ada20dddd2f29e9ceea4501493" -[[package]] -name = "unicode-width" -version = "0.1.14" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7dd6e30e90baa6f72411720665d41d89b9a3d039dc45b8faea1ddd07f617f6af" - [[package]] name = "unicode-width" version = "0.2.1" @@ -1523,15 +1546,15 @@ dependencies = [ [[package]] name = "wasi" -version = "0.11.0+wasi-snapshot-preview1" +version = "0.11.1+wasi-snapshot-preview1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" +checksum = "ccf3ec651a847eb01de73ccad15eb7d99f80485de043efb2f370cd654f4ea44b" [[package]] name = "wasi" -version = "0.14.3+wasi-0.2.4" +version = "0.14.4+wasi-0.2.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6a51ae83037bdd272a9e28ce236db8c07016dd0d50c27038b3f407533c030c95" +checksum = "88a5f4a424faf49c3c2c344f166f0662341d470ea185e939657aaff130f0ec4a" dependencies = [ "wit-bindgen", ] @@ -1555,10 +1578,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e28d1ba982ca7923fd01448d5c30c6864d0a14109560296a162f80f305fb93bb" dependencies = [ "bumpalo", - "log 0.4.27", + "log 0.4.28", "proc-macro2", "quote", - "syn 2.0.101", + "syn 2.0.106", "wasm-bindgen-shared", ] @@ -1580,7 +1603,7 @@ checksum = "7bb4ce89b08211f923caf51d527662b75bdc9c9c7aab40f86dcb9fb85ac552aa" dependencies = [ "proc-macro2", "quote", - "syn 2.0.101", + "syn 2.0.106", "wasm-bindgen-backend", "wasm-bindgen-shared", ] @@ -1656,6 +1679,12 @@ version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5e6ad25900d524eaabdbbb96d20b4311e1e7ae1699af4fb28c17ae66c80d798a" +[[package]] +name = "windows-link" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "45e46c0661abb7180e7b9c281db115305d49ca1709ab8242adf09666d2173c65" + [[package]] name = "windows-sys" version = "0.48.0" @@ -1667,20 +1696,20 @@ dependencies = [ [[package]] name = "windows-sys" -version = "0.59.0" +version = "0.60.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e38bc4d79ed67fd075bcc251a1c39b32a1776bbe92e5bef1f0bf1f8c531853b" +checksum = "f2f500e4d28234f72040990ec9d39e3a6b950f9f22d3dba18416c35882612bcb" dependencies = [ - "windows-targets 0.52.6", + "windows-targets 0.53.3", ] [[package]] name = "windows-sys" -version = "0.60.2" +version = "0.61.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f2f500e4d28234f72040990ec9d39e3a6b950f9f22d3dba18416c35882612bcb" +checksum = "e201184e40b2ede64bc2ea34968b28e33622acdbbf37104f0e4a33f7abe657aa" dependencies = [ - "windows-targets 0.53.3", + "windows-link 0.2.0", ] [[package]] @@ -1698,33 +1727,17 @@ dependencies = [ "windows_x86_64_msvc 0.48.5", ] -[[package]] -name = "windows-targets" -version = "0.52.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9b724f72796e036ab90c1021d4780d4d3d648aca59e491e6b98e725b84e99973" -dependencies = [ - "windows_aarch64_gnullvm 0.52.6", - "windows_aarch64_msvc 0.52.6", - "windows_i686_gnu 0.52.6", - "windows_i686_gnullvm 0.52.6", - "windows_i686_msvc 0.52.6", - "windows_x86_64_gnu 0.52.6", - "windows_x86_64_gnullvm 0.52.6", - "windows_x86_64_msvc 0.52.6", -] - [[package]] name = "windows-targets" version = "0.53.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d5fe6031c4041849d7c496a8ded650796e7b6ecc19df1a431c1a363342e5dc91" dependencies = [ - "windows-link", + "windows-link 0.1.3", "windows_aarch64_gnullvm 0.53.0", "windows_aarch64_msvc 0.53.0", "windows_i686_gnu 0.53.0", - "windows_i686_gnullvm 0.53.0", + "windows_i686_gnullvm", "windows_i686_msvc 0.53.0", "windows_x86_64_gnu 0.53.0", "windows_x86_64_gnullvm 0.53.0", @@ -1737,12 +1750,6 @@ version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2b38e32f0abccf9987a4e3079dfb67dcd799fb61361e53e2882c3cbaf0d905d8" -[[package]] -name = "windows_aarch64_gnullvm" -version = "0.52.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3" - [[package]] name = "windows_aarch64_gnullvm" version = "0.53.0" @@ -1755,12 +1762,6 @@ version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "dc35310971f3b2dbbf3f0690a219f40e2d9afcf64f9ab7cc1be722937c26b4bc" -[[package]] -name = "windows_aarch64_msvc" -version = "0.52.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469" - [[package]] name = "windows_aarch64_msvc" version = "0.53.0" @@ -1773,24 +1774,12 @@ version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a75915e7def60c94dcef72200b9a8e58e5091744960da64ec734a6c6e9b3743e" -[[package]] -name = "windows_i686_gnu" -version = "0.52.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8e9b5ad5ab802e97eb8e295ac6720e509ee4c243f69d781394014ebfe8bbfa0b" - [[package]] name = "windows_i686_gnu" version = "0.53.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c1dc67659d35f387f5f6c479dc4e28f1d4bb90ddd1a5d3da2e5d97b42d6272c3" -[[package]] -name = "windows_i686_gnullvm" -version = "0.52.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66" - [[package]] name = "windows_i686_gnullvm" version = "0.53.0" @@ -1803,12 +1792,6 @@ version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8f55c233f70c4b27f66c523580f78f1004e8b5a8b659e05a4eb49d4166cca406" -[[package]] -name = "windows_i686_msvc" -version = "0.52.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66" - [[package]] name = "windows_i686_msvc" version = "0.53.0" @@ -1821,12 +1804,6 @@ version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "53d40abd2583d23e4718fddf1ebec84dbff8381c07cae67ff7768bbf19c6718e" -[[package]] -name = "windows_x86_64_gnu" -version = "0.52.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78" - [[package]] name = "windows_x86_64_gnu" version = "0.53.0" @@ -1839,12 +1816,6 @@ version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0b7b52767868a23d5bab768e390dc5f5c55825b6d30b86c844ff2dc7414044cc" -[[package]] -name = "windows_x86_64_gnullvm" -version = "0.52.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d" - [[package]] name = "windows_x86_64_gnullvm" version = "0.53.0" @@ -1857,12 +1828,6 @@ version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538" -[[package]] -name = "windows_x86_64_msvc" -version = "0.52.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec" - [[package]] name = "windows_x86_64_msvc" version = "0.53.0" @@ -1871,9 +1836,9 @@ checksum = "271414315aff87387382ec3d271b52d7ae78726f5d44ac98b4f4030c91880486" [[package]] name = "winnow" -version = "0.7.10" +version = "0.7.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c06928c8748d81b05c9be96aad92e1b6ff01833332f281e8cfca3be4b35fc9ec" +checksum = "21a0236b59786fed61e2a80582dd500fe61f18b5dca67a4a067d0bc9039339cf" dependencies = [ "memchr", ] @@ -1886,26 +1851,26 @@ checksum = "d135d17ab770252ad95e9a872d365cf3090e3be864a34ab46f48555993efc904" [[package]] name = "wit-bindgen" -version = "0.45.0" +version = "0.45.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "052283831dbae3d879dc7f51f3d92703a316ca49f91540417d38591826127814" +checksum = "5c573471f125075647d03df72e026074b7203790d41351cd6edc96f46bcccd36" [[package]] name = "zerocopy" -version = "0.8.26" +version = "0.8.27" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1039dd0d3c310cf05de012d8a39ff557cb0d23087fd44cad61df08fc31907a2f" +checksum = "0894878a5fa3edfd6da3f88c4805f4c8558e2b996227a3d864f47fe11e38282c" dependencies = [ "zerocopy-derive", ] [[package]] name = "zerocopy-derive" -version = "0.8.26" +version = "0.8.27" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9ecf5b4cc5364572d7f4c329661bcc82724222973f2cab6f050a4e5c22f75181" +checksum = "88d2b8d9c68ad2b9e4340d7832716a4d21a22a1154777ad56ea55c51a9cf3831" dependencies = [ "proc-macro2", "quote", - "syn 2.0.101", + "syn 2.0.106", ] diff --git a/uv.lock b/uv.lock index c730fbc..86d6ab7 100644 --- a/uv.lock +++ b/uv.lock @@ -1,5 +1,5 @@ version = 1 -revision = 2 +revision = 3 requires-python = ">=3.10, <3.15" [[package]] @@ -13,7 +13,7 @@ wheels = [ [[package]] name = "code-challenges" -version = "0.1.0" +version = "0.2.0" source = { virtual = "." } dependencies = [ { name = "pip" }, From bd1ddd326a42f41d825e53de72a0885701ad56de Mon Sep 17 00:00:00 2001 From: raj-open Date: Sun, 7 Sep 2025 21:19:55 +0200 Subject: [PATCH 41/41] staging > main: VERSION bump (minor) --- Cargo.lock | 2 +- Cargo.toml | 2 +- dist/VERSION | 2 +- pyproject.toml | 12 +++--- uv.lock | 110 +++++++++++++++++++++++++------------------------ 5 files changed, 65 insertions(+), 63 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index d823f33..582ee91 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -485,7 +485,7 @@ dependencies = [ [[package]] name = "general" -version = "0.2.0" +version = "0.3.0" dependencies = [ "cargo-zigbuild", "dedent", diff --git a/Cargo.toml b/Cargo.toml index 6852dda..e0d7141 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -2,7 +2,7 @@ [package] name = "general" -version = "0.2.0" +version = "0.3.0" edition = "2024" description = "Code for challenges from various platforms" homepage = "github.com/raj-open/code-challenges" diff --git a/dist/VERSION b/dist/VERSION index 0ea3a94..0d91a54 100644 --- a/dist/VERSION +++ b/dist/VERSION @@ -1 +1 @@ -0.2.0 +0.3.0 diff --git a/pyproject.toml b/pyproject.toml index 184aee3..5bbc418 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = 'code_challenges' -version = "0.2.0" +version = "0.3.0" description = 'Code for challenges from various platforms' authors = [ {name="raj-open", email="raj-open@users.noreply.github.com"}, @@ -34,16 +34,16 @@ dependencies = [ # -------------------------------- # compiler # -------------------------------- - "pip>=25.1.1", + "pip>=25.2", # -------------------------------- # models # -------------------------------- - "pydantic>=2.11.4", - "pydantic-yaml>=1.4.0", + "pydantic>=2.11.7", + "pydantic-yaml>=1.6.0", ] [dependency-groups] dev = [ - "ruff>=0.11.8", - "uv>=0.7.2", + "ruff>=0.12.12", + "uv>=0.8.15", ] diff --git a/uv.lock b/uv.lock index 86d6ab7..c1934d9 100644 --- a/uv.lock +++ b/uv.lock @@ -1,5 +1,5 @@ version = 1 -revision = 3 +revision = 2 requires-python = ">=3.10, <3.15" [[package]] @@ -13,7 +13,7 @@ wheels = [ [[package]] name = "code-challenges" -version = "0.2.0" +version = "0.3.0" source = { virtual = "." } dependencies = [ { name = "pip" }, @@ -29,29 +29,29 @@ dev = [ [package.metadata] requires-dist = [ - { name = "pip", specifier = ">=25.1.1" }, - { name = "pydantic", specifier = ">=2.11.4" }, - { name = "pydantic-yaml", specifier = ">=1.4.0" }, + { name = "pip", specifier = ">=25.2" }, + { name = "pydantic", specifier = ">=2.11.7" }, + { name = "pydantic-yaml", specifier = ">=1.6.0" }, ] [package.metadata.requires-dev] dev = [ - { name = "ruff", specifier = ">=0.11.8" }, - { name = "uv", specifier = ">=0.7.2" }, + { name = "ruff", specifier = ">=0.12.12" }, + { name = "uv", specifier = ">=0.8.15" }, ] [[package]] name = "pip" -version = "25.1.1" +version = "25.2" source = { registry = "https://pypi.org/simple" } -sdist = { url = "https://files.pythonhosted.org/packages/59/de/241caa0ca606f2ec5fe0c1f4261b0465df78d786a38da693864a116c37f4/pip-25.1.1.tar.gz", hash = "sha256:3de45d411d308d5054c2168185d8da7f9a2cd753dbac8acbfa88a8909ecd9077", size = 1940155, upload-time = "2025-05-02T15:14:02.057Z" } +sdist = { url = "https://files.pythonhosted.org/packages/20/16/650289cd3f43d5a2fadfd98c68bd1e1e7f2550a1a5326768cddfbcedb2c5/pip-25.2.tar.gz", hash = "sha256:578283f006390f85bb6282dffb876454593d637f5d1be494b5202ce4877e71f2", size = 1840021, upload-time = "2025-07-30T21:50:15.401Z" } wheels = [ - { url = "https://files.pythonhosted.org/packages/29/a2/d40fb2460e883eca5199c62cfc2463fd261f760556ae6290f88488c362c0/pip-25.1.1-py3-none-any.whl", hash = "sha256:2913a38a2abf4ea6b64ab507bd9e967f3b53dc1ede74b01b0931e1ce548751af", size = 1825227, upload-time = "2025-05-02T15:13:59.102Z" }, + { url = "https://files.pythonhosted.org/packages/b7/3f/945ef7ab14dc4f9d7f40288d2df998d1837ee0888ec3659c813487572faa/pip-25.2-py3-none-any.whl", hash = "sha256:6d67a2b4e7f14d8b31b8b52648866fa717f45a1eb70e83002f4331d07e953717", size = 1752557, upload-time = "2025-07-30T21:50:13.323Z" }, ] [[package]] name = "pydantic" -version = "2.11.4" +version = "2.11.7" source = { registry = "https://pypi.org/simple" } dependencies = [ { name = "annotated-types" }, @@ -59,9 +59,9 @@ dependencies = [ { name = "typing-extensions" }, { name = "typing-inspection" }, ] -sdist = { url = "https://files.pythonhosted.org/packages/77/ab/5250d56ad03884ab5efd07f734203943c8a8ab40d551e208af81d0257bf2/pydantic-2.11.4.tar.gz", hash = "sha256:32738d19d63a226a52eed76645a98ee07c1f410ee41d93b4afbfa85ed8111c2d", size = 786540, upload-time = "2025-04-29T20:38:55.02Z" } +sdist = { url = "https://files.pythonhosted.org/packages/00/dd/4325abf92c39ba8623b5af936ddb36ffcfe0beae70405d456ab1fb2f5b8c/pydantic-2.11.7.tar.gz", hash = "sha256:d989c3c6cb79469287b1569f7447a17848c998458d49ebe294e975b9baf0f0db", size = 788350, upload-time = "2025-06-14T08:33:17.137Z" } wheels = [ - { url = "https://files.pythonhosted.org/packages/e7/12/46b65f3534d099349e38ef6ec98b1a5a81f42536d17e0ba382c28c67ba67/pydantic-2.11.4-py3-none-any.whl", hash = "sha256:d9615eaa9ac5a063471da949c8fc16376a84afb5024688b3ff885693506764eb", size = 443900, upload-time = "2025-04-29T20:38:52.724Z" }, + { url = "https://files.pythonhosted.org/packages/6a/c0/ec2b1c8712ca690e5d61979dee872603e92b8a32f94cc1b72d53beab008a/pydantic-2.11.7-py3-none-any.whl", hash = "sha256:dde5df002701f6de26248661f6835bbe296a47bf73990135c7d07ce741b9623b", size = 444782, upload-time = "2025-06-14T08:33:14.905Z" }, ] [[package]] @@ -153,16 +153,16 @@ wheels = [ [[package]] name = "pydantic-yaml" -version = "1.4.0" +version = "1.6.0" source = { registry = "https://pypi.org/simple" } dependencies = [ { name = "pydantic" }, { name = "ruamel-yaml" }, { name = "typing-extensions" }, ] -sdist = { url = "https://files.pythonhosted.org/packages/84/b8/19446b74d31a6ff09eb69af3be01c5031c8bf5dc62e4205a22d50d629333/pydantic_yaml-1.4.0.tar.gz", hash = "sha256:09f6b9ec9d80550dd3a58596a6a0948a1830fae94b73329b95c2b9dbfc35ae00", size = 21454, upload-time = "2024-11-11T16:00:10.827Z" } +sdist = { url = "https://files.pythonhosted.org/packages/bb/6c/6bc8f39406cdeed864578df88f52a63db27bd24aa8473206d650bc4fa1d8/pydantic_yaml-1.6.0.tar.gz", hash = "sha256:ce5f10b65d95ca45846a36ea8dae54e550fa3058e7d6218e0179184d9bf6f660", size = 25782, upload-time = "2025-08-08T21:01:13.097Z" } wheels = [ - { url = "https://files.pythonhosted.org/packages/41/e1/e4b108753491a6545c66cdd7546e726b056bbe3902f9ef8a58ed118afd70/pydantic_yaml-1.4.0-py3-none-any.whl", hash = "sha256:f9ad82d8c0548e779e00d6ec639f6efa8f8c7e14d12d0bf9fdc400a37300d7ba", size = 17926, upload-time = "2024-11-11T16:00:09.394Z" }, + { url = "https://files.pythonhosted.org/packages/ba/39/8d263fbcb409a8f5dd78ac8f89f1e6af1d4e4d9fbb7f856ca3245b354809/pydantic_yaml-1.6.0-py3-none-any.whl", hash = "sha256:02cb800b455b68daeeb74ad736c252a94a0b203da5fbbeef02539d468e1d98f8", size = 22511, upload-time = "2025-08-08T21:01:11.425Z" }, ] [[package]] @@ -223,27 +223,28 @@ wheels = [ [[package]] name = "ruff" -version = "0.11.8" +version = "0.12.12" source = { registry = "https://pypi.org/simple" } -sdist = { url = "https://files.pythonhosted.org/packages/52/f6/adcf73711f31c9f5393862b4281c875a462d9f639f4ccdf69dc368311c20/ruff-0.11.8.tar.gz", hash = "sha256:6d742d10626f9004b781f4558154bb226620a7242080e11caeffab1a40e99df8", size = 4086399, upload-time = "2025-05-01T14:53:24.459Z" } +sdist = { url = "https://files.pythonhosted.org/packages/a8/f0/e0965dd709b8cabe6356811c0ee8c096806bb57d20b5019eb4e48a117410/ruff-0.12.12.tar.gz", hash = "sha256:b86cd3415dbe31b3b46a71c598f4c4b2f550346d1ccf6326b347cc0c8fd063d6", size = 5359915, upload-time = "2025-09-04T16:50:18.273Z" } wheels = [ - { url = "https://files.pythonhosted.org/packages/9f/60/c6aa9062fa518a9f86cb0b85248245cddcd892a125ca00441df77d79ef88/ruff-0.11.8-py3-none-linux_armv6l.whl", hash = "sha256:896a37516c594805e34020c4a7546c8f8a234b679a7716a3f08197f38913e1a3", size = 10272473, upload-time = "2025-05-01T14:52:37.252Z" }, - { url = "https://files.pythonhosted.org/packages/a0/e4/0325e50d106dc87c00695f7bcd5044c6d252ed5120ebf423773e00270f50/ruff-0.11.8-py3-none-macosx_10_12_x86_64.whl", hash = "sha256:ab86d22d3d721a40dd3ecbb5e86ab03b2e053bc93c700dc68d1c3346b36ce835", size = 11040862, upload-time = "2025-05-01T14:52:41.022Z" }, - { url = "https://files.pythonhosted.org/packages/e6/27/b87ea1a7be37fef0adbc7fd987abbf90b6607d96aa3fc67e2c5b858e1e53/ruff-0.11.8-py3-none-macosx_11_0_arm64.whl", hash = "sha256:258f3585057508d317610e8a412788cf726efeefa2fec4dba4001d9e6f90d46c", size = 10385273, upload-time = "2025-05-01T14:52:43.551Z" }, - { url = "https://files.pythonhosted.org/packages/d3/f7/3346161570d789045ed47a86110183f6ac3af0e94e7fd682772d89f7f1a1/ruff-0.11.8-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:727d01702f7c30baed3fc3a34901a640001a2828c793525043c29f7614994a8c", size = 10578330, upload-time = "2025-05-01T14:52:45.48Z" }, - { url = "https://files.pythonhosted.org/packages/c6/c3/327fb950b4763c7b3784f91d3038ef10c13b2d42322d4ade5ce13a2f9edb/ruff-0.11.8-py3-none-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:3dca977cc4fc8f66e89900fa415ffe4dbc2e969da9d7a54bfca81a128c5ac219", size = 10122223, upload-time = "2025-05-01T14:52:47.675Z" }, - { url = "https://files.pythonhosted.org/packages/de/c7/ba686bce9adfeb6c61cb1bbadc17d58110fe1d602f199d79d4c880170f19/ruff-0.11.8-py3-none-manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:c657fa987d60b104d2be8b052d66da0a2a88f9bd1d66b2254333e84ea2720c7f", size = 11697353, upload-time = "2025-05-01T14:52:50.264Z" }, - { url = "https://files.pythonhosted.org/packages/53/8e/a4fb4a1ddde3c59e73996bb3ac51844ff93384d533629434b1def7a336b0/ruff-0.11.8-py3-none-manylinux_2_17_ppc64.manylinux2014_ppc64.whl", hash = "sha256:f2e74b021d0de5eceb8bd32919f6ff8a9b40ee62ed97becd44993ae5b9949474", size = 12375936, upload-time = "2025-05-01T14:52:52.394Z" }, - { url = "https://files.pythonhosted.org/packages/ad/a1/9529cb1e2936e2479a51aeb011307e7229225df9ac64ae064d91ead54571/ruff-0.11.8-py3-none-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:f9b5ef39820abc0f2c62111f7045009e46b275f5b99d5e59dda113c39b7f4f38", size = 11850083, upload-time = "2025-05-01T14:52:55.424Z" }, - { url = "https://files.pythonhosted.org/packages/3e/94/8f7eac4c612673ae15a4ad2bc0ee62e03c68a2d4f458daae3de0e47c67ba/ruff-0.11.8-py3-none-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:c1dba3135ca503727aa4648152c0fa67c3b1385d3dc81c75cd8a229c4b2a1458", size = 14005834, upload-time = "2025-05-01T14:52:58.056Z" }, - { url = "https://files.pythonhosted.org/packages/1e/7c/6f63b46b2be870cbf3f54c9c4154d13fac4b8827f22fa05ac835c10835b2/ruff-0.11.8-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:7f024d32e62faad0f76b2d6afd141b8c171515e4fb91ce9fd6464335c81244e5", size = 11503713, upload-time = "2025-05-01T14:53:01.244Z" }, - { url = "https://files.pythonhosted.org/packages/3a/91/57de411b544b5fe072779678986a021d87c3ee5b89551f2ca41200c5d643/ruff-0.11.8-py3-none-musllinux_1_2_aarch64.whl", hash = "sha256:d365618d3ad747432e1ae50d61775b78c055fee5936d77fb4d92c6f559741948", size = 10457182, upload-time = "2025-05-01T14:53:03.726Z" }, - { url = "https://files.pythonhosted.org/packages/01/49/cfe73e0ce5ecdd3e6f1137bf1f1be03dcc819d1bfe5cff33deb40c5926db/ruff-0.11.8-py3-none-musllinux_1_2_armv7l.whl", hash = "sha256:4d9aaa91035bdf612c8ee7266153bcf16005c7c7e2f5878406911c92a31633cb", size = 10101027, upload-time = "2025-05-01T14:53:06.555Z" }, - { url = "https://files.pythonhosted.org/packages/56/21/a5cfe47c62b3531675795f38a0ef1c52ff8de62eaddf370d46634391a3fb/ruff-0.11.8-py3-none-musllinux_1_2_i686.whl", hash = "sha256:0eba551324733efc76116d9f3a0d52946bc2751f0cd30661564117d6fd60897c", size = 11111298, upload-time = "2025-05-01T14:53:08.825Z" }, - { url = "https://files.pythonhosted.org/packages/36/98/f76225f87e88f7cb669ae92c062b11c0a1e91f32705f829bd426f8e48b7b/ruff-0.11.8-py3-none-musllinux_1_2_x86_64.whl", hash = "sha256:161eb4cff5cfefdb6c9b8b3671d09f7def2f960cee33481dd898caf2bcd02304", size = 11566884, upload-time = "2025-05-01T14:53:11.626Z" }, - { url = "https://files.pythonhosted.org/packages/de/7e/fff70b02e57852fda17bd43f99dda37b9bcf3e1af3d97c5834ff48d04715/ruff-0.11.8-py3-none-win32.whl", hash = "sha256:5b18caa297a786465cc511d7f8be19226acf9c0a1127e06e736cd4e1878c3ea2", size = 10451102, upload-time = "2025-05-01T14:53:14.303Z" }, - { url = "https://files.pythonhosted.org/packages/7b/a9/eaa571eb70648c9bde3120a1d5892597de57766e376b831b06e7c1e43945/ruff-0.11.8-py3-none-win_amd64.whl", hash = "sha256:6e70d11043bef637c5617297bdedec9632af15d53ac1e1ba29c448da9341b0c4", size = 11597410, upload-time = "2025-05-01T14:53:16.571Z" }, - { url = "https://files.pythonhosted.org/packages/cd/be/f6b790d6ae98f1f32c645f8540d5c96248b72343b0a56fab3a07f2941897/ruff-0.11.8-py3-none-win_arm64.whl", hash = "sha256:304432e4c4a792e3da85b7699feb3426a0908ab98bf29df22a31b0cdd098fac2", size = 10713129, upload-time = "2025-05-01T14:53:22.27Z" }, + { url = "https://files.pythonhosted.org/packages/09/79/8d3d687224d88367b51c7974cec1040c4b015772bfbeffac95face14c04a/ruff-0.12.12-py3-none-linux_armv6l.whl", hash = "sha256:de1c4b916d98ab289818e55ce481e2cacfaad7710b01d1f990c497edf217dafc", size = 12116602, upload-time = "2025-09-04T16:49:18.892Z" }, + { url = "https://files.pythonhosted.org/packages/c3/c3/6e599657fe192462f94861a09aae935b869aea8a1da07f47d6eae471397c/ruff-0.12.12-py3-none-macosx_10_12_x86_64.whl", hash = "sha256:7acd6045e87fac75a0b0cdedacf9ab3e1ad9d929d149785903cff9bb69ad9727", size = 12868393, upload-time = "2025-09-04T16:49:23.043Z" }, + { url = "https://files.pythonhosted.org/packages/e8/d2/9e3e40d399abc95336b1843f52fc0daaceb672d0e3c9290a28ff1a96f79d/ruff-0.12.12-py3-none-macosx_11_0_arm64.whl", hash = "sha256:abf4073688d7d6da16611f2f126be86523a8ec4343d15d276c614bda8ec44edb", size = 12036967, upload-time = "2025-09-04T16:49:26.04Z" }, + { url = "https://files.pythonhosted.org/packages/e9/03/6816b2ed08836be272e87107d905f0908be5b4a40c14bfc91043e76631b8/ruff-0.12.12-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:968e77094b1d7a576992ac078557d1439df678a34c6fe02fd979f973af167577", size = 12276038, upload-time = "2025-09-04T16:49:29.056Z" }, + { url = "https://files.pythonhosted.org/packages/9f/d5/707b92a61310edf358a389477eabd8af68f375c0ef858194be97ca5b6069/ruff-0.12.12-py3-none-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:42a67d16e5b1ffc6d21c5f67851e0e769517fb57a8ebad1d0781b30888aa704e", size = 11901110, upload-time = "2025-09-04T16:49:32.07Z" }, + { url = "https://files.pythonhosted.org/packages/9d/3d/f8b1038f4b9822e26ec3d5b49cf2bc313e3c1564cceb4c1a42820bf74853/ruff-0.12.12-py3-none-manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:b216ec0a0674e4b1214dcc998a5088e54eaf39417327b19ffefba1c4a1e4971e", size = 13668352, upload-time = "2025-09-04T16:49:35.148Z" }, + { url = "https://files.pythonhosted.org/packages/98/0e/91421368ae6c4f3765dd41a150f760c5f725516028a6be30e58255e3c668/ruff-0.12.12-py3-none-manylinux_2_17_ppc64.manylinux2014_ppc64.whl", hash = "sha256:59f909c0fdd8f1dcdbfed0b9569b8bf428cf144bec87d9de298dcd4723f5bee8", size = 14638365, upload-time = "2025-09-04T16:49:38.892Z" }, + { url = "https://files.pythonhosted.org/packages/74/5d/88f3f06a142f58ecc8ecb0c2fe0b82343e2a2b04dcd098809f717cf74b6c/ruff-0.12.12-py3-none-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:9ac93d87047e765336f0c18eacad51dad0c1c33c9df7484c40f98e1d773876f5", size = 14060812, upload-time = "2025-09-04T16:49:42.732Z" }, + { url = "https://files.pythonhosted.org/packages/13/fc/8962e7ddd2e81863d5c92400820f650b86f97ff919c59836fbc4c1a6d84c/ruff-0.12.12-py3-none-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:01543c137fd3650d322922e8b14cc133b8ea734617c4891c5a9fccf4bfc9aa92", size = 13050208, upload-time = "2025-09-04T16:49:46.434Z" }, + { url = "https://files.pythonhosted.org/packages/53/06/8deb52d48a9a624fd37390555d9589e719eac568c020b27e96eed671f25f/ruff-0.12.12-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:2afc2fa864197634e549d87fb1e7b6feb01df0a80fd510d6489e1ce8c0b1cc45", size = 13311444, upload-time = "2025-09-04T16:49:49.931Z" }, + { url = "https://files.pythonhosted.org/packages/2a/81/de5a29af7eb8f341f8140867ffb93f82e4fde7256dadee79016ac87c2716/ruff-0.12.12-py3-none-manylinux_2_31_riscv64.whl", hash = "sha256:0c0945246f5ad776cb8925e36af2438e66188d2b57d9cf2eed2c382c58b371e5", size = 13279474, upload-time = "2025-09-04T16:49:53.465Z" }, + { url = "https://files.pythonhosted.org/packages/7f/14/d9577fdeaf791737ada1b4f5c6b59c21c3326f3f683229096cccd7674e0c/ruff-0.12.12-py3-none-musllinux_1_2_aarch64.whl", hash = "sha256:a0fbafe8c58e37aae28b84a80ba1817f2ea552e9450156018a478bf1fa80f4e4", size = 12070204, upload-time = "2025-09-04T16:49:56.882Z" }, + { url = "https://files.pythonhosted.org/packages/77/04/a910078284b47fad54506dc0af13839c418ff704e341c176f64e1127e461/ruff-0.12.12-py3-none-musllinux_1_2_armv7l.whl", hash = "sha256:b9c456fb2fc8e1282affa932c9e40f5ec31ec9cbb66751a316bd131273b57c23", size = 11880347, upload-time = "2025-09-04T16:49:59.729Z" }, + { url = "https://files.pythonhosted.org/packages/df/58/30185fcb0e89f05e7ea82e5817b47798f7fa7179863f9d9ba6fd4fe1b098/ruff-0.12.12-py3-none-musllinux_1_2_i686.whl", hash = "sha256:5f12856123b0ad0147d90b3961f5c90e7427f9acd4b40050705499c98983f489", size = 12891844, upload-time = "2025-09-04T16:50:02.591Z" }, + { url = "https://files.pythonhosted.org/packages/21/9c/28a8dacce4855e6703dcb8cdf6c1705d0b23dd01d60150786cd55aa93b16/ruff-0.12.12-py3-none-musllinux_1_2_x86_64.whl", hash = "sha256:26a1b5a2bf7dd2c47e3b46d077cd9c0fc3b93e6c6cc9ed750bd312ae9dc302ee", size = 13360687, upload-time = "2025-09-04T16:50:05.8Z" }, + { url = "https://files.pythonhosted.org/packages/c8/fa/05b6428a008e60f79546c943e54068316f32ec8ab5c4f73e4563934fbdc7/ruff-0.12.12-py3-none-win32.whl", hash = "sha256:173be2bfc142af07a01e3a759aba6f7791aa47acf3604f610b1c36db888df7b1", size = 12052870, upload-time = "2025-09-04T16:50:09.121Z" }, + { url = "https://files.pythonhosted.org/packages/85/60/d1e335417804df452589271818749d061b22772b87efda88354cf35cdb7a/ruff-0.12.12-py3-none-win_amd64.whl", hash = "sha256:e99620bf01884e5f38611934c09dd194eb665b0109104acae3ba6102b600fd0d", size = 13178016, upload-time = "2025-09-04T16:50:12.559Z" }, + { url = "https://files.pythonhosted.org/packages/28/7e/61c42657f6e4614a4258f1c3b0c5b93adc4d1f8575f5229d1906b483099b/ruff-0.12.12-py3-none-win_arm64.whl", hash = "sha256:2a8199cab4ce4d72d158319b63370abf60991495fb733db96cd923a34c52d093", size = 12256762, upload-time = "2025-09-04T16:50:15.737Z" }, ] [[package]] @@ -269,25 +270,26 @@ wheels = [ [[package]] name = "uv" -version = "0.7.2" +version = "0.8.15" source = { registry = "https://pypi.org/simple" } -sdist = { url = "https://files.pythonhosted.org/packages/fd/d4/c1104ee4d8a69e4834888cd850eb4f9327c585e5e60da108fda788d3872d/uv-0.7.2.tar.gz", hash = "sha256:45e619bb076916b79df8c5ecc28d1be04d1ccd0b63b080c44ae973b8deb33b25", size = 3293566, upload-time = "2025-04-30T19:25:33.065Z" } +sdist = { url = "https://files.pythonhosted.org/packages/4f/7c/ab905b0425f88842f3d8e5da50491524f45a231b7a3dc9c988608162adb2/uv-0.8.15.tar.gz", hash = "sha256:8ea57b78be9f0911a2a50b6814d15aec7d1f8aa6517059dc8250b1414156f93a", size = 3602914, upload-time = "2025-09-03T14:32:15.552Z" } wheels = [ - { url = "https://files.pythonhosted.org/packages/22/c3/68291a239dbedc0389fa5ce5b5b6c7c2a54c52bc11e9503276f376faa9e7/uv-0.7.2-py3-none-linux_armv6l.whl", hash = "sha256:e1e4394b54bc387f227ca1b2aa0348d35f6455b6168ca1826c1dc5f4fc3e8d20", size = 16590159, upload-time = "2025-04-30T19:24:45.58Z" }, - { url = "https://files.pythonhosted.org/packages/6c/ac/3c7e8df1d6bb84a805aa773ea4f6a006682f8241f331c9c359eb5310f042/uv-0.7.2-py3-none-macosx_10_12_x86_64.whl", hash = "sha256:c0edb194c35f1f12c75bec4fe2d7d4d09f0c2cec3a16102217a772620ce1d6e6", size = 16753976, upload-time = "2025-04-30T19:24:49.223Z" }, - { url = "https://files.pythonhosted.org/packages/42/ca/6a3f3c094794d482e3418f6a46c2753fa4f6ed2fe5b7ecf299db8cfed9ea/uv-0.7.2-py3-none-macosx_11_0_arm64.whl", hash = "sha256:be2e8d033936ba8ed9ccf85eb2d15c7a8db3bb3e9c4960bdf7c3c98034a6dbda", size = 15513631, upload-time = "2025-04-30T19:24:52.042Z" }, - { url = "https://files.pythonhosted.org/packages/1e/65/6fae29e0eb884fa1cab89b0fa865d409e0e2bcada8316cd50b4c81e8706c/uv-0.7.2-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.musllinux_1_1_aarch64.whl", hash = "sha256:a314a94b42bc6014f18c877f723292306b76c10b455c2b385728e1470e661ced", size = 15972100, upload-time = "2025-04-30T19:24:54.847Z" }, - { url = "https://files.pythonhosted.org/packages/a6/92/3d8da1efc7f3272ccc65c50cb13abd9e6a32246bb6c258175c68a91d0d80/uv-0.7.2-py3-none-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:e4d1652fe3608fa564dbeaeb2465208f691ac04b57f655ebef62e9ec6d37103d", size = 16288666, upload-time = "2025-04-30T19:24:57.368Z" }, - { url = "https://files.pythonhosted.org/packages/2c/5e/7d6a788c45d5e2686d01c4886ebb21149892a59bcfa15b66d0646e73aafa/uv-0.7.2-py3-none-manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:48c115a3c13c3b29748e325093ee04fd48eaf91145bedc68727f78e6a1c34ab8", size = 17165785, upload-time = "2025-04-30T19:25:00.28Z" }, - { url = "https://files.pythonhosted.org/packages/e4/9e/4d0a947ffa4b377c6e34935c23164c7914d7239154d254aa5938db6a7e83/uv-0.7.2-py3-none-manylinux_2_17_ppc64.manylinux2014_ppc64.whl", hash = "sha256:c388172209ca5a47706666d570a45fef3dd39db9258682e10b2f62ca521f0e91", size = 18014800, upload-time = "2025-04-30T19:25:03.394Z" }, - { url = "https://files.pythonhosted.org/packages/c7/31/781288f9f53e1770128f7830841d7d269097ed70a4afa71578d45721bfa2/uv-0.7.2-py3-none-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:63c97cc5e8029a8dc0e1fc39f15f746be931345bc0aeae85feceaa1828f0de87", size = 17745484, upload-time = "2025-04-30T19:25:06.41Z" }, - { url = "https://files.pythonhosted.org/packages/6d/04/030eec46217225b77ccff1f2808e64074873d86fe445be3784649506e65e/uv-0.7.2-py3-none-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:1fa315366ee36ad1f734734f3153e2f334342900061fc0ed18b06f3b9bb2dfe2", size = 22103174, upload-time = "2025-04-30T19:25:09.57Z" }, - { url = "https://files.pythonhosted.org/packages/5c/07/9d85d0a9ddd49dbec18bde741ffb33d0c671a153461b094a9c73504e1b92/uv-0.7.2-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:7236ec776c559fbc3ae4389b7cd506a2428ad9dd0402ac3d9446200ea3dc45f6", size = 17369922, upload-time = "2025-04-30T19:25:12.399Z" }, - { url = "https://files.pythonhosted.org/packages/11/18/cfef0efe3c4ebdd81422f35215bb915fd599fc946b40306186d87e90678b/uv-0.7.2-py3-none-manylinux_2_28_aarch64.whl", hash = "sha256:78ec372b2f5c7ff8a034e16dd04bc579a62561a5eac4b6dfc96af60298a97d31", size = 16209878, upload-time = "2025-04-30T19:25:15.336Z" }, - { url = "https://files.pythonhosted.org/packages/31/ed/2ddd7547203ddd368b9ec56b245e09931f868daf2d2b0e29c0b69584466d/uv-0.7.2-py3-none-musllinux_1_1_armv7l.whl", hash = "sha256:28fd5d689ae4f8f16533f091a6dd63e1ddf3b7c782003ac8a18584ddb8823cbe", size = 16271878, upload-time = "2025-04-30T19:25:17.758Z" }, - { url = "https://files.pythonhosted.org/packages/f0/9c/30a48a9d875b91b486286d1a4ccc081dad130acea0dca683c1786ddd7c84/uv-0.7.2-py3-none-musllinux_1_1_i686.whl", hash = "sha256:9aaacb143622cd437a446a4b316a546c02403b438cd7fd7556d62f47a9fd0a99", size = 16742005, upload-time = "2025-04-30T19:25:20.596Z" }, - { url = "https://files.pythonhosted.org/packages/a5/b3/5550a721a1e8a99117d960f16c05ad8d39aff79a3fc1aadf2ed13da4385f/uv-0.7.2-py3-none-musllinux_1_1_x86_64.whl", hash = "sha256:81b86fff996c302be6aa1c1ac6eb72b97a7277c319e52c0def50d40b1ffaa617", size = 17443927, upload-time = "2025-04-30T19:25:23.134Z" }, - { url = "https://files.pythonhosted.org/packages/52/1f/71a7c3e9c79718647fea1e6fe85ccc82d2629cd858b437ae2081190045cc/uv-0.7.2-py3-none-win32.whl", hash = "sha256:19a64c38657c4fbe7c945055755500116fdaac8e121381a5245ea66823f8c500", size = 16869579, upload-time = "2025-04-30T19:25:25.745Z" }, - { url = "https://files.pythonhosted.org/packages/44/f0/4424cf64533b7576610f7de5c94183d810743b08e81072a2bb2d98316947/uv-0.7.2-py3-none-win_amd64.whl", hash = "sha256:dc1ee6114c824f5880c584a96b2947a35817fdd3a0b752d1adbd926ae6872d1c", size = 18287842, upload-time = "2025-04-30T19:25:28.408Z" }, - { url = "https://files.pythonhosted.org/packages/0a/5c/12ce48cab21fb0f9bde4ea0c19ec2ab88d4aa9a53e148a52cfb9a41578c9/uv-0.7.2-py3-none-win_arm64.whl", hash = "sha256:0445e56d3f9651ad84d5a7f16efabba83bf305b73594f1c1bc0659aeab952040", size = 16929582, upload-time = "2025-04-30T19:25:31.021Z" }, + { url = "https://files.pythonhosted.org/packages/67/1d/794352a01b40f2b0a0abe02f4f020219b3f59ee6ed900561be3b2b47a82b/uv-0.8.15-py3-none-linux_armv6l.whl", hash = "sha256:f02e6b8be08b840f86b8d5997b658b657acdda95bc216ecf62fce6c71414bdc7", size = 20136396, upload-time = "2025-09-03T14:31:30.404Z" }, + { url = "https://files.pythonhosted.org/packages/8f/89/528f01cff01eb8d10dd396f437656266443e399dda2fe4787b2cf6983698/uv-0.8.15-py3-none-macosx_10_12_x86_64.whl", hash = "sha256:b0461bb1ad616c8bcb59c9b39ae9363245ca33815ebb1d11130385236eca21b9", size = 19297422, upload-time = "2025-09-03T14:31:34.412Z" }, + { url = "https://files.pythonhosted.org/packages/94/03/532af32a64d162894a1daebb7bc5028ba00225ea720cf0f287e934dc2bd5/uv-0.8.15-py3-none-macosx_11_0_arm64.whl", hash = "sha256:069eed78b79d1e88bced23e3d4303348edb0a0209e7cae0f20024c42430bf50f", size = 17882409, upload-time = "2025-09-03T14:31:36.993Z" }, + { url = "https://files.pythonhosted.org/packages/25/21/57df6d53fbadfa947d9d65a0926e5d8540199f49aa958d23be2707262a80/uv-0.8.15-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.musllinux_1_1_aarch64.whl", hash = "sha256:333a93bb6af64f3b95ee99e82b4ea227e2af6362c45f91c89a24e2bfefb628f9", size = 19557216, upload-time = "2025-09-03T14:31:39.245Z" }, + { url = "https://files.pythonhosted.org/packages/68/22/c3784749e1c78119e5375ec34c6ea29e944192a601f17c746339611db237/uv-0.8.15-py3-none-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:7d5b19ac2bdda3d1456b5d6013af50b443ffb0e40c66d42874f71190a5364711", size = 19781097, upload-time = "2025-09-03T14:31:42.314Z" }, + { url = "https://files.pythonhosted.org/packages/00/28/0597599fb35408dd73e0a7d25108dca1fa6ce8f8d570c8f24151b0016eef/uv-0.8.15-py3-none-manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:3330bb4f206a6180679a75a8b2e77ff0f933fcb06c028b6f4da877b10a5e4f95", size = 20741549, upload-time = "2025-09-03T14:31:44.574Z" }, + { url = "https://files.pythonhosted.org/packages/4f/61/98fa07981722660f5a3c28b987df99c2486f63d01b1256e6cca05a43bdce/uv-0.8.15-py3-none-manylinux_2_17_ppc64.manylinux2014_ppc64.whl", hash = "sha256:de9896ad4fa724ab317a8048f4891b9b23df1403b3724e96606f3be2dbbbf009", size = 22193727, upload-time = "2025-09-03T14:31:46.915Z" }, + { url = "https://files.pythonhosted.org/packages/fa/65/523188e11a759144b00f0fe48943f6d00706fcd9b5f561a54a07b9fd4541/uv-0.8.15-py3-none-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:226360003e71084e0a73cbec72170e88634b045e95529654d067ea3741bba242", size = 21817550, upload-time = "2025-09-03T14:31:49.548Z" }, + { url = "https://files.pythonhosted.org/packages/99/3c/7898acf3d9ed2d3a2986cccc8209c14d3e9ac72dfaa616e49d329423b1d3/uv-0.8.15-py3-none-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:9488260536b35b94a79962fea76837f279c0cd0ae5021c761e66b311f47ffa70", size = 21024011, upload-time = "2025-09-03T14:31:51.789Z" }, + { url = "https://files.pythonhosted.org/packages/13/fc/e0da45ee179367dcc1e1040ad00ed8a99b78355d43024b0b5fc2edf5c389/uv-0.8.15-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:07765f99fd5fd3b257d7e210e8d0844c0a8fd111612e31fcca66a85656cc728e", size = 21009338, upload-time = "2025-09-03T14:31:54.104Z" }, + { url = "https://files.pythonhosted.org/packages/ce/5d/180904fa7ed49081b27f00e86f7220ca62cc098d7ef6459f0c69a8ae8f74/uv-0.8.15-py3-none-manylinux_2_28_aarch64.whl", hash = "sha256:c4868e6a4e1a8c777a5ba3cff452c405837318fb0b272ff203bfda0e1b8fc54d", size = 19799578, upload-time = "2025-09-03T14:31:56.47Z" }, + { url = "https://files.pythonhosted.org/packages/b6/09/fed823212e695b6765bdb8462850abffbe685cd965c4de905efed5e2e5c9/uv-0.8.15-py3-none-manylinux_2_31_riscv64.whl", hash = "sha256:3ec78a54a8eb0bbb9a9c653982390af84673657c8a48a0be6cdcb81d7d3e95c3", size = 20845428, upload-time = "2025-09-03T14:31:59.475Z" }, + { url = "https://files.pythonhosted.org/packages/b9/f3/9c4211897c00f79b7973a10800166e0580eaad20fe27f7c06adb7b248ac7/uv-0.8.15-py3-none-musllinux_1_1_armv7l.whl", hash = "sha256:a022a752d20da80d2a49fc0721522a81e3a32efe539152d756d84ebdba29dbc3", size = 19728113, upload-time = "2025-09-03T14:32:01.686Z" }, + { url = "https://files.pythonhosted.org/packages/3b/43/4ec6047150e2fba494d80d36b881a1a973835afa497ae9ccdf51828cae4f/uv-0.8.15-py3-none-musllinux_1_1_i686.whl", hash = "sha256:3780d2f3951d83e55812fdeb7eee233787b70c774497dbfc55b0fdf6063aa345", size = 20169115, upload-time = "2025-09-03T14:32:03.995Z" }, + { url = "https://files.pythonhosted.org/packages/ea/98/b4220bf462fb225c4a2d74ef4f105020238472b4b0da94ebc17a310d7b4e/uv-0.8.15-py3-none-musllinux_1_1_x86_64.whl", hash = "sha256:56f2451c9193ee1754ce1d8390ded68e9cb8dee0aaf7e2f38a9bd04d99be1be7", size = 21129804, upload-time = "2025-09-03T14:32:06.204Z" }, + { url = "https://files.pythonhosted.org/packages/5e/b8/40ce3d385254ac87a664a5d9a4664fac697e2734352f404382b81d03235b/uv-0.8.15-py3-none-win32.whl", hash = "sha256:89c7c10089e07d944c72d388fd88666c650dec2f8c79ca541e365f32843882c6", size = 19077103, upload-time = "2025-09-03T14:32:08.628Z" }, + { url = "https://files.pythonhosted.org/packages/2b/9d/081a0af395c0e307c0c930e80161a2aa551c25064cfb636d060574566fa4/uv-0.8.15-py3-none-win_amd64.whl", hash = "sha256:6aa824ab933dfafe11efe32e6541c6bcd65ecaa927e8e834ea6b14d3821020f6", size = 21179816, upload-time = "2025-09-03T14:32:11.42Z" }, + { url = "https://files.pythonhosted.org/packages/30/47/d8f50264a8c8ebbb9a44a8fed08b6e873d943adf299d944fe3a776ff5fbf/uv-0.8.15-py3-none-win_arm64.whl", hash = "sha256:a395fa1fc8948eacdd18e4592ed489fad13558b13fea6b3544cb16e5006c5b02", size = 19448833, upload-time = "2025-09-03T14:32:13.639Z" }, ]