diff --git a/server/src/instance.rs b/server/src/instance.rs index 34675d5d..bf298039 100644 --- a/server/src/instance.rs +++ b/server/src/instance.rs @@ -287,7 +287,7 @@ impl Instance { } fn next_round(&mut self) -> &mut Instance { - if self.win_condition() { + if self.finish_condition() { return self.finish(); } @@ -309,10 +309,13 @@ impl Instance { self } - fn win_condition(&self) -> bool { + fn finish_condition(&self) -> bool { match self.format { + // bo5 standard Format::Standard => self.players.iter().any(|p| p.score.wins > 2), - Format::RoundRobin => self.rounds.len() == self.players.len() / 2, + + // everybody plays each other once + Format::RoundRobin => self.rounds.len() == self.players.len() - 1, } } @@ -775,7 +778,7 @@ mod tests { assert_eq!(instance.phase, InstancePhase::Finished); assert_eq!(instance.rounds[0].len(), 8); - assert_eq!(instance.rounds.len(), 8); + assert_eq!(instance.rounds.len(), 15); } #[test]