Created
December 3, 2020 09:30
-
-
Save lucasreta/851826d84362a3b2a89a3f0a3bc594de to your computer and use it in GitHub Desktop.
reduced version of cligol's main.c file for medium article
This file contains hidden or 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 "headers/config.h" | |
#include "headers/custom_string.h" | |
void compute (int neighbors[BOARD_HEIGHT][BOARD_WIDTH], int board[BOARD_HEIGHT][BOARD_WIDTH]); | |
void randomize (int board[BOARD_HEIGHT][BOARD_WIDTH]); | |
void clear () { printf ("\033[H\033[J"); } | |
void show (int board[BOARD_HEIGHT][BOARD_WIDTH]); | |
void move (int board[BOARD_HEIGHT][BOARD_WIDTH]); | |
void display_loop (struct t_board *board, int controllable); | |
void file_write (int board[BOARD_HEIGHT][BOARD_WIDTH]); | |
struct t_board file_read_or_create (); | |
int main (int c, char **v) | |
{ | |
struct t_board board = file_read_or_create (); | |
int display = (c > 1) ? atoi (v[1]) : 0; | |
int controllable = (c > 2) ? atoi (v[2]) : 0; | |
if (display != 1) | |
{ | |
move (board.grid); | |
} | |
else | |
{ | |
display_loop (&board, controllable); | |
} | |
file_write (board.grid); | |
return 0; | |
} | |
// +100 lines of function implementations... |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment