File assign.c

NAME: assignment
DESCRIPTION This procedure uses an ACM algorithm (Algorithm 415) to assign powers to the players, according to their preference lists, their order of signing on to the game, and (unfortunately) the order that the powers are listed in the power letters list for the variant.
REVISION HISTORY DATE NAME REASON ----------- ------------ --------------------------------------------------- ?? ??? 1987 K.Lowe Original development. 21 Mar 1994 C.Marcus,Jr. Restructure as 'normal' C code, and document as much as possible; slight change made in the logic for the case n=m, so that excessive reduction of the initial array isn't done.
INTERFACE DEFINITION Calling Sequence: assignment(&a, n, m, &x);
Inputs: a[][] := Array of preferences: a[i][j] is the preference assigned by Player i for Position j (the lower the value, the more Player i prefers Position j) n := The number of Players (= number of rows in array a = number of entries in array x) m := The number of Positions (= number of columns in array a)
Outputs: x[] := Positions assigned: x[i] is the Position assigned to Player i. a[][] Values have been trashed during calculations.
ALGORITHM I'm sorry, go get the ACM's Collected Algorithms if you want to TRY to understand this. My comments below are only approximately correct (as close as I could get to what's going on here).


Included Files


Preprocessor definitions

#define MAXN WILD_PLAYER

#define MAXM WILD_PLAYER

#define INIT -1


Global Function assignment()

void assignment ( int a[139][139], int n, int m, int x[139] )
Prototyped in: assign.c