diff options
Diffstat (limited to 'server/bot/src/algos/frank.rs')
| -rw-r--r-- | server/bot/src/algos/frank.rs | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/server/bot/src/algos/frank.rs b/server/bot/src/algos/frank.rs index c8127198..c815c75f 100644 --- a/server/bot/src/algos/frank.rs +++ b/server/bot/src/algos/frank.rs @@ -1,3 +1,5 @@ +use std::random::random; + /* Hurry Curry! - a game about cooking Copyright (C) 2025 Hurry Curry! Contributors @@ -16,12 +18,11 @@ */ use crate::{ - pathfinding::{find_path_to_neighbour, Path}, BotAlgo, BotInput, + pathfinding::{Path, find_path_to_neighbour}, }; use hurrycurry_client_lib::Game; -use hurrycurry_protocol::{glam::Vec2, Message, PacketS, PlayerClass, PlayerID}; -use rand::{random, rng, seq::IndexedRandom}; +use hurrycurry_protocol::{Message, PacketS, PlayerClass, PlayerID, glam::Vec2}; #[derive(Default)] pub struct Frank { @@ -71,7 +72,7 @@ impl BotAlgo for Frank { extra: vec![PacketS::Communicate { player: me, message: Some(Message::Translation { - id: format!("s.bot.frank.line.{}", random::<u32>() % 8), + id: format!("s.bot.frank.line.{}", random::<u32>(..) % 8), params: vec![Message::Text(player.name.clone())], }), timeout: Some(3.), @@ -110,5 +111,5 @@ fn find_chef(game: &Game, me: PlayerID) -> Option<PlayerID> { .filter(|(i, p)| p.class == PlayerClass::Chef && **i != me) .map(|(i, _)| *i) .collect::<Vec<_>>(); - chefs.choose(&mut rng()).copied() + chefs.get(random::<usize>(..) % chefs.len().max(1)).copied() } |