Compare commits
2 Commits
ac4c2d6f72
...
e00eefb990
Author | SHA1 | Date | |
---|---|---|---|
e00eefb990 | |||
f6845b5126 |
@ -17,7 +17,7 @@ use std::{
|
|||||||
time::{Duration, Instant},
|
time::{Duration, Instant},
|
||||||
};
|
};
|
||||||
|
|
||||||
use log::{error, info};
|
use log::{error, info, warn};
|
||||||
use ordered_float::OrderedFloat;
|
use ordered_float::OrderedFloat;
|
||||||
use rand::thread_rng;
|
use rand::thread_rng;
|
||||||
use serde_json::{json, Value};
|
use serde_json::{json, Value};
|
||||||
@ -126,7 +126,7 @@ pub fn get_move(
|
|||||||
game.ruleset.name == "constrictor",
|
game.ruleset.name == "constrictor",
|
||||||
);
|
);
|
||||||
let possible_actions = board.possible_actions().get(&game_info.my_token).cloned()?;
|
let possible_actions = board.possible_actions().get(&game_info.my_token).cloned()?;
|
||||||
if possible_actions.len() == 1 {
|
if possible_actions.len() <= 1 {
|
||||||
info!("Only one movement option exists in turn {turn}. Skipping Tree evaluation");
|
info!("Only one movement option exists in turn {turn}. Skipping Tree evaluation");
|
||||||
return possible_actions.first().map(|direction| Action {
|
return possible_actions.first().map(|direction| Action {
|
||||||
r#move: *direction,
|
r#move: *direction,
|
||||||
@ -141,7 +141,7 @@ pub fn get_move(
|
|||||||
|mut guard| {
|
|mut guard| {
|
||||||
let target_latency = game.timeout / 2;
|
let target_latency = game.timeout / 2;
|
||||||
let latency = you.latency.parse().unwrap_or_else(|e| {
|
let latency = you.latency.parse().unwrap_or_else(|e| {
|
||||||
error!("Unable to parse latency: {e}");
|
warn!("Unable to parse latency: {e}");
|
||||||
target_latency
|
target_latency
|
||||||
});
|
});
|
||||||
let last_computation_time = u32::try_from(guard.as_millis()).unwrap_or(0);
|
let last_computation_time = u32::try_from(guard.as_millis()).unwrap_or(0);
|
||||||
|
Loading…
Reference in New Issue
Block a user