procedure main() write(q(1),q(2),q(3),q(4),q(5),q(6),q(7),q(8)) end procedure q(c) suspend place(1 to 8,c) # look for a row end procedure place(r,c) static up, down, row initial { up := list(15,0) down := list(15,0) row := list(8,0) } if row[r] = down[r + c - 1] = up[8 + r - c] = 0 then suspend row[r] <- down[r + c - 1] <- up[8 + r - c] <- r # place if free end