pub struct StrainConstants {
pub constant_variables: Vec<ConstantVariable>,
}
Expand description
Constant Variables for any specific Gamemode that the Strain Solver can use to solve.
Fields§
§constant_variables: Vec<ConstantVariable>
List of Constant Variables for the current Solver.
Implementations§
Source§impl StrainConstants
impl StrainConstants
Sourcepub fn new_constant(&mut self, name: String, value: f32) -> f32
pub fn new_constant(&mut self, name: String, value: f32) -> f32
Create a new constant variable for difficulty calculation and optimization.
Sourcepub fn get_info_from_variables(&self) -> String
pub fn get_info_from_variables(&self) -> String
Returns a string of Constant Variable info mainly used for debugging and optimization
Sourcepub fn new(constant_variables: Option<Vec<ConstantVariable>>) -> Self
pub fn new(constant_variables: Option<Vec<ConstantVariable>>) -> Self
Constructor
Examples found in repository?
examples/basic_usage.rs (line 18)
3fn main() -> Result<(), Box<dyn std::error::Error>> {
4 println!("Parsing .qua file...");
5
6 // Parse the .qua file
7 let qua = Qua::from_file("assets/171402.qua")?;
8
9 println!("Map: {} - {}", qua.metadata.title, qua.metadata.artist);
10 println!("Creator: {}", qua.metadata.creator);
11 println!("Difficulty: {}", qua.metadata.difficulty_name);
12 println!("Mode: {:?}", qua.metadata.mode);
13 println!("Hit Objects: {}", qua.hit_objects.len());
14 println!("Timing Points: {}", qua.timing_points.len());
15
16 // Calculate difficulty
17 println!("\nCalculating difficulty...");
18 let constants = StrainConstants::new(None);
19 let mut processor = DifficultyProcessor::new(qua, constants, ModIdentifier::NONE);
20 processor.calculate_difficulty(ModIdentifier::NONE);
21
22 println!("Overall Difficulty: {:.2}", processor.overall_difficulty);
23 println!("Average Note Density: {:.2}", processor.average_note_density);
24 println!("Map Length: {:.2}", processor.map.length());
25 println!("Hit Objects Count: {}", processor.map.hit_objects.len());
26 println!("Timing Points Count: {}", processor.map.timing_points.len());
27
28 Ok(())
29}
Trait Implementations§
Source§impl Clone for StrainConstants
impl Clone for StrainConstants
Source§fn clone(&self) -> StrainConstants
fn clone(&self) -> StrainConstants
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreAuto Trait Implementations§
impl Freeze for StrainConstants
impl RefUnwindSafe for StrainConstants
impl Send for StrainConstants
impl Sync for StrainConstants
impl Unpin for StrainConstants
impl UnwindSafe for StrainConstants
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more