Annotation of 43BSD/contrib/icon/book/f/8qp.icn, revision 1.1.1.1

1.1       root        1: procedure main()
                      2:    every print([q(1),q(2),q(3),q(4),q(5),q(6),q(7),q(8)])
                      3: end
                      4: 
                      5: procedure q(r)
                      6:    suspend place(1 to 8,r)
                      7: end
                      8: 
                      9: procedure place(c,r)
                     10:    static up, down, col
                     11:    initial {
                     12:       up := list(15,0)
                     13:       down := list(15,0)
                     14:       col := list(8,0)
                     15:       }
                     16:    if col[c] = up[8 + r - c] = down[r + c - 1] = 0
                     17:    then suspend col[c] <- up[8 + r - c] <-
                     18:       down[r + c - 1] <- c
                     19: end
                     20: 
                     21: procedure print(a)
                     22:    static line, bar
                     23:    initial {
                     24:       line := repl("+-",8) || "+"
                     25:       bar := repl("| ",8) || "|"
                     26:       }
                     27:    every bar[!a*2] <- "Q" do {
                     28:       write(line)
                     29:       write(bar)
                     30:       }
                     31:    write(line,"\n\n")
                     32:    return
                     33: end

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.