summaryrefslogtreecommitdiff
path: root/examples/rule110/rule110.kurt
diff options
context:
space:
mode:
authormRnea <akannemre@gmail.com>2024-08-22 00:24:19 +0300
committermRnea <akannemre@gmail.com>2024-08-22 00:24:19 +0300
commit4c8409da359cf0da14214ccc939c10ac759f76a5 (patch)
treeb9af87c1a47a401503992b280b5253d00957ceb6 /examples/rule110/rule110.kurt
parent4367febcd70e9bb7538cd168917ec3c7d3b0a6f3 (diff)
added new examples
Diffstat (limited to 'examples/rule110/rule110.kurt')
-rw-r--r--examples/rule110/rule110.kurt40
1 files changed, 40 insertions, 0 deletions
diff --git a/examples/rule110/rule110.kurt b/examples/rule110/rule110.kurt
new file mode 100644
index 0000000..181ca2e
--- /dev/null
+++ b/examples/rule110/rule110.kurt
@@ -0,0 +1,40 @@
+makro boyut 100 son
+makro stdout 1 son
+makro sys-write 1 son
+makro print-buffer
+ stdout bel boyut + boyut 1 + sys-write syscall-3
+son
+
+;; initialize board
+0 döngü eş boyut < iken
+ eş bel + 0 yaz
+ 1 +
+yap düş
+boyut 2 - bel + 1 yaz
+
+;; iteration count
+0 döngü eş boyut 2 - < iken
+ ;; write board to buffer
+ 0 döngü eş boyut < iken
+ eş bel + oku 1 = ise
+ eş bel boyut + + '*' yaz ;; 42 = '*'
+ yoksa
+ eş bel boyut + + ' ' yaz ;; 32 = ' '
+ yap
+ 1 +
+ yap
+ bel boyut + + '\n' yaz ;; 10 '\n'
+ ;; write to screen
+ print-buffer
+
+ ;; pattern init
+ bel 0 + oku 1 << bel 1 + oku |
+ 1 döngü eş boyut 1 - < iken
+ eş bel 1 + + oku ;; (pattern i cell)
+ rot 1 << 7 & | ;; (i new-pattern)
+ üst bel + üst 110 değiş >> 1 & yaz
+ değiş 1 +
+ yap düş düş
+ 1 +
+yap
+