diff --git a/Cargo.lock b/Cargo.lock
index d790f76..639bab1 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -372,7 +372,7 @@ checksum = "447660ad36a13288b1db4d4248e857b510e8c3a225c822ba4fb748c0aafecffd"
[[package]]
name = "xiv_craft_simulator"
-version = "0.1.1"
+version = "0.1.2"
dependencies = [
"clap",
"lazy_static",
diff --git a/Cargo.toml b/Cargo.toml
index 8e68114..836cbb9 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -1,7 +1,8 @@
[package]
name = "xiv_craft_simulator"
-version = "0.1.1"
+version = "0.1.2"
edition = "2021"
+author = "谭俊健 & Dandaedre"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
@@ -13,4 +14,6 @@ toml = "0.5.9"
clap = {version = "4.1.6", features = ["derive"]}
[profile.release]
-panic = 'abort'
\ No newline at end of file
+panic = 'abort'
+opt-level = 3
+lto = true
\ No newline at end of file
diff --git a/README.md b/README.md
index a5dd233..4d20cc2 100644
--- a/README.md
+++ b/README.md
@@ -15,22 +15,16 @@ Note: The recipe data can be retrieved from [FFXIV Crafting Optimizer](https://y
with checking of **Custom Recipe** after selecting the recipe.

```toml
-[recipe]
+[default_recipe]
durability = 70
progress = 5060
-quality = 12628
-progress_divider = 130 # as Progress Difficulty
-quality_divider = 115 # as Quality Difficulty
-progress_modifier = 80 # as Extra Progress Difficulty
-quality_modifier = 70 # as Extra Quality Difficulty
+quality = 10920
+progress_divider = 130
+quality_divider = 115
+progress_modifier = 80
+quality_modifier = 70
-[stats] # including food and potion
-craftsmanship = 3745
-control = 3636
-max_cp = 670
-
-
-[recipe]
+[recipe_35]
durability = 35
progress = 3696
quality = 8200
@@ -39,7 +33,7 @@ quality_divider = 115
progress_modifier = 80
quality_modifier = 70
-[stats]
+[default_character]
craftsmanship = 4041
control = 3959
max_cp = 602
diff --git a/craft.toml b/craft.toml
index f2a4572..5829bc9 100644
--- a/craft.toml
+++ b/craft.toml
@@ -1,13 +1,31 @@
[default_recipe]
durability = 70
-progress = 5060
+progress = 3900
quality = 10920
progress_divider = 130
quality_divider = 115
progress_modifier = 80
quality_modifier = 70
-[recipe_35]
+[two_star_70]
+durability = 70
+progress = 3900
+quality = 10920
+progress_divider = 130
+quality_divider = 115
+progress_modifier = 80
+quality_modifier = 70
+
+[three_star_70]
+durability = 70
+progress = 5060
+quality = 12628
+progress_divider = 130
+quality_divider = 115
+progress_modifier = 80
+quality_modifier = 70
+
+[three_star_35]
durability = 35
progress = 3696
quality = 8200
@@ -16,7 +34,22 @@ quality_divider = 115
progress_modifier = 80
quality_modifier = 70
+[two_star_35]
+durability = 35
+progress = 2925
+quality = 7800
+progress_divider = 130
+quality_divider = 115
+progress_modifier = 80
+quality_modifier = 70
+
[default_character]
craftsmanship = 4041
control = 3959
-max_cp = 602
\ No newline at end of file
+max_cp = 602
+
+[cero]
+craftsmanship = 1818
+control = 1983
+max_cp = 467
+_max_cp = 600
\ No newline at end of file
diff --git a/src/craft.rs b/src/craft.rs
index 7053ca0..ed09088 100644
--- a/src/craft.rs
+++ b/src/craft.rs
@@ -2,6 +2,8 @@ use std::fmt::{Debug, Formatter,Display};
use crate::action::Action;
use crate::specs::{Buff, BuffState, Recipe, Stats, Success};
+
+
#[derive(Clone)]
pub struct Craft<'a> {
pub recipe: &'a Recipe,
@@ -14,10 +16,11 @@ pub struct Craft<'a> {
pub cp: i32,
pub success: Success,
pub actions: Vec<&'a Action>,
+ pub depth: u32,
}
impl<'a> Craft<'a> {
- pub fn new(recipe: &'a Recipe, stats: &'a Stats) -> Craft<'a> {
+ pub fn new(recipe: &'a Recipe, stats: &'a Stats, depth: &'a u32) -> Craft<'a> {
Self {
recipe,
stats,
@@ -29,6 +32,7 @@ impl<'a> Craft<'a> {
cp: stats.max_cp as i32,
success: Success::Pending,
actions: Vec::new(),
+ depth: *depth,
}
}
diff --git a/src/main.rs b/src/main.rs
index 2ae1fb4..8c73248 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -11,18 +11,25 @@ mod solver;
#[derive(Parser, Debug)]
#[command(author, version, about, long_about = None)]
struct Args {
- /// Name of the receipe
- #[arg(short, long, default_value_t = String::from("default_recipe"))]
- recipe_name: String,
+ /// Name of the receipe
+ #[arg(short, long, default_value_t = String::from("default_recipe"))]
+ recipe_name: String,
- /// Name of the character
- #[arg(short, long, default_value_t = String::from("default_character"))]
- character_name: String,
+ /// Name of the character
+ #[arg(short, long, default_value_t = String::from("default_character"))]
+ character_name: String,
- /// The ml file name
+ /// The ml file name
#[arg(short, long, default_value_t = String::from("craft.toml"))]
file_name: String,
+ /// The verbose flag
+ #[arg(short, long, action = clap::ArgAction::Count)]
+ verbose: u8,
+
+ /// The depth of the first pass
+ #[arg(short, long, default_value_t = 8)]
+ depth: u32,
}
#[derive(Debug)]
@@ -94,16 +101,27 @@ fn main() {
&args.character_name,&args.file_name))
.as_integer().expect("Can't convert max_cp as an integer") as u32,
};
- let craft = Craft::new(&recipe, &stats);
- println!("Solving...\n");
- println!("[P1] Starting phase 1...");
- let phase1_routes = generate_routes_phase1(craft);
- println!("[P1] Found {} routes, testing them all...",phase1_routes.len());
- for r in &phase1_routes{
- println!("[P1] {:?}",r);
- };
+ let craft = Craft::new(&recipe, &stats, &args.depth);
- // panic!("");
+ if args.verbose>0{
+ println!("Solving...\n");
+ println!("[P1] Starting phase 1...");
+ }
+ let phase1_routes = generate_routes_phase1(craft);
+
+ if args.verbose>1{
+ println!("[P1] Found {} routes, testing them all...",phase1_routes.len());
+ for r in &phase1_routes{
+ println!("[P1] {:?} p:{}% q:{}% c:{} d:{}",
+ r.actions,
+ r.progression * 100 / r.recipe.progress,
+ r.quality * 100 / r.recipe.quality,
+ r.cp,
+ r.durability,
+ );
+ // println!("[P1] {}",r);
+ };
+ }
let mut phase2_routes = Vec::new();
for route in phase1_routes {
@@ -111,16 +129,26 @@ fn main() {
phase2_routes.push(route);
}
}
- // println!("{:?}", phase2_routes);
- // let top_route = match phase2_routes.iter().max_by_key(|route| route.quality) {
- // Some(top) => top,
- // None => return,
- // };
- println!("{:?}", phase2_routes);
- let top_route = match phase2_routes.iter().min_by_key(|route| route.step_count) {
+
+ if args.verbose>1{
+ println!("[P2] Found {} solutions, sorting",phase2_routes.len());
+ for r in &phase2_routes{
+ println!("[P2] {:?} p:{}% q:{}% d:{}",
+ r.actions,
+ r.progression * 100 / r.recipe.progress,
+ r.quality * 100 / r.recipe.quality,
+ r.durability);
+ };
+ }
+
+ let top_route = match phase2_routes.iter().max_by_key(|route| route.quality) {
Some(top) => top,
None => return,
};
+ // let top_route = match phase2_routes.iter().min_by_key(|route| route.step_count) {
+ // Some(top) => top,
+ // None => return,
+ // };
let mut content = (&top_route.actions)
.iter()
@@ -135,9 +163,15 @@ fn main() {
content.push("\"observe\"".to_string());
content.push("\"focusedSynthesis\"".to_string());
}
+
+ if args.verbose>2{
+ println!("[F] Top route {:?}",top_route);
+ }
+
println!("Quality: {}/{}", top_route.quality, top_route.recipe.quality);
println!("\t[{}]", content.join(", "));
- // wait for enter
+
+ // Wait for enter
println!();
println!("Press enter to exit...");
let mut input = String::new();
diff --git a/src/solver.rs b/src/solver.rs
index 0d30280..8f1db5e 100644
--- a/src/solver.rs
+++ b/src/solver.rs
@@ -11,17 +11,29 @@ pub fn next_action_picker_1<'a>(craft: &Craft) -> Vec