diff --git a/.gitignore b/.gitignore
index 44bf683..04a3981 100644
--- a/.gitignore
+++ b/.gitignore
@@ -8,6 +8,7 @@ releases/*
.whl
pyinstaller_log.txt
llvm/*
+/coverage/*
# Byte-compiled / optimized / DLL files
__pycache__/
diff --git a/Cargo.lock b/Cargo.lock
index f5b5874..18a2bae 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -590,7 +590,7 @@ checksum = "447660ad36a13288b1db4d4248e857b510e8c3a225c822ba4fb748c0aafecffd"
[[package]]
name = "xiv_csolver"
-version = "0.2.0"
+version = "0.1.6"
dependencies = [
"clap",
"lazy_static",
diff --git a/coverage/html/badges/flat.svg b/coverage/html/badges/flat.svg
index ca7e6f8..d9147e7 100644
--- a/coverage/html/badges/flat.svg
+++ b/coverage/html/badges/flat.svg
@@ -1,6 +1,6 @@
\ No newline at end of file
diff --git a/coverage/html/badges/flat_square.svg b/coverage/html/badges/flat_square.svg
index 9f2ccbb..76037e6 100644
--- a/coverage/html/badges/flat_square.svg
+++ b/coverage/html/badges/flat_square.svg
@@ -1,13 +1,13 @@
\ No newline at end of file
diff --git a/coverage/html/badges/for_the_badge.svg b/coverage/html/badges/for_the_badge.svg
index 17ec9e4..53a73bc 100644
--- a/coverage/html/badges/for_the_badge.svg
+++ b/coverage/html/badges/for_the_badge.svg
@@ -1,13 +1,13 @@
\ No newline at end of file
diff --git a/coverage/html/badges/plastic.svg b/coverage/html/badges/plastic.svg
index a127f7c..1296731 100644
--- a/coverage/html/badges/plastic.svg
+++ b/coverage/html/badges/plastic.svg
@@ -1,6 +1,6 @@
\ No newline at end of file
diff --git a/coverage/html/badges/social.svg b/coverage/html/badges/social.svg
index 81f5278..5dc8ab7 100644
--- a/coverage/html/badges/social.svg
+++ b/coverage/html/badges/social.svg
@@ -1,6 +1,6 @@
\ No newline at end of file
diff --git a/coverage/html/coverage.json b/coverage/html/coverage.json
deleted file mode 100644
index b3f9229..0000000
--- a/coverage/html/coverage.json
+++ /dev/null
@@ -1 +0,0 @@
-{"schemaVersion":1,"label":"coverage","message":"10%","color":"red"}
\ No newline at end of file
diff --git a/coverage/html/index.html b/coverage/html/index.html
deleted file mode 100644
index efa6e0b..0000000
--- a/coverage/html/index.html
+++ /dev/null
@@ -1,129 +0,0 @@
-
-
-
-
- Grcov report - top_level
-
-
-
-
-
-
-
-
-
- | Directory |
- Line Coverage |
- Functions |
- Branches |
-
-
-
- | src |
-
-
-
- |
-
- 10.84%
- |
-
- 115 / 1061
- |
-
- 8.53% |
- 29 / 340 |
-
- 100% |
- 0 / 0 |
-
-
- | src/bin |
-
-
-
- |
-
- 1.64%
- |
-
- 1 / 61
- |
-
- 20% |
- 1 / 5 |
-
- 100% |
- 0 / 0 |
-
-
- | tests |
-
-
-
- |
-
- 100%
- |
-
- 2 / 2
- |
-
- 100% |
- 2 / 2 |
-
- 100% |
- 0 / 0 |
-
-
-
-
-
-
diff --git a/coverage/html/src/action.rs.html b/coverage/html/src/action.rs.html
deleted file mode 100644
index f402e3a..0000000
--- a/coverage/html/src/action.rs.html
+++ /dev/null
@@ -1,4912 +0,0 @@
-
-
-
-
- Grcov report - action.rs
-
-
-
-
-
-
-
-
-
-
-
-
-
use crate::craft::Craft;
-
-
-
-
-
-
-
-
use crate::specs::{Buff, Success};
-
-
-
-
-
-
-
-
use lazy_static::lazy_static;
-
-
-
-
-
-
-
-
pub buff: Option<(Buff, u8)>,
-
-
-
-
-
-
-
-
pub short_name: String,
-
-
-
-
-
-
-
-
pub struct ActionBuilder {
-
-
-
-
-
-
-
-
pub fn new(name: &str) -> Self {
-
-
-
-
-
-
-
-
let mut short_name = name.to_string();
-
-
-
-
-
-
-
-
short_name = short_name.replace("II", "2");
-
-
-
-
-
-
-
-
short_name.retain(|c| !c.is_whitespace() && c != '\'');
-
-
-
-
-
-
-
-
short_name[0..1].make_ascii_lowercase();
-
-
-
-
-
-
-
-
if name == "Basic Synthesis" {
-
-
-
-
-
-
-
-
short_name = "basicSynth2".to_string();
-
-
-
-
-
-
-
-
if name == "Groundwork" {
-
-
-
-
-
-
-
-
short_name = "groundwork".to_string();
-
-
-
-
-
-
-
-
if name == "Careful Synthesis" {
-
-
-
-
-
-
-
-
short_name = "carefulSynthesis".to_string();
-
-
-
-
-
-
-
-
name: name.to_string(),
-
-
-
-
-
-
-
-
pub fn dur(mut self, dur: u32) -> Self {
-
-
-
-
-
-
-
-
self.action.dur = dur;
-
-
-
-
-
-
-
-
pub fn cp(mut self, cp: u32) -> Self {
-
-
-
-
-
-
-
-
pub fn progress(mut self, progress: u32) -> Self {
-
-
-
-
-
-
-
-
self.action.progress = progress;
-
-
-
-
-
-
-
-
pub fn quality(mut self, quality: u32) -> Self {
-
-
-
-
-
-
-
-
self.action.quality = quality;
-
-
-
-
-
-
-
-
pub fn buff(mut self, buff: Option<(Buff, u8)>) -> Self {
-
-
-
-
-
-
-
-
self.action.buff = buff;
-
-
-
-
-
-
-
-
pub fn build(self) -> Action {
-
-
-
-
-
-
-
-
impl PartialEq for Action {
-
-
-
-
-
-
-
-
fn eq(&self, other: &Self) -> bool {
-
-
-
-
-
-
-
-
&& self.dur == other.dur
-
-
-
-
-
-
-
-
&& self.progress == other.progress
-
-
-
-
-
-
-
-
&& self.quality == other.quality
-
-
-
-
-
-
-
-
pub fn get_name(&self) -> String {
-
-
-
-
-
-
-
-
pub fn get_cp_cost(&self, _craft: &Craft) -> u32 {
-
-
-
-
-
-
-
-
if self == &ACTIONS.standard_touch && _craft.buffs.basic_touch > 0 {
-
-
-
-
-
-
-
-
if self == &ACTIONS.advanced_touch && _craft.buffs.standard_touch > 0 {
-
-
-
-
-
-
-
-
pub fn get_durability_cost(&self, _craft: &Craft) -> u32 {
-
-
-
-
-
-
-
-
if self == &ACTIONS.masters_mend {
-
-
-
-
-
-
-
-
if self.dur == 0 || self.progress == 0 && self.quality == 0 {
-
-
-
-
-
-
-
-
let mut dur = self.dur;
-
-
-
-
-
-
-
-
if _craft.buffs.waste_not > 0 {
-
-
-
-
-
-
-
-
pub fn get_progress(&self, _craft: &Craft) -> u32 {
-
-
-
-
-
-
-
-
let mut prog = self.progress as f64;
-
-
-
-
-
-
-
-
if self.dur == 20 && _craft.durability < self.get_durability_cost(_craft) as i32 {
-
-
-
-
-
-
-
-
if _craft.buffs.muscle_memory > 0 {
-
-
-
-
-
-
-
-
if _craft.buffs.veneration > 0 {
-
-
-
-
-
-
-
-
(prog * mult).floor() as u32
-
-
-
-
-
-
-
-
pub fn get_quality(&self, _craft: &Craft) -> u32 {
-
-
-
-
-
-
-
-
let mut qual = self.quality as f64;
-
-
-
-
-
-
-
-
if self == &ACTIONS.byregot_blessing {
-
-
-
-
-
-
-
-
qual = (100 + 20 * _craft.buffs.inner_quiet as u32) as f64;
-
-
-
-
-
-
-
-
if self.dur == 20 && _craft.durability < self.get_durability_cost(_craft) as i32 {
-
-
-
-
-
-
-
-
if _craft.buffs.great_strides > 0 {
-
-
-
-
-
-
-
-
if _craft.buffs.innovation > 0 {
-
-
-
-
-
-
-
-
let iq_mult = (_craft.buffs.inner_quiet as f64 * 0.1) + 1.0;
-
-
-
-
-
-
-
-
(qual * mult * iq_mult).floor() as u32
-
-
-
-
-
-
-
-
pub fn get_buff(&self) -> Option<(Buff, u8)> {
-
-
-
-
-
-
-
-
pub fn can_use(&self, _craft: &Craft) -> bool {
-
-
-
-
-
-
-
-
if self.get_cp_cost(_craft) > _craft.cp as u32 {
-
-
-
-
-
-
-
-
if _craft.success != Success::Pending {
-
-
-
-
-
-
-
-
if self == &ACTIONS.byregot_blessing {
-
-
-
-
-
-
-
-
return _craft.buffs.inner_quiet > 0;
-
-
-
-
-
-
-
-
if self == &ACTIONS.muscle_memory || self == &ACTIONS.reflect {
-
-
-
-
-
-
-
-
return _craft.step_count == 0;
-
-
-
-
-
-
-
-
if self == &ACTIONS.trained_finesse {
-
-
-
-
-
-
-
-
return _craft.buffs.inner_quiet >= 10;
-
-
-
-
-
-
-
-
impl Debug for Action {
-
-
-
-
-
-
-
-
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
-
-
-
-
-
-
-
-
f.write_str(&self.name)
-
-
-
-
-
-
-
-
pub struct ActionList {
-
-
-
-
-
-
-
-
pub muscle_memory: Action,
-
-
-
-
-
-
-
-
pub basic_synthesis: Action,
-
-
-
-
-
-
-
-
pub careful_synthesis: Action,
-
-
-
-
-
-
-
-
pub groundwork: Action,
-
-
-
-
-
-
-
-
pub prudent_synthesis: Action,
-
-
-
-
-
-
-
-
pub delicate_synthesis: Action,
-
-
-
-
-
-
-
-
pub basic_touch: Action,
-
-
-
-
-
-
-
-
pub standard_touch: Action,
-
-
-
-
-
-
-
-
pub byregot_blessing: Action,
-
-
-
-
-
-
-
-
pub prudent_touch: Action,
-
-
-
-
-
-
-
-
pub preparatory_touch: Action,
-
-
-
-
-
-
-
-
pub advanced_touch: Action,
-
-
-
-
-
-
-
-
pub trained_finesse: Action,
-
-
-
-
-
-
-
-
pub masters_mend: Action,
-
-
-
-
-
-
-
-
pub waste_not: Action,
-
-
-
-
-
-
-
-
pub waste_not_ii: Action,
-
-
-
-
-
-
-
-
pub manipulation: Action,
-
-
-
-
-
-
-
-
pub veneration: Action,
-
-
-
-
-
-
-
-
pub great_strides: Action,
-
-
-
-
-
-
-
-
pub innovation: Action,
-
-
-
-
-
-
-
-
//pub observe: Action,
-
-
-
-
-
-
-
-
//pub focused_synthesis: Action,
-
-
-
-
-
-
-
-
impl Default for ActionList {
-
-
-
-
-
-
-
-
fn default() -> Self {
-
-
-
-
-
-
-
-
muscle_memory: ActionBuilder::new("Muscle Memory")
-
-
-
-
-
-
-
-
.buff(Some((Buff::MuscleMemory, 5)))
-
-
-
-
-
-
-
-
reflect: ActionBuilder::new("Reflect")
-
-
-
-
-
-
-
-
.buff(Some((Buff::InnerQuiet, 1)))
-
-
-
-
-
-
-
-
basic_synthesis: ActionBuilder::new("Basic Synthesis").progress(120).build(),
-
-
-
-
-
-
-
-
careful_synthesis: ActionBuilder::new("Careful Synthesis")
-
-
-
-
-
-
-
-
groundwork: ActionBuilder::new("Groundwork")
-
-
-
-
-
-
-
-
prudent_synthesis: ActionBuilder::new("Prudent Synthesis")
-
-
-
-
-
-
-
-
delicate_synthesis: ActionBuilder::new("Delicate Synthesis")
-
-
-
-
-
-
-
-
basic_touch: ActionBuilder::new("Basic Touch")
-
-
-
-
-
-
-
-
.buff(Some((Buff::BasicTouch, 1)))
-
-
-
-
-
-
-
-
standard_touch: ActionBuilder::new("Standard Touch")
-
-
-
-
-
-
-
-
.buff(Some((Buff::StandardTouch, 1)))
-
-
-
-
-
-
-
-
byregot_blessing: ActionBuilder::new("Byregot's Blessing")
-
-
-
-
-
-
-
-
.buff(Some((Buff::InnerQuiet, 0)))
-
-
-
-
-
-
-
-
prudent_touch: ActionBuilder::new("Prudent Touch")
-
-
-
-
-
-
-
-
preparatory_touch: ActionBuilder::new("Preparatory Touch")
-
-
-
-
-
-
-
-
.buff(Some((Buff::InnerQuiet, 1)))
-
-
-
-
-
-
-
-
advanced_touch: ActionBuilder::new("Advanced Touch")
-
-
-
-
-
-
-
-
trained_finesse: ActionBuilder::new("Trained Finesse")
-
-
-
-
-
-
-
-
masters_mend: ActionBuilder::new("Master's Mend").cp(88).build(),
-
-
-
-
-
-
-
-
waste_not: ActionBuilder::new("Waste Not")
-
-
-
-
-
-
-
-
.buff(Some((Buff::WasteNot, 4)))
-
-
-
-
-
-
-
-
waste_not_ii: ActionBuilder::new("Waste Not II")
-
-
-
-
-
-
-
-
.buff(Some((Buff::WasteNot, 8)))
-
-
-
-
-
-
-
-
manipulation: ActionBuilder::new("Manipulation")
-
-
-
-
-
-
-
-
.buff(Some((Buff::Manipulation, 8)))
-
-
-
-
-
-
-
-
veneration: ActionBuilder::new("Veneration")
-
-
-
-
-
-
-
-
.buff(Some((Buff::Veneration, 4)))
-
-
-
-
-
-
-
-
great_strides: ActionBuilder::new("Great Strides")
-
-
-
-
-
-
-
-
.buff(Some((Buff::GreatStrides, 3)))
-
-
-
-
-
-
-
-
innovation: ActionBuilder::new("Innovation")
-
-
-
-
-
-
-
-
.buff(Some((Buff::Innovation, 4)))
-
-
-
-
-
-
-
-
//observe: ActionBuilder::new("observe").cp(18).buff(Some((Buff::Observe, 1))).build(),
-
-
-
-
-
-
-
-
//focused_synthesis: ActionBuilder::new("focused_synthesis").cp(18).quality(100).build(),
-
-
-
-
-
-
-
-
pub static ref ACTIONS: ActionList = ActionList::default();
-
-
-
-
-
-
diff --git a/coverage/html/src/bin/index.html b/coverage/html/src/bin/index.html
deleted file mode 100644
index 1c5c163..0000000
--- a/coverage/html/src/bin/index.html
+++ /dev/null
@@ -1,81 +0,0 @@
-
-
-
-
- Grcov report - src/bin
-
-
-
-
-
-
-
-
-
- | File |
- Line Coverage |
- Functions |
- Branches |
-
-
-
- | xiv_csolver.rs |
-
-
-
- |
-
- 1.64%
- |
-
- 1 / 61
- |
-
- 20% |
- 1 / 5 |
-
- 100% |
- 0 / 0 |
-
-
-
-
-
-
diff --git a/coverage/html/src/bin/xiv_csolver.rs.html b/coverage/html/src/bin/xiv_csolver.rs.html
deleted file mode 100644
index 07f2639..0000000
--- a/coverage/html/src/bin/xiv_csolver.rs.html
+++ /dev/null
@@ -1,1232 +0,0 @@
-
-
-
-
- Grcov report - xiv_csolver.rs
-
-
-
-
-
-
-
-
-
- 11
-
-
-
// #![warn(missing_docs,unsafe_code,unstable_features,)]
-
-
-
-
-
-
-
-
// #![feature(no_coverage)]
-
-
-
-
-
-
-
-
// #![warn(missing_docs)]
-
-
-
-
-
-
-
-
use std::time::Instant;
-
-
-
-
-
-
-
-
struct CustomError(String);
-
-
-
-
-
-
-
-
let args = xiv_csolver_lib::io::Args::parse();
-
-
-
-
-
-
-
-
let params = xiv_csolver_lib::io::Parameters::from_args(&args);
-
-
-
-
-
-
-
-
let now = Instant::now();
-
-
-
-
-
-
-
-
println!("Solving...");
-
-
-
-
-
-
-
-
let (recipe, stats) =
-
-
-
-
-
-
-
-
xiv_csolver_lib::load_from_config(&args.recipe_name, &args.file_name, &args.character_name);
-
-
-
-
-
-
-
-
let results = xiv_csolver_lib::solve_craft(recipe, stats, params);
-
-
-
-
-
-
-
-
let t_final = now.elapsed().as_millis();
-
-
-
-
-
-
-
-
// Show best result depending on selected value
-
-
-
-
-
-
-
-
"[Error] No solutions found for craft '{}' with crafter '{}' (ms)",
-
-
-
-
-
-
-
-
args.recipe_name, args.character_name
-
-
-
-
-
-
-
-
if args.verbose > 0 {
-
-
-
-
-
-
-
-
println!("[Final] {} results were found:", res.len());
-
-
-
-
-
-
-
-
#[cfg(feature = "verbose")]
-
-
-
-
-
-
-
-
if args.verbose > 1 {
-
-
-
-
-
-
-
-
xiv_csolver_lib::print_routes(&results);
-
-
-
-
-
-
-
-
println!("\n > SOLUTION [Least steps] <");
-
-
-
-
-
-
-
-
xiv_csolver_lib::find_fast_route(&results)
-
-
-
-
-
-
-
-
println!("\n > SOLUTION [Most durability] <");
-
-
-
-
-
-
-
-
xiv_csolver_lib::find_safe_route(&results)
-
-
-
-
-
-
-
-
println!("\n > SOLUTION [Most quality] < ");
-
-
-
-
-
-
-
-
xiv_csolver_lib::find_quality_route(&results)
-
-
-
-
-
-
-
-
// #[cfg(feature = "verbose")]
-
-
-
-
-
-
-
-
// if params.verbose>2{
-
-
-
-
-
-
-
-
// println!("[F] Top routes {:?}",results);
-
-
-
-
-
-
-
-
// Wait for user input
-
-
-
-
-
-
-
-
"\nProgram finished successfully in {}ms\nPress enter to exit...",
-
-
-
-
-
-
-
-
let mut input = String::new();
-
-
-
-
-
-
-
-
std::io::stdin().read_line(&mut input).unwrap();
-
-
-
-
-
-
diff --git a/coverage/html/src/craft.rs.html b/coverage/html/src/craft.rs.html
deleted file mode 100644
index d3e70e2..0000000
--- a/coverage/html/src/craft.rs.html
+++ /dev/null
@@ -1,2400 +0,0 @@
-
-
-
-
- Grcov report - craft.rs
-
-
-
-
-
-
-
-
-
-
-
-
-
use crate::action::Action;
-
-
-
-
-
-
-
-
use crate::specs::{Buff, BuffState, Recipe, Stats, Success};
-
-
-
-
-
-
-
-
use crate::Parameters;
-
-
-
-
-
-
-
-
use std::fmt::{Debug, Display, Formatter};
-
-
-
-
-
-
-
-
pub struct Craft<'a> {
-
-
-
-
-
-
-
-
pub buffs: BuffState,
-
-
-
-
-
-
-
-
pub progression: u32,
-
-
-
-
-
-
-
-
pub success: Success,
-
-
-
-
-
-
-
-
pub actions: Vec<&'a Action>,
-
-
-
-
-
-
-
-
pub args: Parameters,
-
-
-
-
-
-
-
-
pub fn new(recipe: Recipe, stats: Stats, params: Parameters) -> Craft<'a> {
-
-
-
-
-
-
-
-
buffs: BuffState::default(),
-
-
-
-
-
-
-
-
durability: recipe.durability as i32,
-
-
-
-
-
-
-
-
cp: stats.max_cp as i32,
-
-
-
-
-
-
-
-
success: Success::Pending,
-
-
-
-
-
-
-
-
pub fn get_base_progression(&self) -> u32 {
-
-
-
-
-
-
-
-
let base_value = (self.stats.craftsmanship as f64 / 10.0)
-
-
-
-
-
-
-
-
/ (self.recipe.progress_divider as f64 / 100.0)
-
-
-
-
-
-
-
-
(base_value * (self.recipe.progress_modifier as f64 / 100.0) as f64).floor() as u32
-
-
-
-
-
-
-
-
pub fn get_base_quality(&self) -> u32 {
-
-
-
-
-
-
-
-
let base_value = (self.stats.control as f64 / 10.0)
-
-
-
-
-
-
-
-
/ (self.recipe.quality_divider as f64 / 100.0)
-
-
-
-
-
-
-
-
(base_value * (self.recipe.quality_modifier as f64 / 100.0) as f64).floor() as u32
-
-
-
-
-
-
-
-
pub fn run_action(&mut self, action: &'a Action) -> &mut Craft<'a> {
-
-
-
-
-
-
-
-
if !action.can_use(self) {
-
-
-
-
-
-
-
-
self.success = Success::Failure;
-
-
-
-
-
-
-
-
self.step_count += 1;
-
-
-
-
-
-
-
-
self.cp -= action.get_cp_cost(self) as i32;
-
-
-
-
-
-
-
-
self.durability -= action.get_durability_cost(self) as i32;
-
-
-
-
-
-
-
-
self.progression += (action.get_progress(self) as f64
-
-
-
-
-
-
-
-
* (self.get_base_progression() as f64 / 100.0))
-
-
-
-
-
-
-
-
self.quality += (action.get_quality(self) as f64 * (self.get_base_quality() as f64 / 100.0))
-
-
-
-
-
-
-
-
if self.progression >= self.recipe.progress {
-
-
-
-
-
-
-
-
self.success = Success::Success;
-
-
-
-
-
-
-
-
if self.durability <= 0 {
-
-
-
-
-
-
-
-
self.success = Success::Failure;
-
-
-
-
-
-
-
-
if self.buffs.manipulation > 0 {
-
-
-
-
-
-
-
-
self.durability += 5;
-
-
-
-
-
-
-
-
if action.quality > 0 {
-
-
-
-
-
-
-
-
self.buffs.inner_quiet += 1;
-
-
-
-
-
-
-
-
if action.progress > 0 {
-
-
-
-
-
-
-
-
self.buffs.remove(Buff::MuscleMemory);
-
-
-
-
-
-
-
-
if action.quality > 0 {
-
-
-
-
-
-
-
-
self.buffs.remove(Buff::GreatStrides);
-
-
-
-
-
-
-
-
if let Some((buff, duration)) = action.get_buff() {
-
-
-
-
-
-
-
-
self.buffs.apply(buff, duration);
-
-
-
-
-
-
-
-
if self.durability > self.recipe.durability as i32 {
-
-
-
-
-
-
-
-
self.durability = self.recipe.durability as i32;
-
-
-
-
-
-
-
-
if self.buffs.inner_quiet > 10 {
-
-
-
-
-
-
-
-
self.buffs.inner_quiet = 10;
-
-
-
-
-
-
-
-
self.actions.push(action);
-
-
-
-
-
-
-
-
// Assumes the craft is finished and tries to add the last actions
-
-
-
-
-
-
-
-
// pub fn add_last_actions(&mut self)->&Self{
-
-
-
-
-
-
-
-
// let arg = (self.recipe.progress as f32 - self.progression as f32) / self.get_base_progression() as f32;
-
-
-
-
-
-
-
-
// self.durability+=10;
-
-
-
-
-
-
-
-
// if 0.0 < arg && arg < 1.2 { self.run_action(&ACTIONS.basic_synthesis);}
-
-
-
-
-
-
-
-
// if 1.2 <= arg && arg < 1.8 { self.cp+=7; self.run_action(&ACTIONS.careful_synthesis); }
-
-
-
-
-
-
-
-
// if 1.8 <= arg && arg < 2.0 {
-
-
-
-
-
-
-
-
// self.run_action(&ACTIONS.observe);
-
-
-
-
-
-
-
-
// self.run_action(&ACTIONS.focused_synthesis);
-
-
-
-
-
-
-
-
impl<'a> Debug for Craft<'a> {
-
-
-
-
-
-
-
-
fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
-
-
-
-
-
-
-
-
let mut binding = f.debug_struct("");
-
-
-
-
-
-
-
-
.field("step_count", &self.step_count)
-
-
-
-
-
-
-
-
.field("progression", &format!("{:?}/{:?}", &self.progression, &self.recipe.progress))
-
-
-
-
-
-
-
-
.field("quality", &format!("{:?}/{:?}", &self.quality, &self.recipe.quality))
-
-
-
-
-
-
-
-
.field("durability", &format!("{:?}/{:?}", &self.durability, &self.recipe.durability))
-
-
-
-
-
-
-
-
// .field("cp", &format!("{:?}/{:?}", &self.cp, &self.stats.max_cp))
-
-
-
-
-
-
-
-
binding.field("actions", &self.actions);
-
-
-
-
-
-
-
-
impl<'a> Display for Craft<'a> {
-
-
-
-
-
-
-
-
fn fmt(&self, f: &mut Formatter) -> std::fmt::Result {
-
-
-
-
-
-
-
-
f.debug_struct("Craft")
-
-
-
-
-
-
-
-
.field("step_count", &self.step_count)
-
-
-
-
-
-
-
-
&format!("{:?}/{:?}", &self.progression, &self.recipe.progress),
-
-
-
-
-
-
-
-
&format!("{:?}/{:?}", &self.quality, &self.recipe.quality),
-
-
-
-
-
-
-
-
&format!("{:?}/{:?}", &self.durability, &self.recipe.durability),
-
-
-
-
-
-
-
-
.field("cp", &format!("{:?}/{:?}", &self.cp, &self.stats.max_cp))
-
-
-
-
-
-
diff --git a/coverage/html/src/index.html b/coverage/html/src/index.html
deleted file mode 100644
index e016d84..0000000
--- a/coverage/html/src/index.html
+++ /dev/null
@@ -1,201 +0,0 @@
-
-
-
-
- Grcov report - src
-
-
-
-
-
-
-
-
-
- | File |
- Line Coverage |
- Functions |
- Branches |
-
-
-
- | action.rs |
-
-
-
- |
-
- 0%
- |
-
- 0 / 239
- |
-
- 0% |
- 0 / 36 |
-
- 100% |
- 0 / 0 |
-
-
- | craft.rs |
-
-
-
- |
-
- 0%
- |
-
- 0 / 102
- |
-
- 0% |
- 0 / 14 |
-
- 100% |
- 0 / 0 |
-
-
- | io.rs |
-
-
-
- |
-
- 53.77%
- |
-
- 114 / 212
- |
-
- 13.4% |
- 28 / 209 |
-
- 100% |
- 0 / 0 |
-
-
- | lib.rs |
-
-
-
- |
-
- 0.43%
- |
-
- 1 / 230
- |
-
- 4.76% |
- 1 / 21 |
-
- 100% |
- 0 / 0 |
-
-
- | solver.rs |
-
-
-
- |
-
- 0%
- |
-
- 0 / 203
- |
-
- 0% |
- 0 / 12 |
-
- 100% |
- 0 / 0 |
-
-
- | specs.rs |
-
-
-
- |
-
- 0%
- |
-
- 0 / 75
- |
-
- 0% |
- 0 / 48 |
-
- 100% |
- 0 / 0 |
-
-
-
-
-
-
diff --git a/coverage/html/src/io.rs.html b/coverage/html/src/io.rs.html
deleted file mode 100644
index efb11ac..0000000
--- a/coverage/html/src/io.rs.html
+++ /dev/null
@@ -1,5328 +0,0 @@
-
-
-
-
- Grcov report - io.rs
-
-
-
-
-
-
-
-
-
-
-
-
-
#[warn(missing_docs)]
-
-
-
-
-
-
-
-
use core::fmt::Display;
-
-
-
-
-
-
-
-
// #[cfg(not(feature = "no_python"))]
-
-
-
-
-
-
-
-
use pyo3::prelude::*;
-
-
-
-
- 1
-
-
-
#[derive(Debug, Clone, Copy)]
-
-
-
-
-
-
-
-
pub struct Parameters {
-
-
-
-
-
-
-
-
pub byregot_step: u8,
-
-
-
-
- 8
-
-
-
#[derive(Parser, Debug, Clone)]
-
-
-
-
-
-
-
-
#[command(author, version, about, long_about = None)]
-
-
-
-
-
-
-
-
/// Name of the receipe
-
-
-
-
- 1
-
-
-
#[arg(short, long, default_value_t = String::from("default_recipe"))]
-
-
-
-
-
-
-
-
pub recipe_name: String,
-
-
-
-
-
-
-
-
/// Name of the character
-
-
-
-
- 1
-
-
-
#[arg(short, long, default_value_t = String::from("default_character"))]
-
-
-
-
-
-
-
-
pub character_name: String,
-
-
-
-
- 1
-
-
-
#[arg(short, long, default_value_t = String::from("craft.toml"))]
-
-
-
-
-
-
-
-
pub file_name: String,
-
-
-
-
-
-
-
-
#[arg(short, long, action = clap::ArgAction::Count)]
-
-
-
-
-
-
-
-
/// The depth of the first pass
-
-
-
-
- 1
-
-
-
#[arg(short, long, default_value_t = 8)]
-
-
-
-
-
-
-
-
/// Thread counts, default is 4
-
-
-
-
- 1
-
-
-
#[arg(short, long, default_value_t = 4)]
-
-
-
-
-
-
-
-
/// Desperate mode, will try to finish the craft above all
-
-
-
-
- 1
-
-
-
#[arg(short = 'D', long, default_value_t = false)]
-
-
-
-
-
-
-
-
/// Long mode, will try to find more solutions, at the expense of time
-
-
-
-
- 1
-
-
-
#[arg(short = 'l', long, default_value_t = false)]
-
-
-
-
-
-
-
-
/// A final stripped down version of a craft
-
-
-
-
-
-
-
-
/// used for final print and talking with python
-
-
-
-
-
-
-
-
pub struct SolverResult {
-
-
-
-
-
-
-
-
pub progression: u32,
-
-
-
-
-
-
-
-
pub total_progression: u32,
-
-
-
-
-
-
-
-
pub total_quality: u32,
-
-
-
-
-
-
-
-
pub total_durability: u32,
-
-
-
-
-
-
-
-
pub actions: Vec<String>,
-
-
-
-
-
-
-
-
pub step1_solutions: usize,
-
-
-
-
-
-
-
-
pub step2_solutions: usize,
-
-
-
-
-
-
-
-
pub found_100_percent: bool,
-
-
-
-
-
-
-
-
/// Pretty display for SolverResult
-
-
-
-
-
-
-
-
impl Display for SolverResult {
-
-
-
-
- 2
-
-
-
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> {
-
-
-
-
- 2
-
-
-
write!(f, "{:?}", self.actions)
-
-
-
-
-
-
-
-
step1_solutions: usize,
-
-
-
-
-
-
-
-
step2_solutions: usize,
-
-
-
-
-
-
-
-
found_100_percent: bool,
-
-
-
-
-
-
-
-
let mut actions = craft
-
-
-
-
-
-
-
-
.map(|action| format!("{}", action.short_name))
-
-
-
-
-
-
-
-
.collect::<Vec<String>>();
-
-
-
-
-
-
-
-
let arg = (craft.recipe.progress as f32 - craft.progression as f32)
-
-
-
-
-
-
-
-
/ craft.get_base_progression() as f32;
-
-
-
-
-
-
-
-
if 0.0 < arg && arg < 1.2 {
-
-
-
-
-
-
-
-
actions.push("basicSynth2".to_string());
-
-
-
-
-
-
-
-
if 1.2 <= arg && arg < 1.8 {
-
-
-
-
-
-
-
-
actions.push("carefulSynthesis".to_string());
-
-
-
-
-
-
-
-
if 1.8 <= arg && arg < 2.0 {
-
-
-
-
-
-
-
-
actions.push("observe".to_string());
-
-
-
-
-
-
-
-
actions.push("focusedSynthesis".to_string());
-
-
-
-
-
-
-
-
steps: craft.step_count,
-
-
-
-
-
-
-
-
progression: craft.progression,
-
-
-
-
-
-
-
-
quality: craft.quality,
-
-
-
-
-
-
-
-
durability: craft.durability,
-
-
-
-
-
-
-
-
total_progression: craft.recipe.progress,
-
-
-
-
-
-
-
-
total_quality: craft.recipe.quality,
-
-
-
-
-
-
-
-
total_durability: craft.recipe.durability,
-
-
-
-
-
-
-
-
total_cp: craft.stats.max_cp,
-
-
-
-
- 2
-
-
-
pub fn default() -> Self {
-
-
-
-
- 2
-
-
-
total_progression: 0,
-
-
-
-
- 2
-
-
-
actions: vec!["Act1".to_string(), "Act2".to_string()],
-
-
-
-
- 2
-
-
-
found_100_percent: false,
-
-
-
-
- 1
-
-
-
pub fn pretty_print(&self) {
-
-
-
-
- 1
-
-
-
"Quality: [{}/{}] | Durability: [{}/{}] | Cp : [{}/{}] | Steps : {}",
-
-
-
-
- 1
-
-
-
self.total_durability,
-
-
-
-
- 1
-
-
-
println!("{:?}", self.actions);
-
-
-
-
-
-
-
-
pub fn from_args(args: &Args) -> Self {
-
-
-
-
-
-
-
-
depth: if args.desperate { 11 } else { 8 },
-
-
-
-
-
-
-
-
threads: args.threads,
-
-
-
-
-
-
-
-
verbose: args.verbose,
-
-
-
-
-
-
-
-
desperate: args.desperate,
-
-
-
-
-
-
-
-
byregot_step: if args.long { 6 } else { 8 },
-
-
-
-
-
-
-
-
////// Python Bindings //////
-
-
-
-
-
-
-
-
/// A Python module implemented in Rust.
-
-
-
-
-
-
-
-
#[cfg(not(feature = "no_python"))]
-
-
-
-
-
-
-
-
fn xiv_csolver_lib(_py: Python, m: &PyModule) -> PyResult<()> {
-
-
-
-
-
-
-
-
m.add_function(wrap_pyfunction!(test_result, m)?)?;
-
-
-
-
-
-
-
-
m.add_function(wrap_pyfunction!(solve_from_python, m)?)?;
-
-
-
-
-
-
-
-
#[cfg(not(feature = "no_python"))]
-
-
-
-
-
-
-
-
pub fn test_result() -> SolverResult {
-
-
-
-
-
-
-
-
SolverResult::default()
-
-
-
-
-
-
-
-
/// Create a stat struct stats with the base values
-
-
-
-
-
-
-
-
#[cfg(not(feature = "no_python"))]
-
-
-
-
-
-
-
-
use crate::{solve_craft, Recipe, Stats};
-
-
-
-
-
-
-
-
#[cfg(not(feature = "no_python"))]
-
-
-
-
-
-
-
-
pub fn solve_from_python(values: &PyAny) -> PyResult<Option<Vec<SolverResult>>> {
-
-
-
-
-
-
-
-
let recipe = Recipe {
-
-
-
-
-
-
-
-
durability: values.getattr("durability")?.extract()?,
-
-
-
-
-
-
-
-
progress: values.getattr("progress")?.extract()?,
-
-
-
-
-
-
-
-
progress_divider: values.getattr("progress_divider")?.extract()?,
-
-
-
-
-
-
-
-
progress_modifier: values.getattr("progress_modifier")?.extract()?,
-
-
-
-
-
-
-
-
quality: values.getattr("quality")?.extract()?,
-
-
-
-
-
-
-
-
quality_divider: values.getattr("quality_divider")?.extract()?,
-
-
-
-
-
-
-
-
quality_modifier: values.getattr("quality_modifier")?.extract()?,
-
-
-
-
-
-
-
-
craftsmanship: values.getattr("craftsmanship")?.extract()?,
-
-
-
-
-
-
-
-
control: values.getattr("control")?.extract()?,
-
-
-
-
-
-
-
-
max_cp: values.getattr("max_cp")?.extract()?,
-
-
-
-
-
-
-
-
let param = Parameters {
-
-
-
-
-
-
-
-
depth: values.getattr("depth")?.extract()?,
-
-
-
-
-
-
-
-
byregot_step: values.getattr("byregot_step")?.extract()?,
-
-
-
-
-
-
-
-
desperate: values.getattr("desperate")?.extract()?,
-
-
-
-
-
-
-
-
threads: values.getattr("threads")?.extract()?,
-
-
-
-
-
-
-
-
verbose: values.getattr("verbose")?.extract()?,
-
-
-
-
-
-
-
-
// println!("{:?} len: {:?} ",values,values.getattr("len()"));
-
-
-
-
-
-
-
-
let res = solve_craft(recipe, stats, param);
-
-
-
-
-
-
-
-
use crate::{Parameters, SolverResult};
-
-
-
-
-
-
-
-
use pretty_assertions::{assert_eq, assert_ne};
-
-
-
-
-
-
-
-
impl PartialEq for Parameters {
-
-
-
-
- 1
-
-
-
fn eq(&self, rhs: &Parameters) -> bool {
-
-
-
-
- 1
-
-
-
(self.byregot_step == rhs.byregot_step)
-
-
-
-
- 1
-
-
-
& (self.depth == rhs.depth)
-
-
-
-
- 1
-
-
-
& (self.desperate == rhs.desperate)
-
-
-
-
- 1
-
-
-
& (self.threads == rhs.threads)
-
-
-
-
- 1
-
-
-
pub fn test_parameters_derived_attributes() {
-
-
-
-
- 1
-
-
-
let def = Parameters {
-
-
-
-
- 1
-
-
-
let def3 = def2.clone();
-
-
-
-
- 1
-
-
-
assert_eq!(def2, def3);
-
-
-
-
- 1
-
-
-
pub fn test_display() {
-
-
-
-
- 1
-
-
-
let def = SolverResult::default();
-
-
-
-
- 1
-
-
-
assert_ne!(def.to_string(), "");
-
-
-
-
- 1
-
-
-
assert_eq!(def.to_string(), "[\"Act1\", \"Act2\"]");
-
-
-
-
- 1
-
-
-
pub fn test_debug() {
-
-
-
-
- 1
-
-
-
let def = SolverResult::default();
-
-
-
-
- 1
-
-
-
assert_eq!(format!("{:?}", def),"SolverResult { steps: 0, quality: 0, progression: 0, durability: 0, cp: 0, total_cp: 0, total_progression: 0, total_quality: 0, total_durability: 0, actions: [\"Act1\", \"Act2\"], step1_solutions: 0, step2_solutions: 0, found_100_percent: false }");
-
-
-
-
- 1
-
-
-
pub fn test_arguments() {
-
-
-
-
- 1
-
-
-
// Create false argument parameter
-
-
-
-
- 1
-
-
-
character_name: "Bob GZ".to_string(),
-
-
-
-
- 1
-
-
-
file_name: "test.toml".to_string(),
-
-
-
-
- 1
-
-
-
recipe_name: "Belladone".to_string(),
-
-
-
-
- 1
-
-
-
// Test Custom recipe
-
-
-
-
- 1
-
-
-
let a3 = Args::parse_from(["ultraman","-r", "recipe","-c","dan","-f","bigfile.toml","-d","45","-t","4","-D","-l","-vvv"]);
-
-
-
-
- 1
-
-
-
let _ = Args::parse_from(["-V"]);
-
-
-
-
- 1
-
-
-
let _ = Args::parse_from(["-H"]);
-
-
-
-
- 1
-
-
-
assert_eq!(a3.recipe_name,"recipe");
-
-
-
-
- 1
-
-
-
assert_eq!(a3.character_name,"dan");
-
-
-
-
- 1
-
-
-
assert_eq!(a3.file_name,"bigfile.toml");
-
-
-
-
- 1
-
-
-
assert_eq!(a3.verbose,3);
-
-
-
-
- 1
-
-
-
assert_eq!(a3.depth,45);
-
-
-
-
- 1
-
-
-
assert_eq!(a3.threads,4);
-
-
-
-
- 1
-
-
-
assert_eq!(a3.desperate,true);
-
-
-
-
- 1
-
-
-
assert_eq!(a3.long,true);
-
-
-
-
-
-
-
-
// Test default parameters
-
-
-
-
- 1
-
-
-
let a4 = Args::parse_from(["bobGZ"]);
-
-
-
-
- 1
-
-
-
assert_eq!(a4.recipe_name,"default_recipe");
-
-
-
-
- 1
-
-
-
assert_eq!(a4.character_name,"default_character");
-
-
-
-
- 1
-
-
-
assert_eq!(a4.file_name,"craft.toml");
-
-
-
-
- 1
-
-
-
assert_eq!(a4.verbose,0);
-
-
-
-
- 1
-
-
-
assert_eq!(a4.depth,8);
-
-
-
-
- 1
-
-
-
assert_eq!(a4.threads,4);
-
-
-
-
- 1
-
-
-
assert_eq!(a4.desperate,false);
-
-
-
-
- 1
-
-
-
assert_eq!(a4.long,false);
-
-
-
-
- 1
-
-
-
pub fn test_parameters() {}
-
-
-
-
-
-
diff --git a/coverage/html/src/lib.rs.html b/coverage/html/src/lib.rs.html
deleted file mode 100644
index 7d6d9fb..0000000
--- a/coverage/html/src/lib.rs.html
+++ /dev/null
@@ -1,4496 +0,0 @@
-
-
-
-
- Grcov report - lib.rs
-
-
-
-
-
-
-
-
-
- 1
-
-
-
use crate::io::SolverResult;
-
-
-
-
-
-
-
-
specs::{Recipe, Stats},
-
-
-
-
-
-
-
-
use std::sync::{Arc, Mutex};
-
-
-
-
-
-
-
-
use threadpool::ThreadPool;
-
-
-
-
-
-
-
-
/// Solve the craft with given arguments, this functions calls threads and must own it's values
-
-
-
-
-
-
-
-
pub fn solve_craft<'a>(
-
-
-
-
-
-
-
-
) -> Option<Vec<SolverResult>> {
-
-
-
-
-
-
-
-
// Load the craft with given arguments
-
-
-
-
-
-
-
-
let craft = Craft::new(recipe, stats, params);
-
-
-
-
-
-
-
-
// Start a threadpool
-
-
-
-
-
-
-
-
let pool = ThreadPool::new(params.threads);
-
-
-
-
-
-
-
-
#[cfg(feature = "verbose")]
-
-
-
-
-
-
-
-
if params.verbose > 0 {
-
-
-
-
-
-
-
-
println!("[P1] Starting phase 1...");
-
-
-
-
-
-
-
-
let phase1_routes = solver::generate_routes_phase1(craft);
-
-
-
-
-
-
-
-
let nb_p1 = phase1_routes.len();
-
-
-
-
-
-
-
-
#[cfg(feature = "verbose")]
-
-
-
-
-
-
-
-
if params.verbose > 0 {
-
-
-
-
-
-
-
-
"[P1] Found {} routes, testing them all...",
-
-
-
-
-
-
-
-
if params.verbose > 1 {
-
-
-
-
-
-
-
-
for r in &phase1_routes {
-
-
-
-
-
-
-
-
"[P1] {:?} p:{}% q:{}% c:{} d:{}",
-
-
-
-
-
-
-
-
r.quality * 100 / r.recipe.quality,
-
-
-
-
-
-
-
-
// Core algorithm, fill all found routes with the best route (doesn't branch, just replace)
-
-
-
-
-
-
-
-
let arc_phase2_routes = Arc::new(Mutex::new(Vec::<Craft>::new()));
-
-
-
-
-
-
-
-
for route in phase1_routes {
-
-
-
-
-
-
-
-
let _phase2_routes = Arc::clone(&arc_phase2_routes);
-
-
-
-
-
-
-
-
pool.execute(move || {
-
-
-
-
-
-
-
-
if let Some(mut _route) = solver::generate_routes_phase2(route) {
-
-
-
-
-
-
-
-
let mut shared = _phase2_routes.lock().unwrap();
-
-
-
-
-
-
-
-
shared.append(&mut _route);
-
-
-
-
-
-
-
-
let phase2_routes = arc_phase2_routes.lock().unwrap();
-
-
-
-
-
-
-
-
let nb_p2 = phase2_routes.len();
-
-
-
-
-
-
-
-
// Drop on empty results
-
-
-
-
-
-
-
-
if phase2_routes.len() == 0 {
-
-
-
-
-
-
-
-
// Print the results if verbose
-
-
-
-
-
-
-
-
#[cfg(feature = "verbose")]
-
-
-
-
-
-
-
-
if params.verbose > 0 {
-
-
-
-
-
-
-
-
println!("[P2] Found {} solutions, sorting", phase2_routes.len());
-
-
-
-
-
-
-
-
if params.verbose > 1 {
-
-
-
-
-
-
-
-
for r in phase2_routes.iter() {
-
-
-
-
-
-
-
-
"[P2] {:?} p:{}% q:{}% d:{}",
-
-
-
-
-
-
-
-
r.progression * 100 / r.recipe.progress,
-
-
-
-
-
-
-
-
r.quality * 100 / r.recipe.quality,
-
-
-
-
-
-
-
-
// Prune the results for analysis
-
-
-
-
-
-
-
-
// let mut valid_routes : Vec<Craft> = vec![];
-
-
-
-
-
-
-
-
let mut valid_solutions: Vec<SolverResult> = vec![];
-
-
-
-
-
-
-
-
for route in phase2_routes.iter() {
-
-
-
-
-
-
-
-
if route.quality >= route.recipe.quality {
-
-
-
-
-
-
-
-
// valid_routes.push(route.clone());
-
-
-
-
-
-
-
-
valid_solutions.push(SolverResult::from_craft(route, nb_p1, nb_p2, true));
-
-
-
-
-
-
-
-
// If no craft can make it to 100% HQ, fallback to base results
-
-
-
-
-
-
-
-
if valid_solutions.len() == 0 {
-
-
-
-
-
-
-
-
for route in phase2_routes.iter() {
-
-
-
-
-
-
-
-
valid_solutions.push(SolverResult::from_craft(route, nb_p1, nb_p2, false));
-
-
-
-
-
-
-
-
Some(valid_solutions)
-
-
-
-
-
-
-
-
/// Load the config from args and make a craft from it
-
-
-
-
-
-
-
-
pub fn load_from_config<'a>(
-
-
-
-
-
-
-
-
character_name: &str,
-
-
-
-
-
-
-
-
) -> (Recipe, Stats) {
-
-
-
-
-
-
-
-
let config: toml::Value = toml::from_str(
-
-
-
-
-
-
-
-
&std::fs::read_to_string(file_name).expect(&format!("Can't open {}", file_name)),
-
-
-
-
-
-
-
-
let recp = match config.get(recipe_name) {
-
-
-
-
-
-
-
-
None => panic!("Can't find value '{}' in '{}'", recipe_name, file_name),
-
-
-
-
-
-
-
-
// Load receipe values
-
-
-
-
-
-
-
-
let recipe = Recipe {
-
-
-
-
-
-
-
-
"Can't find 'durability' in recipe '{}' on file '{}'",
-
-
-
-
-
-
-
-
recipe_name, file_name
-
-
-
-
-
-
-
-
.expect("Can't convert durability as an integer") as u32,
-
-
-
-
-
-
-
-
"Can't find 'progress' in recipe '{}' on '{}'",
-
-
-
-
-
-
-
-
recipe_name, file_name
-
-
-
-
-
-
-
-
.expect("Can't convert progress as an integer") as u32,
-
-
-
-
-
-
-
-
"Can't find 'quality' in recipe '{}' on '{}'",
-
-
-
-
-
-
-
-
recipe_name, file_name
-
-
-
-
-
-
-
-
.expect("Can't convert quality as an integer") as u32,
-
-
-
-
-
-
-
-
progress_divider: recp
-
-
-
-
-
-
-
-
.get("progress_divider")
-
-
-
-
-
-
-
-
"Can't find 'progress_divider' in recipe '{}' on '{}'",
-
-
-
-
-
-
-
-
recipe_name, file_name
-
-
-
-
-
-
-
-
.expect("Can't convert progress_divider as an integer")
-
-
-
-
-
-
-
-
quality_divider: recp
-
-
-
-
-
-
-
-
.get("quality_divider")
-
-
-
-
-
-
-
-
"Can't find 'quality_divider' in recipe '{}' on '{}'",
-
-
-
-
-
-
-
-
recipe_name, file_name
-
-
-
-
-
-
-
-
.expect("Can't convert quality_divider as an integer") as u32,
-
-
-
-
-
-
-
-
progress_modifier: recp
-
-
-
-
-
-
-
-
.get("progress_modifier")
-
-
-
-
-
-
-
-
"Can't find 'progress_modifier' in recipe '{}' on '{}'",
-
-
-
-
-
-
-
-
recipe_name, file_name
-
-
-
-
-
-
-
-
.expect("Can't convert progress_modifier as an integer")
-
-
-
-
-
-
-
-
quality_modifier: recp
-
-
-
-
-
-
-
-
.get("quality_modifier")
-
-
-
-
-
-
-
-
"Can't find 'quality_modifier' in recipe '{}' on '{}'",
-
-
-
-
-
-
-
-
recipe_name, file_name
-
-
-
-
-
-
-
-
.expect("Can't convert quality_modifier as an integer")
-
-
-
-
-
-
-
-
let cfg = match config.get(character_name) {
-
-
-
-
-
-
-
-
None => panic!("Can't find '{}' in file '{}'", character_name, file_name),
-
-
-
-
-
-
-
-
.get("craftsmanship")
-
-
-
-
-
-
-
-
"Can't find 'craftsmanship' in character '{}' on file '{}'",
-
-
-
-
-
-
-
-
character_name, file_name
-
-
-
-
-
-
-
-
.expect("Can't convert craftsmanship as an integer") as u32,
-
-
-
-
-
-
-
-
"Can't find 'control' in character '{}' on file '{}'",
-
-
-
-
-
-
-
-
character_name, file_name
-
-
-
-
-
-
-
-
.expect("Can't convert control as an integer") as u32,
-
-
-
-
-
-
-
-
"Can't find 'max_cp' in character '{}' on file '{}'",
-
-
-
-
-
-
-
-
character_name, file_name
-
-
-
-
-
-
-
-
.expect("Can't convert max_cp as an integer") as u32,
-
-
-
-
-
-
-
-
/// Print all routes in the vect, verbose
-
-
-
-
-
-
-
-
pub fn print_routes<'a>(routes: &Option<Vec<SolverResult>>) {
-
-
-
-
-
-
-
-
println!("Showing {} routes", r.len());
-
-
-
-
-
-
-
-
"\n[{}¤][{}@][{}#] {:?} ",
-
-
-
-
-
-
-
-
c.quality, c.durability, c.steps, c.actions
-
-
-
-
-
-
-
-
None => println!("No routes to print"),
-
-
-
-
-
-
-
-
/// Find the route with the least amount of steps
-
-
-
-
-
-
-
-
pub fn find_fast_route(routes: &Option<Vec<SolverResult>>) -> Option<&SolverResult> {
-
-
-
-
-
-
-
-
if _routes.len() > 0 {
-
-
-
-
-
-
-
-
_routes.iter().min_by_key(|key| key.steps)
-
-
-
-
-
-
-
-
/// Find the route with the maximum amount of quality
-
-
-
-
-
-
-
-
pub fn find_quality_route(routes: &Option<Vec<SolverResult>>) -> Option<&SolverResult> {
-
-
-
-
-
-
-
-
Some(_routes) => _routes.iter().max_by_key(|key| key.quality),
-
-
-
-
-
-
-
-
/// Find the route with the maximum of durability left
-
-
-
-
-
-
-
-
pub fn find_safe_route(routes: &Option<Vec<SolverResult>>) -> Option<&SolverResult> {
-
-
-
-
-
-
-
-
if _routes.len() > 0 {
-
-
-
-
-
-
-
-
_routes.iter().max_by_key(|key| key.durability)
-
-
-
-
-
-
diff --git a/coverage/html/src/solver.rs.html b/coverage/html/src/solver.rs.html
deleted file mode 100644
index 8acb7c9..0000000
--- a/coverage/html/src/solver.rs.html
+++ /dev/null
@@ -1,3952 +0,0 @@
-
-
-
-
- Grcov report - solver.rs
-
-
-
-
-
-
-
-
-
-
-
-
-
use crate::action::{Action, ACTIONS};
-
-
-
-
-
-
-
-
use crate::craft::Craft;
-
-
-
-
-
-
-
-
use crate::specs::Success;
-
-
-
-
-
-
-
-
use std::collections::VecDeque;
-
-
-
-
-
-
-
-
macro_rules! action_vec {
-
-
-
-
-
-
-
-
($($tt:expr),*) => { vec![ $(Some(&$tt),)*]};
-
-
-
-
-
-
-
-
/// Find the next authorised action for this step of the craft
-
-
-
-
-
-
-
-
pub fn next_action_picker_1<'a>(craft: &Craft<'a>) -> Vec<Option<&'a Action>> {
-
-
-
-
-
-
-
-
if craft.success != Success::Pending {
-
-
-
-
-
-
-
-
let mut available_actions = Vec::<Option<&'a Action>>::new();
-
-
-
-
-
-
-
-
let mut forbidden_actions = Vec::<Option<&'a Action>>::new();
-
-
-
-
-
-
-
-
// Optimize the first three steps for massive time save
-
-
-
-
-
-
-
-
if craft.step_count == 0 {
-
-
-
-
-
-
-
-
return action_vec![ACTIONS.muscle_memory];
-
-
-
-
-
-
-
-
if craft.step_count == 1 {
-
-
-
-
-
-
-
-
return action_vec![ACTIONS.manipulation];
-
-
-
-
-
-
-
-
// Prune some actions if not requested by --long
-
-
-
-
-
-
-
-
if craft.step_count == 2 {
-
-
-
-
-
-
-
-
return action_vec![/*ACTIONS.waste_not, ACTIONS.waste_not_ii, */ ACTIONS.veneration];
-
-
-
-
-
-
-
-
if craft.step_count == 3 {
-
-
-
-
-
-
-
-
available_actions.append(&mut action_vec![
-
-
-
-
-
-
-
-
ACTIONS.waste_not_ii /*,ACTIONS.waste_not*/
-
-
-
-
-
-
-
-
// Groundwork mostly for wn / mm
-
-
-
-
-
-
-
-
if craft.buffs.waste_not > 0 || craft.buffs.muscle_memory > 0 {
-
-
-
-
-
-
-
-
available_actions.append(&mut action_vec![ACTIONS.groundwork])
-
-
-
-
-
-
-
-
// Forbidding actions depending on buffs
-
-
-
-
-
-
-
-
if craft.buffs.muscle_memory > 0 {
-
-
-
-
-
-
-
-
forbidden_actions.append(&mut action_vec![
-
-
-
-
-
-
-
-
ACTIONS.basic_synthesis,
-
-
-
-
-
-
-
-
ACTIONS.careful_synthesis,
-
-
-
-
-
-
-
-
ACTIONS.prudent_synthesis,
-
-
-
-
-
-
-
-
ACTIONS.delicate_synthesis
-
-
-
-
-
-
-
-
if craft.buffs.waste_not > 0 {
-
-
-
-
-
-
-
-
forbidden_actions.append(&mut action_vec![ACTIONS.prudent_synthesis])
-
-
-
-
-
-
-
-
available_actions.append(&mut action_vec![
-
-
-
-
-
-
-
-
ACTIONS.basic_synthesis,
-
-
-
-
-
-
-
-
ACTIONS.careful_synthesis,
-
-
-
-
-
-
-
-
ACTIONS.prudent_synthesis,
-
-
-
-
-
-
-
-
ACTIONS.delicate_synthesis
-
-
-
-
-
-
-
-
// ACTIONS.groundwork for the --pls
-
-
-
-
-
-
-
-
if craft.args.desperate {
-
-
-
-
-
-
-
-
available_actions.append(&mut action_vec![ACTIONS.groundwork]);
-
-
-
-
-
-
-
-
// For long first run
-
-
-
-
-
-
-
-
if craft.step_count > 8 {
-
-
-
-
-
-
-
-
available_actions.append(&mut action_vec![ACTIONS.waste_not_ii, ACTIONS.waste_not])
-
-
-
-
-
-
-
-
// Pruning the actions with the forbidden ones
-
-
-
-
-
-
-
-
let mut result_actions = Vec::<Option<&'a Action>>::new();
-
-
-
-
-
-
-
-
for action in available_actions {
-
-
-
-
-
-
-
-
if !forbidden_actions.contains(&action)
-
-
-
-
-
-
-
-
&& action.unwrap().can_use(&craft)
-
-
-
-
-
-
-
-
.any(|x| x.unwrap() == action.unwrap())
-
-
-
-
-
-
-
-
result_actions.push(action);
-
-
-
-
-
-
-
-
/// Find all routes that can finish in one more action
-
-
-
-
-
-
-
-
pub fn generate_routes_phase1<'a>(craft: Craft<'a>) -> Vec<Craft<'a>> {
-
-
-
-
-
-
-
-
let mut queue = Vec::new();
-
-
-
-
-
-
-
-
let mut routes = Vec::new();
-
-
-
-
-
-
-
-
while !queue.is_empty() {
-
-
-
-
-
-
-
-
let craft = queue.pop().unwrap();
-
-
-
-
-
-
-
-
for action in next_action_picker_1(&craft) {
-
-
-
-
-
-
-
-
let mut craft = craft.clone();
-
-
-
-
-
-
-
-
Some(a) => craft.run_action(a),
-
-
-
-
-
-
-
-
let remaining_prog = (craft.recipe.progress as f32 - craft.progression as f32)
-
-
-
-
-
-
-
-
/ craft.get_base_progression() as f32;
-
-
-
-
-
-
-
-
if remaining_prog <= 2.0 {
-
-
-
-
-
-
-
-
if remaining_prog <= 0.0 {
-
-
-
-
-
-
-
-
} else if 0.0 < remaining_prog && remaining_prog <= 1.2 {
-
-
-
-
-
-
-
-
// pass // Will finish with basicSynth2 (free)
-
-
-
-
-
-
-
-
} else if 1.2 < remaining_prog && remaining_prog <= 1.2 {
-
-
-
-
-
-
-
-
craft.cp -= 7; // Will finish with carefulSynthesis (7cp)
-
-
-
-
-
-
-
-
} else if 1.2 < remaining_prog && remaining_prog <= 2.0 {
-
-
-
-
-
-
-
-
craft.cp -= 12; // Will finish with observe+focusedSynthesis (12cp)
-
-
-
-
-
-
-
-
craft.durability -= 10; // Save the final step, since we always aim to end with -5dur, it doesn't matter
-
-
-
-
-
-
-
-
// Keep adding initial routes with several pass, we must be able to finish in one step
-
-
-
-
-
-
-
-
// 8 Seemed to be a good initial guess with enouth to use a good amount of WN / WNII to get close
-
-
-
-
-
-
-
-
// A higher value will yield more initial guesses with minimal benefits
-
-
-
-
-
-
-
-
// A lover value will yield less initial guesses and might spent too much CP to get to the required progression
-
-
-
-
-
-
-
-
if craft.step_count < craft.args.depth {
-
-
-
-
-
-
-
-
/// Find the list of authorised actions for this step
-
-
-
-
-
-
-
-
pub fn next_action_phase_2<'a>(craft: &Craft<'a>) -> Vec<Option<&'a Action>> {
-
-
-
-
-
-
-
-
let mut available_actions = vec![
-
-
-
-
-
-
-
-
&ACTIONS.basic_touch,
-
-
-
-
-
-
-
-
&ACTIONS.prudent_touch,
-
-
-
-
-
-
-
-
&ACTIONS.preparatory_touch,
-
-
-
-
-
-
-
-
let mut forbidden_actions = Vec::new();
-
-
-
-
-
-
-
-
if craft.success != Success::Pending {
-
-
-
-
-
-
-
-
if craft.buffs.innovation > 0 {
-
-
-
-
-
-
-
-
forbidden_actions.push(&ACTIONS.innovation);
-
-
-
-
-
-
-
-
if craft.buffs.inner_quiet >= 2 {
-
-
-
-
-
-
-
-
forbidden_actions.append(&mut vec![
-
-
-
-
-
-
-
-
&ACTIONS.basic_touch,
-
-
-
-
-
-
-
-
&ACTIONS.standard_touch,
-
-
-
-
-
-
-
-
&ACTIONS.advanced_touch,
-
-
-
-
-
-
-
-
&ACTIONS.trained_finesse,
-
-
-
-
-
-
-
-
&ACTIONS.prudent_touch,
-
-
-
-
-
-
-
-
&ACTIONS.preparatory_touch,
-
-
-
-
-
-
-
-
&ACTIONS.byregot_blessing,
-
-
-
-
-
-
-
-
available_actions.push(&ACTIONS.innovation);
-
-
-
-
-
-
-
-
if craft.buffs.manipulation == 0
-
-
-
-
-
-
-
-
&& craft.buffs.basic_touch == 0
-
-
-
-
-
-
-
-
&& craft.buffs.standard_touch == 0
-
-
-
-
-
-
-
-
&& craft.buffs.inner_quiet < 8
-
-
-
-
-
-
-
-
available_actions.push(&ACTIONS.manipulation);
-
-
-
-
-
-
-
-
if craft.buffs.waste_not > 0 {
-
-
-
-
-
-
-
-
available_actions.push(&ACTIONS.preparatory_touch);
-
-
-
-
-
-
-
-
forbidden_actions.push(&ACTIONS.prudent_touch);
-
-
-
-
-
-
-
-
available_actions.push(&ACTIONS.prudent_touch);
-
-
-
-
-
-
-
-
forbidden_actions.push(&ACTIONS.preparatory_touch);
-
-
-
-
-
-
-
-
if craft.buffs.basic_touch > 0 {
-
-
-
-
-
-
-
-
available_actions.push(&ACTIONS.standard_touch);
-
-
-
-
-
-
-
-
forbidden_actions.push(&ACTIONS.basic_touch);
-
-
-
-
-
-
-
-
if craft.buffs.standard_touch > 0 {
-
-
-
-
-
-
-
-
available_actions.push(&ACTIONS.advanced_touch);
-
-
-
-
-
-
-
-
forbidden_actions.push(&ACTIONS.basic_touch);
-
-
-
-
-
-
-
-
if craft.buffs.inner_quiet >= craft.args.byregot_step {
-
-
-
-
-
-
-
-
available_actions.push(&ACTIONS.trained_finesse);
-
-
-
-
-
-
-
-
available_actions.push(&ACTIONS.great_strides);
-
-
-
-
-
-
-
-
if craft.buffs.great_strides > 0 {
-
-
-
-
-
-
-
-
forbidden_actions.push(&ACTIONS.trained_finesse);
-
-
-
-
-
-
-
-
forbidden_actions.push(&ACTIONS.great_strides);
-
-
-
-
-
-
-
-
if craft.buffs.innovation > 0 {
-
-
-
-
-
-
-
-
available_actions.push(&ACTIONS.byregot_blessing);
-
-
-
-
-
-
-
-
let mut final_actions: Vec<Option<&Action>> = Vec::new();
-
-
-
-
-
-
-
-
for action in available_actions {
-
-
-
-
-
-
-
-
if !forbidden_actions.contains(&action)
-
-
-
-
-
-
-
-
&& !final_actions.iter().any(|a| a.unwrap() == action)
-
-
-
-
-
-
-
-
final_actions.push(Some(action));
-
-
-
-
-
-
-
-
/// Apply all actions to the current route
-
-
-
-
-
-
-
-
pub fn generate_routes_phase2<'a>(craft: Craft<'a>) -> Option<Vec<Craft<'a>>> {
-
-
-
-
-
-
-
-
let mut queue = VecDeque::new();
-
-
-
-
-
-
-
-
let mut top_route: Craft<'a> = craft.clone(); // Default route, no hq on that one
-
-
-
-
-
-
-
-
let mut top_routes: Vec<Craft<'a>> = vec![];
-
-
-
-
-
-
-
-
queue.push_back(craft);
-
-
-
-
-
-
-
-
while !queue.is_empty() {
-
-
-
-
-
-
-
-
let _craft = queue.pop_front().unwrap();
-
-
-
-
-
-
-
-
for action in next_action_phase_2(&_craft) {
-
-
-
-
-
-
-
-
if _craft.success != Success::Pending
-
-
-
-
-
-
-
-
|| !action.unwrap().can_use(&_craft)
-
-
-
-
-
-
-
-
let mut craft = _craft.clone();
-
-
-
-
-
-
-
-
craft.run_action(action.unwrap());
-
-
-
-
-
-
-
-
if action.unwrap() == &ACTIONS.byregot_blessing {
-
-
-
-
-
-
-
-
#[cfg(not(feature = "fast"))]
-
-
-
-
-
-
-
-
if top_route.quality >= craft.recipe.quality {
-
-
-
-
-
-
-
-
top_routes.push(craft.clone()); // Me memory
-
-
-
-
-
-
-
-
if top_route.quality < craft.quality {
-
-
-
-
-
-
-
-
#[cfg(feature = "fast")]
-
-
-
-
-
-
-
-
top_routes.push(craft.clone());
-
-
-
-
-
-
-
-
queue.push_back(craft);
-
-
-
-
-
-
-
-
// Let's not forget the best result
-
-
-
-
-
-
-
-
top_routes.push(top_route);
-
-
-
-
-
-
diff --git a/coverage/html/src/specs.rs.html b/coverage/html/src/specs.rs.html
deleted file mode 100644
index d2ea3c1..0000000
--- a/coverage/html/src/specs.rs.html
+++ /dev/null
@@ -1,2224 +0,0 @@
-
-
-
-
- Grcov report - specs.rs
-
-
-
-
-
-
-
-
-
-
-
-
-
use strum_macros::EnumIter;
-
-
-
-
-
-
-
-
#[derive(Debug, Clone, Copy)]
-
-
-
-
-
-
-
-
pub progress_divider: u32,
-
-
-
-
-
-
-
-
pub quality_divider: u32,
-
-
-
-
-
-
-
-
pub progress_modifier: u32,
-
-
-
-
-
-
-
-
pub quality_modifier: u32,
-
-
-
-
-
-
-
-
#[derive(Debug, Clone, Copy)]
-
-
-
-
-
-
-
-
pub craftsmanship: u32,
-
-
-
-
-
-
-
-
#[derive(Debug, Clone, Copy, PartialEq, EnumIter)]
-
-
-
-
-
-
-
-
#[derive(Debug, Clone, Copy)]
-
-
-
-
-
-
-
-
pub struct BuffState {
-
-
-
-
-
-
-
-
pub great_strides: u8,
-
-
-
-
-
-
-
-
pub manipulation: u8,
-
-
-
-
-
-
-
-
pub muscle_memory: u8,
-
-
-
-
-
-
-
-
pub standard_touch: u8,
-
-
-
-
-
-
-
-
pub fn default() -> Self {
-
-
-
-
-
-
-
-
pub fn remove(&mut self, buff: Buff) {
-
-
-
-
-
-
-
-
Buff::InnerQuiet => self.inner_quiet = 0,
-
-
-
-
-
-
-
-
Buff::WasteNot => self.waste_not = 0,
-
-
-
-
-
-
-
-
Buff::GreatStrides => self.great_strides = 0,
-
-
-
-
-
-
-
-
Buff::Innovation => self.innovation = 0,
-
-
-
-
-
-
-
-
Buff::Veneration => self.veneration = 0,
-
-
-
-
-
-
-
-
Buff::Manipulation => self.manipulation = 0,
-
-
-
-
-
-
-
-
Buff::MuscleMemory => self.muscle_memory = 0,
-
-
-
-
-
-
-
-
Buff::BasicTouch => self.basic_touch = 0,
-
-
-
-
-
-
-
-
Buff::StandardTouch => self.standard_touch = 0,
-
-
-
-
-
-
-
-
Buff::Observe => self.observe = 0,
-
-
-
-
-
-
-
-
pub fn apply(&mut self, buff: Buff, value: u8) {
-
-
-
-
-
-
-
-
Buff::InnerQuiet => {
-
-
-
-
-
-
-
-
self.inner_quiet = 0;
-
-
-
-
-
-
-
-
self.inner_quiet += value;
-
-
-
-
-
-
-
-
Buff::WasteNot => self.waste_not = value,
-
-
-
-
-
-
-
-
Buff::GreatStrides => self.great_strides = value,
-
-
-
-
-
-
-
-
Buff::Innovation => self.innovation = value,
-
-
-
-
-
-
-
-
Buff::Veneration => self.veneration = value,
-
-
-
-
-
-
-
-
Buff::Manipulation => self.manipulation = value,
-
-
-
-
-
-
-
-
Buff::MuscleMemory => self.muscle_memory = value,
-
-
-
-
-
-
-
-
Buff::BasicTouch => self.basic_touch = value,
-
-
-
-
-
-
-
-
Buff::StandardTouch => self.standard_touch = value,
-
-
-
-
-
-
-
-
Buff::Observe => self.standard_touch = value,
-
-
-
-
-
-
-
-
pub fn tick(&mut self) {
-
-
-
-
-
-
-
-
if self.waste_not > 0 {
-
-
-
-
-
-
-
-
if self.great_strides > 0 {
-
-
-
-
-
-
-
-
self.great_strides -= 1;
-
-
-
-
-
-
-
-
if self.innovation > 0 {
-
-
-
-
-
-
-
-
self.innovation -= 1;
-
-
-
-
-
-
-
-
if self.veneration > 0 {
-
-
-
-
-
-
-
-
self.veneration -= 1;
-
-
-
-
-
-
-
-
if self.manipulation > 0 {
-
-
-
-
-
-
-
-
self.manipulation -= 1;
-
-
-
-
-
-
-
-
if self.muscle_memory > 0 {
-
-
-
-
-
-
-
-
self.muscle_memory -= 1;
-
-
-
-
-
-
-
-
if self.basic_touch > 0 {
-
-
-
-
-
-
-
-
self.basic_touch -= 1;
-
-
-
-
-
-
-
-
if self.standard_touch > 0 {
-
-
-
-
-
-
-
-
self.standard_touch -= 1;
-
-
-
-
-
-
-
-
#[derive(Debug, Clone, Copy, PartialEq)]
-
-
-
-
-
-
diff --git a/coverage/html/tests/index.html b/coverage/html/tests/index.html
deleted file mode 100644
index 74338e6..0000000
--- a/coverage/html/tests/index.html
+++ /dev/null
@@ -1,105 +0,0 @@
-
-
-
-
- Grcov report - tests
-
-
-
-
-
-
-
-
-
- | File |
- Line Coverage |
- Functions |
- Branches |
-
-
-
- | io.rs |
-
-
-
- |
-
- 100%
- |
-
- 1 / 1
- |
-
- 100% |
- 1 / 1 |
-
- 100% |
- 0 / 0 |
-
-
- | lib.rs |
-
-
-
- |
-
- 100%
- |
-
- 1 / 1
- |
-
- 100% |
- 1 / 1 |
-
- 100% |
- 0 / 0 |
-
-
-
-
-
-
diff --git a/coverage/html/tests/io.rs.html b/coverage/html/tests/io.rs.html
deleted file mode 100644
index c7289fb..0000000
--- a/coverage/html/tests/io.rs.html
+++ /dev/null
@@ -1,64 +0,0 @@
-
-
-
-
- Grcov report - io.rs
-
-
-
-
-
-
-
-
-
-
-
diff --git a/coverage/html/tests/lib.rs.html b/coverage/html/tests/lib.rs.html
deleted file mode 100644
index cf779cc..0000000
--- a/coverage/html/tests/lib.rs.html
+++ /dev/null
@@ -1,64 +0,0 @@
-
-
-
-
- Grcov report - lib.rs
-
-
-
-
-
-
-
-
-
-
-
diff --git a/src/craft.rs b/src/craft.rs
index b60e49f..c1c0446 100644
--- a/src/craft.rs
+++ b/src/craft.rs
@@ -183,3 +183,15 @@ impl<'a> Display for Craft<'a> {
.finish()
}
}
+
+
+#[cfg(test)]
+mod test{
+ // Struct Test
+ #[test]
+ pub fn struct_tests(){
+
+ }
+
+
+}
\ No newline at end of file
diff --git a/src/io.rs b/src/io.rs
index 6c06e85..4c6e038 100644
--- a/src/io.rs
+++ b/src/io.rs
@@ -275,7 +275,7 @@ use crate::{solve_craft, Recipe, Stats};
/// ```
#[cfg(not(feature = "no_python"))]
#[pyfunction]
-pub fn solve_from_python(values: &PyAny) -> PyResult