about summary refs log tree commit diff stats
path: root/shell
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2021-06-06 23:22:57 -0700
committerKartik K. Agaram <vc@akkartik.com>2021-06-06 23:22:57 -0700
commit9d2c64455a87edd4d241cbedd18963010b110a32 (patch)
tree649144769c83362ebbb2eb03cbdaf00b1e448a00 /shell
parent4ec95d54ce2b3ad679b019e829feb78e6c418680 (diff)
downloadmu-9d2c64455a87edd4d241cbedd18963010b110a32.tar.gz
fizz-buzz take 2
Diffstat (limited to 'shell')
-rw-r--r--shell/data.limg35
1 files changed, 24 insertions, 11 deletions
diff --git a/shell/data.limg b/shell/data.limg
index 5a477f04..6c0260ce 100644
--- a/shell/data.limg
+++ b/shell/data.limg
@@ -209,21 +209,34 @@
     (palette . [(def (palette p i)
   (nth (% i (len p)) p))])
     (task . [(def (task screen keyboard)
+  (let width (width screen)
+  (let t (/ width 3)
+  (let height (height screen)
   (let (i y) '(1 0)
-    (while (< y (height screen))
-      (hline screen y (fizzbuzz i))
+    (while (< y height)
+      (hline1 screen y 0 t
+          # color
+          (if (= 0 (% i 3))
+            10
+            7))
+      (hline1 screen y t (* 2 t)
+          # color
+          (if (= 0 (% i 5))
+            12
+            7))
+      (hline1 screen y (* 2 t) (* 3 t)
+          # color
+          (if (= 0 (% i 3))
+            (if (= 0 (% i 5))
+              14
+              10)
+            (if (= 0 (% i 5))
+              12
+              7)))
       (+= y 3)
-      (++ i))))])
+      (++ i)))))))])
     (main . [(def (main screen keyboard)
   (task screen keyboard))])
-    (fizzbuzz . [(def (fizzbuzz n)
-  (if (= 0 (% n 3))
-    (if (= 0 (% n 5))
-      14
-      12)
-    (if (= 0 (% n 5))
-      10
-      7)))])
   ))
   (sandbox . (task screen keyboard))
 )