added new examples

This commit is contained in:
2024-08-22 00:24:19 +03:00
parent 4367febcd7
commit 4c8409da35
10 changed files with 203 additions and 6 deletions

View File

@@ -0,0 +1,23 @@
#include <stdio.h>
#define BOARD_CAP 100
static int board[BOARD_CAP];
int main()
{
board[BOARD_CAP - 2] = 1;
for (size_t i = 0; i < BOARD_CAP - 2; ++i) {
for (size_t j = 0; j < BOARD_CAP; ++j) {
fputc(" *"[board[j]], stdout);
}
fputc('\n', stdout);
int pattern = (board[0] << 1) | board[1];
for (size_t j = 1; j < BOARD_CAP - 1; ++j) {
pattern = ((pattern << 1) & 7) | board[j + 1];
board[j] = (110 >> pattern) & 1;
}
}
return 0;
}

View File

@@ -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