SHARE
TWEET

algo

a guest Nov 13th, 2012 40 Never
  1. team1:=[player 1, player 2, player 3, player 4, player 5];
  2. team2:=[player 6, player 7, player 8, player 9, player 10];
  3.  
  4. x:=1;
  5. y:=1;
  6. placeholder:=0;
  7.  
  8. while y=!6
  9. {
  10.  sum1:=sum of team1;
  11.  sum2:=sum of team2;
  12.  difference1:=abs(sum1-sum2); //absolute value
  13.  
  14.  team1[x]:=placeholder;
  15.  team1[x]:=team2[y];    //changing team members
  16.  team2[y]:=placeholder;
  17.  
  18.  sum1:=sum of team1;
  19.  sum2:=sum of team2;
  20.  difference2:=abs(sum1-sum2);
  21.  
  22.   if difference1<difference2 then
  23.   {
  24.   team1[x]:=placeholder;  // no point in changing team members if
  25.   team1[x]:=team2[y];     // the elo difference didn't become smaller
  26.   team2[y]:=placeholder;
  27.   }
  28.  
  29.  x++;
  30.  
  31.   if x=6 then
  32.   {
  33.   x=1;
  34.   y++;
  35.   }
  36. }
RAW Paste Data
Top