-
Notifications
You must be signed in to change notification settings - Fork 0
/
life.h
50 lines (38 loc) · 1.44 KB
/
life.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#ifndef LIFE_H
#include <stdint.h>
#define LIFE_H
#define SCREEN_HEIGHT (40)
#define SCREEN_WIDTH (100)
#define RIGHT_HALF_BLOCK "\xE2\x96\x90"
#define LEFT_HALF_BLOCK "\xE2\x96\x8C"
#define TOP_HALF_BLOCK "\xE2\x96\x80"
#define BOTTOM_HALF_BLOCK "\xE2\x96\x84"
#define SINGLE_TOP_LEFT "\xE2\x96\x98"
#define SINGLE_TOP_RIGHT "\xE2\x96\x9D"
#define SINGLE_BOTTOM_LEFT "\xE2\x96\x96"
#define SINGLE_BOTTOM_RIGHT "\xE2\x96\x97"
#define L_BLOCK "\xE2\x96\x99"
#define SEVEN_BLOCK "\xE2\x96\x9C"
#define P_BLOCK "\xE2\x96\x9B"
#define J_BLOCK "\xE2\x96\x9F"
#define EMPTY_BLOCK " "
#define FILLED_BLOCK "\xE2\x96\x88"
#define DIAGONAL_LR_BLOCK "\xE2\x96\x9A"
#define DIAGONAL_RL_BLOCK "\xE2\x96\x9E"
#define GLIDER_FLAG "--glider"
#define ACORN_FLAG "--acorn"
#define SQUARE_FLAG "--square"
void load_zeros(uint8_t** buffer);
void load_entities(int argc, char** argv, uint8_t** buffer);
void free_screen_buffer(uint8_t** buffer);
void create_glider(uint8_t** board, size_t x, size_t y);
void create_block(uint8_t** board, size_t x, size_t y);
void create_beehive(uint8_t** board, size_t x, size_t y);
void create_acorn(uint8_t** board, size_t x, size_t y);
void print_board_ascii(uint8_t** board);
void print_board(uint8_t** board);
void print_square(uint8_t bits);
void next_generation(uint8_t** old_board, uint8_t** new_board);
void next_cell(uint8_t** old_board, uint8_t** new_board, size_t x, size_t y);
void clear_screen();
#endif