diff options
author | Kartik K. Agaram <vc@akkartik.com> | 2021-06-06 22:53:46 -0700 |
---|---|---|
committer | Kartik K. Agaram <vc@akkartik.com> | 2021-06-06 22:53:46 -0700 |
commit | c546987a07f9def3615ebce2b3e90b04109bcb01 (patch) | |
tree | ab52e18b914c9d896941bf86a7afd3a315ff6ef3 /shell | |
parent | b3869987da6d828b9c50a683a6324109bf85fd8c (diff) | |
download | mu-c546987a07f9def3615ebce2b3e90b04109bcb01.tar.gz |
fizz-buzz exercise
Diffstat (limited to 'shell')
-rw-r--r-- | shell/data.limg | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/shell/data.limg b/shell/data.limg index 780d7db9..5a477f04 100644 --- a/shell/data.limg +++ b/shell/data.limg @@ -209,13 +209,21 @@ (palette . [(def (palette p i) (nth (% i (len p)) p))]) (task . [(def (task screen keyboard) - (let (y c) '(0 0) + (let (i y) '(1 0) (while (< y (height screen)) - (hline screen y (palette Greys c)) + (hline screen y (fizzbuzz i)) (+= y 3) - (++ c))))]) + (++ 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)) ) |