Skip to content

Commit

Permalink
Add simple domineering whiteboard GUI
Browse files Browse the repository at this point in the history
  • Loading branch information
t4ccer committed Sep 15, 2024
1 parent 977aeeb commit cb5c377
Show file tree
Hide file tree
Showing 9 changed files with 1,442 additions and 28 deletions.
424 changes: 400 additions & 24 deletions Cargo.lock

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ rayon = ["dep:rayon"]
path = "./cgt/lib.rs"

[workspace]
members = ["cgt_cli", "cgt_py", "cgt_derive"]
members = ["cgt_cli", "cgt_py", "cgt_derive", "cgt_gui"]

[profile.release]
lto = true
Expand Down
6 changes: 6 additions & 0 deletions cgt/grid.rs
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,12 @@ pub trait BitTile: Sized {

/// Convert `bool` to tile
fn bool_to_tile(input: bool) -> Self;

/// Flip the tile
#[inline]
fn flip(self) -> Self {
Self::bool_to_tile(!self.tile_to_bool())
}
}

impl BitTile for bool {
Expand Down
3 changes: 3 additions & 0 deletions cgt/short/partizan/games/domineering.rs
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,9 @@ where
#[must_use]
#[allow(clippy::missing_panics_doc)]
pub fn move_top_left(&self) -> Self {
// TODO: We should use this to also "fill 1x1 holes" i.e. when we have grids that after running
// bfs has 1x1 regions we can fill them in and reduce grid then.

Self::new(move_top_left(&self.grid, Tile::is_non_blocking))
}
}
Expand Down
12 changes: 12 additions & 0 deletions cgt_gui/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
[package]
name = "cgt_gui"
version = "0.5.1"
edition = "2021"

[dependencies]
raylib = {version = "5.0.2", features = ["wayland"]}
cgt = { path = "../.", features = [] }

[[bin]]
name = "cgt-gui"
path = "src/main.rs"
Binary file added cgt_gui/src/Inconsolata.ttf
Binary file not shown.
Loading

0 comments on commit cb5c377

Please sign in to comment.