Set up the game review page along with #229

Merged
savanni merged 24 commits from otg/game-review into main 2024-03-31 23:37:51 +00:00
2 changed files with 0 additions and 5 deletions
Showing only changes of commit 78863ee709 - Show all commits

View File

@ -320,7 +320,6 @@ impl<T> Tree<T> {
.iter() .iter()
.take_while(|n| **n != node.id) .take_while(|n| **n != node.id)
.fold(0, |acc, n| acc + self.width(*n)); .fold(0, |acc, n| acc + self.width(*n));
println!("[{}] sibling width {}", idx, sibling_width);
(node.depth, parent_column + sibling_width) (node.depth, parent_column + sibling_width)
} }
@ -340,7 +339,6 @@ impl<T> Tree<T> {
// My algorithm right now is likely to generate unnecessarily wide trees in a complex game // My algorithm right now is likely to generate unnecessarily wide trees in a complex game
// review. // review.
fn width(&self, id: usize) -> usize { fn width(&self, id: usize) -> usize {
println!("[{}] calculating width", id);
let node = &self.nodes[id]; let node = &self.nodes[id];
if let Some(width) = *node.width.borrow() { if let Some(width) = *node.width.borrow() {
return width; return width;
@ -351,7 +349,6 @@ impl<T> Tree<T> {
.iter() .iter()
.fold(0, |acc, child| acc + self.width(*child)); .fold(0, |acc, child| acc + self.width(*child));
let width = if width == 0 { 1 } else { width }; let width = if width == 0 { 1 } else { width };
println!("[{}] width: {}", id, width);
*node.width.borrow_mut() = Some(width); *node.width.borrow_mut() = Some(width);
width width

View File

@ -67,7 +67,6 @@ impl ReviewTree {
} }
pub fn redraw(&self, ctx: &Context, _width: i32, _height: i32) { pub fn redraw(&self, ctx: &Context, _width: i32, _height: i32) {
println!("redraw");
let tree: &Option<Tree<Uuid>> = &self.imp().tree.borrow(); let tree: &Option<Tree<Uuid>> = &self.imp().tree.borrow();
match tree { match tree {
Some(ref tree) => { Some(ref tree) => {
@ -78,7 +77,6 @@ impl ReviewTree {
// code? // code?
ctx.set_source_rgb(0.7, 0.7, 0.7); ctx.set_source_rgb(0.7, 0.7, 0.7);
let (row, column) = tree.position(node.id); let (row, column) = tree.position(node.id);
println!("[{}] {} x {}", node.id, row, column);
let y = (row as f64) * 20. + 10.; let y = (row as f64) * 20. + 10.;
let x = (column as f64) * 20. + 10.; let x = (column as f64) * 20. + 10.;
ctx.arc(x, y, 5., 0., 2. * std::f64::consts::PI); ctx.arc(x, y, 5., 0., 2. * std::f64::consts::PI);