Create a vector of rounds and their respective matches in a tournament, using the Round-robin algorithm.
Accepted: - String data type players; - number of even players; - round-trip.
``` fn main(){ let rounds = roundrobin(vec![ "Liverpool".tostring(), "Chelsea".tostring(), "M. City".tostring(), "M. United".to_string() ], false);
println!("{:#?}", rounds);
} ```
[
Round {
id: 1,
games: [
Game {
home: "Liverpool",
away: "M. United",
},
Game {
home: "Chelsea",
away: "M. City",
},
],
},
Round {
id: 2,
games: [
Game {
home: "Liverpool",
away: "M. City",
},
Game {
home: "M. United",
away: "Chelsea",
},
],
},
Round {
id: 3,
games: [
Game {
home: "Liverpool",
away: "Chelsea",
},
Game {
home: "M. City",
away: "M. United",
},
],
},
]