use std::{f32::consts::PI, time::Duration};
use bevy::prelude::KeyCode;
use crate::brain::nn::Activation;
pub const THREAD_COUNT:usize = 8;
pub const RAPIER_DT: f32 = 1.0 / 60.0;
pub const RAPIER_SUBSTEPS: usize = 1;
pub const PRINT_FUNCTION_TIME:bool = false;
pub const MIN_PRINT_DURATION:Duration = Duration::from_micros(500);
pub const WORLD_WIDTH_WALK: f32 = 100000.0;
pub const WORLD_HEIGHT_WALK: f32 = 2000.0;
pub const WORLD_WIDTH_SWIM: f32 = 10000.0;
pub const WORLD_HEIGHT_SWIM: f32 = 10000.0;
pub const MOTOR_STIFFNESS: f32 = 10.0;
pub const MOTOR_DAMPING: f32 = 0.0;
pub const ENABLE_CONTACTS: bool = false;
pub const MOTOR_MAX_TARGET_V: f32 = 3.0;
pub const MAX_MOTOR_POS_ABS: f32 = PI;
pub const MAX_MOTOR_VEL_ABS: f32 = 1.0;
pub const EPSILON: f32 = 0.0001; pub const POSITION_EPSILON: f32 = 0.001; pub const PANIC_TRY_TIMES: usize = 10000;
pub const DRAG_COEFF: f32 = 1.0; pub const DEFAULT_DENSITY: f32 = 1.0;
pub const DEFAULT_DAMPING_LINEAR: f32 = 0.0;
pub const DEFAULT_DAMPING_ANGULAR: f32 = 2.0;
pub const GENO_MAX_DEPTH: u32 = 3; pub const DEFAULT_BLOCK_SIZE: [f32; 2] = [50.0, 50.0];
pub const RAND_NODE_NOT_NONE: f64 = 0.9;
pub const RAND_SIZE_SCALER: [f32; 2] = [0.5, 2.0];
pub const INWARD_NN_CHILDREN_INPUT_LEN: usize = 4;
pub const OUTWARD_NN_PARENT_INPUT_LEN: usize = 4;
pub const INWARD_NN_SHAPE: [usize; 3] = [
INWARD_NN_CHILDREN_INPUT_LEN * 4 + 9,
8,
INWARD_NN_CHILDREN_INPUT_LEN,
];
pub const OUTWARD_NN_SHAPE: [usize; 3] = [
OUTWARD_NN_PARENT_INPUT_LEN + 9,
8,
OUTWARD_NN_PARENT_INPUT_LEN + 2,
];
pub const BRAIN_NN_SHAPE: [usize; 3] = [
INWARD_NN_CHILDREN_INPUT_LEN * 4 + 9,
8,
OUTWARD_NN_PARENT_INPUT_LEN,
];
pub const ACTIVATION_FUNCTION: Activation = Activation::Sigmoid;
#[cfg(feature = "demo")]
pub mod mutate_consts{
use std::f32::consts::PI;
pub const MUTATE_TREE_STRUCTURE_PROB: f32 = 0.9;
pub const MUTATE_GAIN_LIMB_PROB: f32 = 0.5;
pub const MUTATE_GAIN_LIMB_MAX_TRY: u32 = 10;
pub const MUTATE_BLOCK_SIZE_PROB: f32 = 1.0;
pub const MUTATE_SINGLE_BLOCK_SIZE_PROB: f32 = 0.5;
pub const MUTATE_SINGLE_BLOCK_SIZE_SCALER: [f32;2] = [0.9,1.1];
pub const MUTATE_SINGLE_BLOCK_SIZE_CLAMP_SCALER: [f32;2] = [0.5,2.0];
pub const MUTATE_JOINT_LIMIT_PROB: f32 = 0.5;
pub const MUTATE_JOINT_LIMIT_MIN: f32 = -PI*0.9;
pub const MUTATE_JOINT_LIMIT_MAX: f32 = PI*0.9;
pub const MUTATE_NN_PORB: f32 = 0.5;
pub const MUTATE_NN_STD: f32 = 0.1;
}
#[cfg(feature = "move")]
pub mod mutate_consts{
use std::f32::consts::PI;
pub const MUTATE_TREE_STRUCTURE_PROB: f32 = 0.05;
pub const MUTATE_GAIN_LIMB_PROB: f32 = 0.5;
pub const MUTATE_GAIN_LIMB_MAX_TRY: u32 = 10;
pub const MUTATE_BLOCK_SIZE_PROB: f32 = 0.25;
pub const MUTATE_SINGLE_BLOCK_SIZE_PROB: f32 = 0.5;
pub const MUTATE_SINGLE_BLOCK_SIZE_SCALER: [f32;2] = [0.7,1.3];
pub const MUTATE_SINGLE_BLOCK_SIZE_CLAMP_SCALER: [f32;2] = [0.3,2.0];
pub const MUTATE_JOINT_LIMIT_PROB: f32 = 0.1;
pub const MUTATE_JOINT_LIMIT_MIN: f32 = -PI*0.9;
pub const MUTATE_JOINT_LIMIT_MAX: f32 = PI*0.9;
pub const MUTATE_NN_PORB: f32 = 0.25;
pub const MUTATE_NN_STD: f32 = 0.15;
}
pub const TRAIN_MOVE_SURVIVAL_RATE: f32 = 0.5;
pub const POPULATION: usize = 30;
pub const SCATTER_RATIO_Y: f32 = 0.8;
pub const SCATTER_RATIO_X: f32 = 0.8;
pub const BLOB_SPAWN_POINT_RADIUS: f32 = 750.0;
pub const ITERATION_LENGTH: usize = 1000;
pub const CHECKPOINTS_LENGTH: usize = 100;
pub const HYBRID_RATE: f32 = 0.3;
pub const TRAINING_MODE: &'static str = "swim";
pub const EXPORT_PATH: &'static str = "./export/";
pub const LOAD_FOLDER: &'static str = "./export/";
pub const LOAD_FNAME: &'static str = "./export/2023-07-25T15-28-56.json";
pub const LOAD_NEWEST_FILE: bool = true;
pub const MUTATE_AND_REFRESH_KEYCODE: KeyCode = KeyCode::M;
pub const NEW_ITERATION_KEYCODE: KeyCode = KeyCode::R;
pub const AUTO_NO_VSYNC_KEYCODE: KeyCode = KeyCode::V;
pub const SAVE_ALL_BLOBS_TO_JSON: KeyCode = KeyCode::S;
pub const LOAD_ALL_BLOBS_FROM_JSON: KeyCode = KeyCode::L;
pub const CLEAN_ALL_BLOBS_KEYCODE: KeyCode = KeyCode::X;
pub const LOG_PATH: &'static str = "./run.log";