|
|
1.1 ! root 1: awk ' ! 2: function draw(i) { ! 3: print "a" i ": text", i, x[i], "bullet" ! 4: print "b" i ": circle fill", i, x[i], .1 ! 5: } ! 6: function swap(i,j, t) { ! 7: t = x[i]; x[i] = x[j]; x[j] = t ! 8: draw(i); draw(j) ! 9: print "click swaps" ! 10: } ! 11: function less(i,j) { ! 12: print "compline: line <-> fat", i, -8, j, -8 ! 13: print "click comps" ! 14: if (x[i] < x[j]) { return 1 } else { return 0 } ! 15: } ! 16: BEGIN { n=10 ! 17: for (i = 1; i <= n; i++) { ! 18: x[i] = int(100*rand()) ! 19: draw(i) ! 20: } ! 21: for (i = 2; i <= n; i++) ! 22: for (j = i; j > 1 && less(j, j-1); j--) ! 23: swap(j-1, j) ! 24: }'
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.