Start to build cli player

This commit is contained in:
2022-10-01 19:25:41 +02:00
parent 65af3b0bba
commit 003296a782
39 changed files with 414 additions and 125 deletions

View File

@@ -0,0 +1,12 @@
use crate::human_player_ws::ServerMessage;
/// Make sure player can not replay after successful hit
pub fn check_no_replay_on_hit(msg: &ServerMessage) {
if let ServerMessage::OpponentMustFire { status } | ServerMessage::RequestFire { status } = msg
{
let diff =
status.opponent_map.number_of_fires() as i32 - status.your_map.number_of_fires() as i32;
assert!(diff <= 1);
}
}