Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
akanalytics committed Jul 22, 2024
2 parents 2ad1c7d + 69077a6 commit 0f91567
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 13 deletions.
17 changes: 8 additions & 9 deletions crates/odonata-base/src/eg/endgame.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
use serde::{Deserialize, Serialize};
use strum::IntoEnumIterator;
use strum_macros::{Display, EnumCount, EnumIter, IntoStaticStr};
use strum_macros::{Display, EnumCount, IntoStaticStr};

use crate::prelude::*;
use crate::trace::stat::{SliceStat, Stat};
Expand Down Expand Up @@ -55,7 +54,7 @@ impl Configurable for EndGameScoring {
}
}

#[derive(Copy, Default, Clone, PartialEq, Debug, IntoStaticStr, EnumCount, EnumIter, Display)]
#[derive(Copy, Default, Clone, PartialEq, Debug, IntoStaticStr, EnumCount, Display)]
pub enum EndGame {
#[default]
Unknown, // for when its too costly to work out who wins
Expand Down Expand Up @@ -139,11 +138,11 @@ pub enum EndGame {
use static_init::dynamic;
#[dynamic]
static ENDGAME_COUNTS: Vec<Stat> = {
let mut vec = vec![];
for eg in EndGame::iter() {
let s: &'static str = eg.into();
vec.push(Stat::new(s));
}
let vec = vec![];
// for eg in EndGame::iter() {
// let s: &'static str = eg.into();
// vec.push(Stat::new(s));
// }
vec
};

Expand Down Expand Up @@ -417,7 +416,7 @@ impl EndGame {

pub fn from_board(b: &Board) -> Self {
let eg = Self::private_ctor(b);
ENDGAME_COUNTS[eg as usize].increment();
// ENDGAME_COUNTS[eg as usize].increment();
eg
}

Expand Down
6 changes: 3 additions & 3 deletions crates/odonata-base/src/infra/metric.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1064,9 +1064,9 @@ impl fmt::Display for Metrics {
//
let mut b = Builder::default();
b.set_header(["Counter", "Value"]);
for eg in EndGame::iter() {
b.push_record([&eg.to_string(), &i(self.endgame[eg as usize])]);
}
// for eg in EndGame::iter() {
// b.push_record([&eg.to_string(), &i(self.endgame[eg as usize])]);
// }
let mut t = b.build();
t.with(style.clone())
.with(Modify::new(Rows::single(0)).with(Border::default().top('-')))
Expand Down
2 changes: 1 addition & 1 deletion docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
# Odonata
A chess engine written in Rust.

Odonata is designed by [Andy Watkins](https://github.com/akanalytics), with [Mark Raistrick](https://github.com/raistrma) assisting with designs and discussion. Bugs in the Rust code will certainly be mine though - Andy ;-)
Odonata was created by [Andy Watkins](https://github.com/akanalytics), with [Mark Raistrick](https://github.com/raistrma) assisting with designs and discussion. Bugs in the Rust code will certainly be mine though - Andy ;-)

My lockdown hobby was writing a chess engine, and learning Python and Rust in the process. I started Decemeber 2020. Python and Rust are very different from Java, which I had programmed maybe 10 years previous. Certainly my first efforts at Rust are not very clean, clever or idiomatic, but the code improves as I revisit areas to build improvements.

Expand Down

0 comments on commit 0f91567

Please sign in to comment.