modulo rotatation of players for more than 16 rounds

This commit is contained in:
ntr 2019-03-20 19:14:12 +11:00
parent 72f6e81d25
commit 616a4b23cb
2 changed files with 4 additions and 3 deletions

View File

@ -17,6 +17,7 @@
## NOW
cryp vbox
ensure all skills impl
make parry semi-aggressive
constants
change to ownership pattern

View File

@ -282,14 +282,15 @@ impl Instance {
.map(|p| p.id)
.collect::<Vec<Uuid>>();
let np = matched_players.len();
if round_num > 0 {
matched_players.rotate_right(round_num);
matched_players.rotate_right(round_num % np);
matched_players.swap(0,1);
}
// only set up for even player numbers atm
// no byes
let np = matched_players.len();
let current_round = matched_players[0..(np / 2)]
.iter()
.enumerate()
@ -584,7 +585,6 @@ mod tests {
let player_account = Uuid::new_v4();
let cryps = instance_mobs(player_account);
let mut player = Player::new(player_account, instance.id, &"test".to_string(), cryps).set_bot(true);
let player_id = player.id;
instance.add_player(player.clone());
assert!(instance.can_start());