Pandaqi / In-the-Same-Boat

Jackbox-style game where you try to sail a ship together - discovering treasures and battling your friends.
2 stars 0 forks source link

Create algorithm for boat and role distribution #6

Closed Pandaqi closed 5 years ago

Pandaqi commented 5 years ago

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.)

Pandaqi commented 5 years ago

Wrote a nice piece of code for this. Still has some issues (on extremely large player counts and role diversification), but that is for a later time.