This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
rem Conways Game of Life | |
rem Rules: | |
rem 1. Any live cell with fewer than two live neighbours dies, as if by underpopulation. | |
rem 2. Any live cell with two or three live neighbours lives on to the next generation. | |
rem 3. Any live cell with more than three live neighbours dies, as if by overpopulation. | |
rem 4. Any dead cell with exactly three live neighbours becomes a live cell, as if by reproduction. | |
rem sets the console title | |
system("title Conways Game of Life!") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
include "random.min" | |
rem Instance of one game of conways game of life | |
record cell_batch { | |
matrix | |
epoch | |
rem initializes an instance with a specified number of cells and rows | |
proc init (rows, cols) { | |
set this.epoch to 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdlib.h> | |
typedef struct fenwick_tree{ | |
int* elems; //stores the elements of the input array | |
int *sums; //stores the "sum" of the array at a certain index | |
} fenwick_tree_t; | |
//Note sum because it's not a "hard" sum that stretches from index 0 to n, but rather from n's "parent" to n. | |
//inserts item and updates the sums accordingly | |
void fenwick_tree_insert(fenwick_tree_t* fenwick_tree, int elem, int i){ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <ctype.h> | |
#include <math.h> | |
#include <stdio.h> | |
#include <stdlib.h> | |
#include <string.h> | |
typedef struct _nhp_array_char _nhp_array_char_t; | |
typedef struct _nhp_array__nhp_anonProcTypeNo0 _nhp_array__nhp_anonProcTypeNo0_t; | |
typedef struct _nhp_array__nhp_array_char _nhp_array__nhp_array_char_t; | |
typedef struct _nhp_enum_operand__ _nhp_enum_operand___t; |