aboutsummaryrefslogblamecommitdiff
path: root/games/squ.awk
blob: be72a3b64bd8196c73093932a34edab7eeefc0d2 (plain) (tree)
1
2
3
4
5
6
7
                                                       
                
                     


                                                                                
 
# Make a reduced Latin square out of each line of input
l = length($0) {
    str = toupper($0)
    for (j = 0; j < l; j++)
        for (k = 0; k < l; k++)
            printf (k < l - 1) ? "%s " : "%s\n", substr(str, (k + j) % l + 1, 1)
}