/* Hurry Curry! - a game about cooking Copyright 2024 metamuffin This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, version 3 of the License only. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details. You should have received a copy of the GNU Affero General Public License along with this program. If not, see . */ use anyhow::{anyhow, Result}; use hurrycurry_protocol::{ItemIndex, RecipeIndex}; use hurrycurry_server::{data::DataIndex, interaction::Recipe}; #[tokio::main] async fn main() -> Result<()> { let mut index = DataIndex::default(); index.reload()?; println!("digraph {{"); let rn = std::env::args() .nth(1) .ok_or(anyhow!("first arg should be recipe set name"))?; let data = index.generate(format!("sushibar-{rn}")).await?; for i in 0..data.item_names.len() { println!("i{i} [label=\"{}\"]", data.item_name(ItemIndex(i))) } for (RecipeIndex(ri), recipe) in data.recipes() { let (kind, color) = match recipe { Recipe::Passive { .. } => ("Passive", "#2bc493"), Recipe::Active { .. } => ("Active", "#47c42b"), Recipe::Instant { .. } => ("Instant", "#5452d8"), }; println!( "r{ri} [label=\"{kind}\\non {}\" shape=box color={color:?} fillcolor={color:?} style=filled]", if let Some(tile) = recipe.tile() { data.tile_name(tile) } else { "anything" } ); for ItemIndex(input) in recipe.inputs() { println!("i{input} -> r{ri}") } for ItemIndex(output) in recipe.outputs() { println!("r{ri} -> i{output}") } } // 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}"); // } // } println!("}}"); Ok(()) }