diff options
Diffstat (limited to 'server/src/bin')
| -rw-r--r-- | server/src/bin/graph.rs | 43 | 
1 files changed, 21 insertions, 22 deletions
| diff --git a/server/src/bin/graph.rs b/server/src/bin/graph.rs index c16bfe2d..7019de9c 100644 --- a/server/src/bin/graph.rs +++ b/server/src/bin/graph.rs @@ -16,7 +16,7 @@  */  use anyhow::{anyhow, Result}; -use hurrycurry_protocol::{ItemIndex, Recipe, RecipeIndex}; +use hurrycurry_protocol::{Demand, ItemIndex, Recipe, RecipeIndex};  use hurrycurry_server::data::DataIndex;  #[tokio::main] @@ -30,7 +30,7 @@ async fn main() -> Result<()> {          .nth(1)          .ok_or(anyhow!("first arg should be recipe set name"))?; -    let (data, _, _) = index.generate(format!("sushibar-{rn}")).await?; +    let (data, _, _) = index.generate(format!("5star-{rn}")).await?;      for i in 0..data.item_names.len() {          println!("i{i} [label=\"{}\"]", data.item_name(ItemIndex(i))) @@ -57,26 +57,25 @@ async fn main() -> Result<()> {          }      } -    // TODO -    // for ( -    //     di, -    //     Demand { -    //         duration, -    //         from: ItemIndex(from), -    //         to, -    //         points, -    //     }, -    // ) in data.demands.iter().enumerate() -    // { -    //     let color = "#c4422b"; -    //     println!( -    //         "d{di} [label=\"Demand\\ntakes {duration}s\\n{points} points\" shape=box color={color:?} fillcolor={color:?} style=filled]", -    //     ); -    //     println!("i{from} -> d{di}"); -    //     if let Some(ItemIndex(to)) = to { -    //         println!("d{di} -> i{to}"); -    //     } -    // } +    for ( +        di, +        Demand { +            duration, +            input: ItemIndex(input), +            output, +            points, +        }, +    ) in data.demands.iter().enumerate() +    { +        let color = "#c4422b"; +        println!( +            "d{di} [label=\"Demand\\ntakes {duration}s\\n{points} points\" shape=box color={color:?} fillcolor={color:?} style=filled]", +        ); +        println!("i{input} -> d{di}"); +        if let Some(ItemIndex(output)) = output { +            println!("d{di} -> i{output}"); +        } +    }      println!("}}");      Ok(()) | 
