spamguy/diplomacy

Consider preferences for certain powers

Opened this issue · 1 comments

A player should be able to designate preference, or levels thereof, for each power in an upcoming game. This set of preferences can be considered when handing out powers using, say, a stable marriage problem algorithm.

If the powers had preferences, Italy would be in love with me. :-)

Which is to say that this isn't exactly a stable marriage problem.

The nJudge algorithm assigns numeric values for each player's preferences and tries to maximize the total for the entire game. Game creators also have the option to specify random preferences or a composite system to be used instead. (Prefboth allows the player to submit an asterisk in lieu of a preference list and receive a randomly chosen power before the other powers are assigned.

At some point someone noticed that judges were pretty likely to assign the first players to join a game their first preferences, so that was "fixed" by randomizing the order of the players before assigning powers.

At this point, the variant with the most players is Void, which has 36 players, so there's no computational reason not to allow square bracket grouping of preferences and brute force compute the matrix. I'm reasonably sure that giving players their first choice when uncontested is a simple optimization that will never result in a suboptimal matrix. This caries the additional benefit of hiding obvious flaws in the algorithm from player notice and making assigned seats for tournaments predictable.

The resulting algorithm:

If * is allowed, give each player who requested a random power their power assignment.

For each player whose first remaining choice in powers is uncontested, assign that power to that player.

Create an array for each remaining player with a mathematical value for each remaining power of N-X, where N is the number of powers in the variant and C is the position in the player's original position list. When square bracket are allowed to indicate powers of equally preference, the value assigned each power in that player's matrix is the average of those positions.

Evaluate the matrix for each of X! possible combinations and select the outcome that yields the highest total. In the event of a tie, select randomly from among the sets with the lowest standard deviation.

Repeat for duplex games. In duplex games, probably both powers should be assigned randomly before evaluating lists.