属于是beta中的beta了

This commit is contained in:
shenjack 2024-03-23 00:32:19 +08:00
parent f4cd58547f
commit 965aad8961
Signed by: shenjack
GPG Key ID: 7B1134A979775551
3 changed files with 114 additions and 10 deletions

View File

@ -1,4 +1,7 @@
use crate::{evaluate::NamerEvaluater, name::{Namer, TeamNamer}};
use crate::{
evaluate::NamerEvaluater,
name::{Namer, TeamNamer},
};
use std::{io::Write, path::PathBuf};
@ -65,7 +68,7 @@ pub fn cacl(config: CacluateConfig, id: u64, outfile: &PathBuf) {
for i in (config.start + id..config.end).step_by(config.thread_count as usize) {
let name = gen_name(i as u64);
let namer = Namer::new_from_team_namer_unchecked(&team_namer, name.as_str());
let mut namer = Namer::new_from_team_namer_unchecked(&team_namer, name.as_str());
let prop = namer.get_property();
if (prop + config.prop_allow as f32) > config.prop_expect as f32 {
@ -75,15 +78,33 @@ pub fn cacl(config: CacluateConfig, id: u64, outfile: &PathBuf) {
// if crate::evaluate::xuping::XuPing1_3_1::evaluate(&namer) {
// continue;
// }
let xu = crate::evaluate::xuping::XuPing1_3_1::evaluate(&namer);
// let xu = crate::evaluate::xuping::XuPing1_3_1::evaluate(&namer);
debug!("Id:{:>15}|{:>5}|{}|{}", i, full_name, xu, show_name(&namer));
if xu < 5000.0 {
// // debug!("Id:{:>15}|{:>5}|{}|{}", i, full_name, xu, show_name(&namer));
// if xu < 5000.0 {
// continue;
// }
namer.update_skill();
let skill_sum: u32 = {
let mut sum: u32 = 0;
for i in namer.skl_freq.iter() {
sum += *i as u32;
}
sum
};
if namer.get_净化() < 70 {
continue;
}
if namer.get_幻术() < 20 {
continue;
}
if skill_sum < 150 {
continue;
}
get_count += 1;
info!("Id:{:>15}|{}|{}", i, full_name, show_name(&namer));
info!("Id:{:>15}|{}|{}", i, full_name, namer.get_info());
// 写入 (写到最后一行)
match std::fs::OpenOptions::new()
.append(true)

View File

@ -80,16 +80,21 @@ pub fn predict_13(name: &Namer) -> f64 {
st[name.skl_id[i] as usize + 8] = name.skl_freq[i] as f64;
}
}
// - st: 名字属性。0~7 是八围8~42 是技能熟练度。
// for i in 0..34 {
// st[i + 8] = name.skl_freq[i] as f64;
// }
let mut cnt = 0;
for i in 0..43 {
sum += st[i] * xuping13::MODULE[cnt];
print!("{} ", sum);
// println!("{} {} {} ",st[i], sum, xuping13::MODULE[cnt]);
cnt += 1;
}
for i in 0..43 {
for j in i..43 {
sum += st[i] * st[j] * xuping13::MODULE[cnt];
print!("{} ", sum);
// println!("{} {} {} ",st[i] * st[j], sum, xuping13::MODULE[cnt]);
cnt += 1;
}
}
@ -133,11 +138,13 @@ mod test {
#[test]
fn xuping_13_test() {
let mut namer = Namer::new(&"x@x".to_string()).unwrap();
// let mut namer = Namer::new(&"x@x".to_string()).unwrap();
let mut namer = Namer::new(&"pi31uXx?shadow@魔".to_string()).unwrap();
namer.update_skill();
println!("{:?}", predict_13(&namer));
println!("{:?}", namer.get_info());
panic!();
}
}

View File

@ -340,6 +340,82 @@ impl Namer {
let sum2 = self.name_prop[0] as u32;
sum1 as f32 + (sum2 as f32 / 3_f32)
}
pub fn get_净化(&self) -> u8 {
// self.skl_freq[17]
for (i, v) in self.skl_freq.iter().enumerate() {
if *v != 0 {
if self.skl_id[i] == 17 {
return *v;
}
}
}
0
}
pub fn get_分身(&self) -> u8 {
// self.skl_freq[23]
for (i, v) in self.skl_freq.iter().enumerate() {
if *v != 0 {
if self.skl_id[i] == 23 {
return *v;
}
}
}
0
}
pub fn get_幻术(&self) -> u8 {
// self.skl_freq[24]
for (i, v) in self.skl_freq.iter().enumerate() {
if *v != 0 {
if self.skl_id[i] == 24 {
return *v;
}
}
}
0
}
pub fn get_info(&self) -> String {
let main = format!(
"name: {}, team: {} HP|{} 攻|{} 防|{} 速|{} 敏|{} 魔|{} 抗|{} 智|{} 八围:{}",
self.name,
self.team,
self.name_prop[0],
self.name_prop[1],
self.name_prop[2],
self.name_prop[3],
self.name_prop[4],
self.name_prop[5],
self.name_prop[6],
self.name_prop[7],
self.get_property()
);
let skills = {
let mut base = "".to_string();
let skill_names = [
"火球", "冰冻", "雷击", "地裂", "吸血", "投毒", "连击", "会心", "瘟疫", "命轮",
"狂暴", "魅惑", "加速", "减速", "诅咒", "治愈", "苏生", "净化", "铁壁", "蓄力",
"聚气", "潜行", "血祭", "分身", "幻术", "防御", "守护", "反弹", "护符", "护盾",
"反击", "吞噬", "亡灵", "垂死", "隐匿", "", "", "", "", "",
];
// 后处理
let mut skills = [0; 40];
for i in 0..40 {
if self.skl_freq[i] != 0 {
skills[self.skl_id[i] as usize] = self.skl_freq[i];
}
}
for (i, v) in skills.iter().enumerate() {
if *v > 0 {
base.push_str(format!("{}: {}|", skill_names[i], v).as_str());
}
}
base
};
format!("{}|{}", main, skills)
}
}
#[cfg(test)]