diff options
author | metamuffin <metamuffin@disroot.org> | 2024-06-29 16:10:07 +0200 |
---|---|---|
committer | metamuffin <metamuffin@disroot.org> | 2024-06-29 16:10:07 +0200 |
commit | 58f4ab0b26948bec13ba853c90298271e472169f (patch) | |
tree | 9fa6e4443addf067310ff9ba868ec72b9e237637 /server/src/bin/graph.rs | |
parent | b0042dce860406431f2e486112b14987c665f6a8 (diff) | |
download | hurrycurry-58f4ab0b26948bec13ba853c90298271e472169f.tar hurrycurry-58f4ab0b26948bec13ba853c90298271e472169f.tar.bz2 hurrycurry-58f4ab0b26948bec13ba853c90298271e472169f.tar.zst |
implement points
Diffstat (limited to 'server/src/bin/graph.rs')
-rw-r--r-- | server/src/bin/graph.rs | 22 |
1 files changed, 16 insertions, 6 deletions
diff --git a/server/src/bin/graph.rs b/server/src/bin/graph.rs index deae2034..024512c6 100644 --- a/server/src/bin/graph.rs +++ b/server/src/bin/graph.rs @@ -17,7 +17,7 @@ */ use anyhow::{anyhow, Result}; use undercooked::{ - data::DataIndex, + data::{DataIndex, Demand}, interaction::Recipe, protocol::{ItemIndex, RecipeIndex}, }; @@ -59,14 +59,24 @@ fn main() -> Result<()> { } } - for (di, d) in data.demands.iter().enumerate() { + for ( + di, + Demand { + duration, + from: ItemIndex(from), + to, + points, + }, + ) in data.demands.iter().enumerate() + { let color = "#c4422b"; println!( - "d{di} [label=\"Demand\\ntakes {}s\" shape=box color={color:?} fillcolor={color:?} style=filled]", - d.duration + "d{di} [label=\"Demand\\ntakes {duration}s\\n{points} points\" shape=box color={color:?} fillcolor={color:?} style=filled]", ); - println!("i{} -> d{di}", d.from.0); - println!("d{di} -> i{}", d.to.0); + println!("i{from} -> d{di}"); + if let Some(ItemIndex(to)) = to { + println!("d{di} -> i{to}"); + } } println!("}}"); |