Skip to content
Snippets Groups Projects
cli.c 656 B
Newer Older
clemo's avatar
clemo committed

#include "./gol.h"
#include <stdio.h>
#include <unistd.h>
const unsigned int ROUNDS = 10;
void print_colmn(unsigned int value)
{
	printf("%d", value);
}
void print_row(unsigned int line)
{
	printf("\n");
}

int main(int argc, char **argv)
{
	int width = 30;
	int height = 10;
	gol_t *game = gol_setup(width, height);

	game->current[0] = 23;
	game->current[1] = 51;
	game->current[2] = 1271;
	game->current[5] = 51;
	unsigned int round = 0;
	while (1)
	{
		printf("round: %d \n", round++);
		gol_each(game, &print_colmn, &print_row);
		gol_tick(game);
		printf("\033[%dA", height + 1);
		printf("\033[%dD", width);
		usleep(200000);
	}
	gol_free(game);
}