Today, I just cannot get my head to produce a round robin schedule given N cars.

I have managed to produce the first heat's cars in a temp table
Temporary Table: tRoundRobin
No. Column Name        Attributes
--- ------------------ ------------------------------------------------------
  1 Heat               Type   : INTEGER
  2 Flight             Type   : INTEGER
  3 Car1               Type   : INTEGER
  4 Car2               Type   : INTEGER
  Current number of rows:         5

R>select * from troundrobin
Heat Flight Car1 Car2 ---------- ---------- ---------- ----------
         1          1          1         10
         1          2          2          9
         1          3          3          8
         1          4          4          7
         1          5          5          6

Then I am stumped. How do I get the second heat to produce

Heat Flight Car1 Car2 ---------- ---------- ---------- ----------
         2          1          1          9
         2          2         10          8
         2          3          2          7
         2          4          3          6
         2          5          4          5
Heat Flight Car1 Car2 ---------- ---------- ---------- ----------
         3          1          1          8
         3          2          9          7
         3          3         10          6
         3          4          2          5
         3          5          3          4

etcetera.


I can handle the switching of lanes afterward. it's fairly simple to do that, but I'll be darned if I can get a set of commands set up to leave #1 car in place and rotate the other 9 cars (or any other number of cars!) counter clockwise. If there is an odd number of cars, one of the lanes will be NULL, in other words a bye.

Thanks!
Albert


Reply via email to