From 965aad89618d39a0affc9a97718f9fcc67545d2e Mon Sep 17 00:00:00 2001 From: shenjack <3695888@qq.com> Date: Sat, 23 Mar 2024 00:32:19 +0800 Subject: [PATCH] =?UTF-8?q?=E5=B1=9E=E4=BA=8E=E6=98=AFbeta=E4=B8=AD?= =?UTF-8?q?=E7=9A=84beta=E4=BA=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/cacluate.rs | 33 +++++++++++++--- src/evaluate/xuping/eval.rs | 15 ++++++-- src/name.rs | 76 +++++++++++++++++++++++++++++++++++++ 3 files changed, 114 insertions(+), 10 deletions(-) diff --git a/src/cacluate.rs b/src/cacluate.rs index 430b0bc..2174736 100644 --- a/src/cacluate.rs +++ b/src/cacluate.rs @@ -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) diff --git a/src/evaluate/xuping/eval.rs b/src/evaluate/xuping/eval.rs index c989418..ab88ba7 100644 --- a/src/evaluate/xuping/eval.rs +++ b/src/evaluate/xuping/eval.rs @@ -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!(); } } diff --git a/src/name.rs b/src/name.rs index 6750f69..dfab88f 100644 --- a/src/name.rs +++ b/src/name.rs @@ -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)]