81 lines
2.2 KiB
Rust
81 lines
2.2 KiB
Rust
// Workspace: weaponry
|
|
// File: weaponry/src/strategy.rs
|
|
//! All different algorythms and strategies to create a weapon
|
|
//!
|
|
//! These strategies can lock a parameter to allow a more fine tuned balancing
|
|
//! or balancing specifically one parameter (balancing materials, balencing finishes etc..)
|
|
//! These strategies must take into account the level of the fighter (hence his precision) and of the craftsman (hence a difficulty diminution)
|
|
//!
|
|
#![allow(dead_code)]
|
|
|
|
/// Generation strategy, how to generate all the data, instead of a full permutation
|
|
pub enum EquipementStrategy {
|
|
/// Full permutation, generate all possible outcomes
|
|
GenerateAll,
|
|
/// Generate all the named equipements
|
|
GenerateNamed,
|
|
/// Do not add finishing touches
|
|
NoFinishes,
|
|
}
|
|
|
|
/// Which material to select
|
|
pub enum MaterialsStrategy {
|
|
/// Add all materials to the mix
|
|
AllMaterials,
|
|
/// Add only tier one material
|
|
OnlyTier1,
|
|
/// Add only easy materials
|
|
OnlyEasy,
|
|
/// Add only cheap materials
|
|
OnlyCheap,
|
|
/// Add only one material
|
|
OnlyOne,
|
|
}
|
|
|
|
/// Filter to apply after the generation
|
|
pub enum EquipementFilter {
|
|
/// Don't filter anything
|
|
All,
|
|
/// Filter all outliers
|
|
Outiliers,
|
|
/// Filter in all the named
|
|
Named,
|
|
}
|
|
|
|
// /// Default full generation strategy
|
|
// pub fn default_generation() -> impl ParallelIterator {
|
|
// Gen::<u8> { elem: Vec::new() }
|
|
// }
|
|
|
|
// /// Default full generation strategy
|
|
// pub fn naive_generation<T>(left: Vec<T>, right: Vec<T>) -> Vec<T>
|
|
// where
|
|
// T: Clone,
|
|
// for<'a> &'a T: std::ops::Add<&'a T>,
|
|
// {
|
|
// left.iter()
|
|
// .flat_map(move |e| right.iter().map(move |f| (e + f)).collect::<Vec<T>>())
|
|
// .collect()
|
|
// }
|
|
|
|
// /// Default full generation strategy
|
|
// ///
|
|
// /// Take a list of various parts that are combinable and combines them
|
|
// pub fn naive_generation<T>(
|
|
// list_recipes: Vec<Box<impl ReceipeCombinaison<Recipes = u8>>>,
|
|
// ) -> Vec<T> {
|
|
// list_recipes.iter().reduce(|acc, e| acc.combine_all(e));
|
|
// todo!()
|
|
// }
|
|
|
|
#[cfg(test)]
|
|
mod test {
|
|
// use super::*;
|
|
|
|
#[test]
|
|
fn test_naive_generator() {
|
|
// let t = naive_generation(vec![1, 2, 3], vec![5, 6, 7]);
|
|
// assert_eq!(t.len(), 3 * 3);
|
|
}
|
|
}
|