An Algorithm for Making a Balanced Latin Square Design
1. Let's say you have 6 conditions (but any even n will work). Make an n x n table.
2. Next, label each of the columns 1 through n, alternating between successive columns as below.
3. Now label the left hand column from 1 ascending to n.
4. Move to the right by one column, and fill in the next column by incrementing the values with each successive row (wrapping so that 1 follows n)
5. Repeat step 4 until the table is filled.
Now you can run your experiment using the first row as condition order A, the second row as condition order B, and so on.
Bradley, J. V. Complete counterbalancing of immediate sequential effects in a Latin square design. J. Amer. Statist. Ass.,.1958, 53, 525-528.A literature survey of latin squares