commit e706ba4767d695b0d1670c2dec6f21cb437d9f95 Author: CrispyPin Date: Thu May 2 11:28:03 2024 +0200 implement game of life diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..adb36c8 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +*.exe \ No newline at end of file diff --git a/main.odin b/main.odin new file mode 100644 index 0000000..3e4d05e --- /dev/null +++ b/main.odin @@ -0,0 +1,85 @@ +package main + +import "core:fmt" +import "core:os" +import "core:strings" + +WIDTH :: 32 +HEIGHT :: 32 +AREA :: WIDTH * HEIGHT + +main :: proc() { + fmt.println("hellope") + board : [AREA]bool = --- + + // board[0] = true + // board[1] = true + // board[WIDTH] = true + // for x in 4..<14 { + // board[x + WIDTH*8] = true + // } + for { + print_board(&board) + bytes := 0 + err : os.Errno + buf : [3]byte + for { + bytes, err = os.read(os.stdin, buf[:]) + if bytes > 0 do break + } + update_board(&board) + } +} + +print_board :: proc(state: ^[AREA]bool){ + fmt.println(strings.repeat("-", WIDTH)) + for y := 0; y < HEIGHT; y += 2{ + for x in 0.. 2) + // fmt.println("count %v, state %v", count, new_cell) + new_state[x + y * WIDTH] = new_cell + } + } + for i in 0..