fix clippy lints
This commit is contained in:
parent
61e5f26bd7
commit
accfe7acbb
@ -137,6 +137,7 @@ pub fn get_move(game: &Game, turn: i32, board: &Board, you: &Battlesnake) -> Opt
|
||||
|
||||
info!("actions: {actions:?}");
|
||||
|
||||
#[allow(clippy::cast_precision_loss)]
|
||||
let chosen = actions
|
||||
.iter()
|
||||
.max_by_key(|(_, stat)| OrderedFloat(stat.won as f64 / stat.played as f64))
|
||||
@ -195,7 +196,9 @@ impl Node {
|
||||
if statistics.played == 0 {
|
||||
return OrderedFloat(f64::INFINITY);
|
||||
}
|
||||
#[allow(clippy::cast_precision_loss)]
|
||||
let exploitation = statistics.won as f64 / statistics.played as f64;
|
||||
#[allow(clippy::cast_precision_loss)]
|
||||
let exploration = f64::consts::SQRT_2
|
||||
* f64::sqrt(
|
||||
f64::ln(self.statistic.played as f64)
|
||||
|
@ -1,10 +1,7 @@
|
||||
use std::collections::{BTreeMap, BTreeSet, VecDeque};
|
||||
|
||||
use iter_tools::Itertools;
|
||||
use rand::{
|
||||
seq::{IteratorRandom, SliceRandom},
|
||||
Rng,
|
||||
};
|
||||
use rand::{seq::IteratorRandom, Rng};
|
||||
|
||||
use crate::{Coord, Direction};
|
||||
|
||||
@ -84,14 +81,6 @@ impl Board {
|
||||
}
|
||||
}
|
||||
|
||||
pub const fn turn(&self) -> i32 {
|
||||
self.turn
|
||||
}
|
||||
|
||||
pub fn is_alive(&self, token: SnakeToken) -> bool {
|
||||
self.snakes.contains_key(&token)
|
||||
}
|
||||
|
||||
pub fn alive_snakes(&self) -> usize {
|
||||
self.snakes.len()
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user