diff options
| author | Daniel Cerqueira <dan.git@lispclub.com> | 2025-09-03 12:55:14 +0100 |
|---|---|---|
| committer | Daniel Cerqueira <dan.git@lispclub.com> | 2025-09-03 12:55:14 +0100 |
| commit | b18e1682318452372b0d8017f9ffe72db3e890db (patch) | |
| tree | 635a99a4fe8df0d2d46906e64dcb665f0f53e801 /examples/abacus/writing.lali | |
| parent | f3260d01f80a2dd16a095f2c06a3c2e3fb1094ee (diff) | |
add some *nice* lali scripts
Diffstat (limited to 'examples/abacus/writing.lali')
| -rwxr-xr-x | examples/abacus/writing.lali | 69 |
1 files changed, 69 insertions, 0 deletions
diff --git a/examples/abacus/writing.lali b/examples/abacus/writing.lali new file mode 100755 index 0000000..2ba300b --- /dev/null +++ b/examples/abacus/writing.lali @@ -0,0 +1,69 @@ +;; variables +(set 'max-columns +3) + +;; functions +(defun random-number (cases) + (fill + ((dif cases +0) (cons (random +9) ())) + (f (cons (random +9) (random-number (- cases +1)))))) + +(defun number-to-symbol (num) + (fill + ((dif +0 num) '0) + ((dif +1 num) '1) + ((dif +2 num) '2) + ((dif +3 num) '3) + ((dif +4 num) '4) + ((dif +5 num) '5) + ((dif +6 num) '6) + ((dif +7 num) '7) + ((dif +8 num) '8) + ((dif +9 num) '9))) + +(defun number-to-earth-rod (num) + (fill + ((dif +0 num) "[@-@][@@@@-@]") + ((dif +1 num) "[@-@][@@@-@@]") + ((dif +2 num) "[@-@][@@-@@@]") + ((dif +3 num) "[@-@][@-@@@@]") + ((dif +4 num) "[@-@][-@@@@@]") + ((dif +5 num) "[-@@][@@@@-@]") + ((dif +6 num) "[-@@][@@@-@@]") + ((dif +7 num) "[-@@][@@-@@@]") + ((dif +8 num) "[-@@][@-@@@@]") + ((dif +9 num) "[-@@][-@@@@@]"))) + +(defun number-to-air-rod (num) + (fill + ((dif +0 num) "[@-@@@@][@-@]") + ((dif +1 num) "[@@-@@@][@-@]") + ((dif +2 num) "[@@@-@@][@-@]") + ((dif +3 num) "[@@@@-@][@-@]") + ((dif +4 num) "[@@@@@-][@-@]") + ((dif +5 num) "[@-@@@@][@@-]") + ((dif +6 num) "[@@-@@@][@@-]") + ((dif +7 num) "[@@@-@@][@@-]") + ((dif +8 num) "[@@@@-@][@@-]") + ((dif +9 num) "[@@@@@-][@@-]"))) + +;; main +(defun main () + (progs + f + (set 'n-rand (random-number (random max-columns))) + (print (map number-to-symbol n-rand)) + ;; (print n-rand) + (newline) + (read) + (map (lambda (num) (princ (number-to-earth-rod num)) (newline)) n-rand) + (read) + (newline) + (read))) + +;; loop +(defun loop () + (fill + ((main) ()) + (f (loop)))) + +(loop) |
