1
0
mirror of https://github.com/Tha14/toxic.git synced 2025-07-04 17:16:46 +02:00

Implement Conway's Game of Life

This commit is contained in:
jfreegman
2021-06-01 23:00:00 -04:00
parent c293fbe0c7
commit 5e67571908
8 changed files with 659 additions and 7 deletions

View File

@ -29,6 +29,7 @@
#include "game_centipede.h"
#include "game_base.h"
#include "game_chess.h"
#include "game_life.h"
#include "game_snake.h"
#include "line_info.h"
#include "misc_tools.h"
@ -77,6 +78,7 @@ struct GameList {
static struct GameList game_list[] = {
{ "centipede", GT_Centipede },
{ "chess", GT_Chess },
{ "life", GT_Life },
{ "snake", GT_Snake },
{ NULL, GT_Invalid },
};
@ -213,6 +215,11 @@ static int game_initialize_type(GameData *game, const uint8_t *data, size_t leng
break;
}
case GT_Life: {
ret = life_initialize(game);
break;
}
default: {
break;
}
@ -980,6 +987,11 @@ void game_update_score(GameData *game, long int points)
}
}
void game_set_score(GameData *game, long int val)
{
game->score = val;
}
long int game_get_score(const GameData *game)
{
return game->score;