|
|
1.1 ! root 1: awk ' ! 2: BEGIN { n = ARGV[1] # number of elements to sort ! 3: for (i = 1; i <= n; i++) x[i] = 1 + int(25*rand()) ! 4: for (i = 1; i <= n; i++) draw(i) ! 5: for (i = 2; i <= n; i++) { ! 6: for (j = i; j > 1 && less(j, j-1); j--) ! 7: swap(j-1, j) ! 8: print "view text" ! 9: print "bar: text ljust", i, 1, "\" |\"" ! 10: print "click phase" ! 11: } ! 12: } ! 13: function draw(i) { ! 14: print "view text" ! 15: print "a" i ": text", i, 1, x[i] ! 16: print "view geom" ! 17: print "a" i ": line", i, 0, i, x[i] ! 18: } ! 19: function swap(i, j, t) { ! 20: t = x[i]; x[i] = x[j]; x[j] = t ! 21: draw(i); draw(j) ! 22: print "click swap" ! 23: } ! 24: function less(i, j) { ! 25: print "click comp" ! 26: if (x[i] < x[j]) return 1; else return 0 ! 27: }' $*
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.