#include <string.h>
#include <stdio.h>
#include <time.h>
#include <stdlib.h>
#include <unistd.h>
#include <math.h>
#include <switch.h>
|
#define | CONFIG_FILE "nxcgol.config.txt" |
| config file
|
|
#define | ROWS 46 |
| total rows
|
|
#define | COLS 81 |
| t
|
|
#define | HISTORY_SIZE 8 |
| retain x generations for comparison
|
|
#define | CELL 0xDB |
| solid block cp437
|
|
#define | UP 0x18 |
| up arrow cp437
|
|
#define | DOWN 0x19 |
| down arrow cp437
|
|
#define | ERROR_RED CONSOLE_ESC(31m) |
|
#define | CONTROLS_BLUE CONSOLE_ESC(38;2;135;206;235m) |
|
#define | RESET CONSOLE_ESC(0m) |
|
#define | CONSOLE_ESC_NSTR(fmt) "\033[" fmt |
| console escape helper, does not stringify.
|
|
|
bool | parse_rgb (const char *value, Color *color) |
| parse r,g,b string into Color
|
|
void | parse_config_file (Config *config) |
| parse configuration file
|
|
int | sim_speed_calc (int percent) |
| calculate simulation speed based on percentage at 100(%) the usleep time will be 1ms at 1(%) the usleep time will be 100ms
|
|
void | color_to_ansi (Color *c) |
| convert r,g,c from Color to ansi escape sequence
|
|
int | active_rows () |
| if show_stats is true we decrement 1 from rows to make room for stats we do this when iterating through the rows
|
|
int | count_neighbors (int x, int y) |
| get the neighbors of this cell
|
|
void | randomize_matrix () |
| generate cells for new colony
|
|
void | restart_simulation () |
| reset history, generation_index and increment restart_index, generate new colony.
|
|
int | main (int argc, char **argv) |
|
◆ CELL
◆ COLS
◆ CONFIG_FILE
#define CONFIG_FILE "nxcgol.config.txt" |
◆ CONSOLE_ESC_NSTR
#define CONSOLE_ESC_NSTR |
( |
|
fmt | ) |
"\033[" fmt |
console escape helper, does not stringify.
◆ CONTROLS_BLUE
#define CONTROLS_BLUE CONSOLE_ESC(38;2;135;206;235m) |
◆ DOWN
◆ ERROR_RED
#define ERROR_RED CONSOLE_ESC(31m) |
◆ HISTORY_SIZE
retain x generations for comparison
◆ RESET
#define RESET CONSOLE_ESC(0m) |
◆ ROWS
◆ UP