Given X players, how many boats will there be, and how will these players be distributed over these boats?
(For example, with 5 players you can do 2 + 2 + 1, but also 2 + 3. With 8 players you can do 2 + 3 + 3, but also 2 + 2 + 2 + 2, and 4 + 4.)
Knowing that, which role(s) should each player get?
I think it's easiest if I just save all possible combinations for a certain player count. (I don't expect this game to have to support more than 15 or 20 players.)
(I was writing an algorithm for this, but then realized it would be way too complex for something that's really not difficult to hardcode into the game.)
Then, per boat, I loop over all the players, giving them one of the leftover roles, until there's nothing left. (I could randomize the roles and/or player list.)
Given X players, how many boats will there be, and how will these players be distributed over these boats?
(For example, with 5 players you can do 2 + 2 + 1, but also 2 + 3. With 8 players you can do 2 + 3 + 3, but also 2 + 2 + 2 + 2, and 4 + 4.)
Knowing that, which role(s) should each player get?
I think it's easiest if I just save all possible combinations for a certain player count. (I don't expect this game to have to support more than 15 or 20 players.)
(I was writing an algorithm for this, but then realized it would be way too complex for something that's really not difficult to hardcode into the game.)
Then, per boat, I loop over all the players, giving them one of the leftover roles, until there's nothing left. (I could randomize the roles and/or player list.)