gol

Implementation of Conway's Game of Life writen in C
git clone git://git.dimitrijedobrota.com/gol.git
Log | Files | Refs | README

logic.h (1036B)


      1 /**
      2  * @file logic.h
      3  * @author Mateja Marsenic
      4  * @date 30 May 2022
      5  * @brief This file contains functions and structures for logic.
      6  */
      7 
      8 #ifndef LOGIC_H
      9 #define LOGIC_H
     10 
     11 #include "uthash.h"
     12 
     13 /**
     14  * @brief structure that stores cells coordinates to use as a key in a hash
     15  * map-uh;
     16  */
     17 typedef struct Cell_cord {
     18   int row;
     19   int col;
     20 } Cell_cord;
     21 
     22 /**
     23  * @brief sructure that stores a cell using hash map;
     24  */
     25 typedef struct Cell {
     26   Cell_cord      cord;
     27   unsigned char  val;
     28   UT_hash_handle hh;
     29 } Cell;
     30 
     31 extern Cell *hash;
     32 
     33 extern char *evolution_names[];
     34 extern int   evolution_cells[];
     35 extern int   evolution_size, evolve_index;
     36 
     37 extern int pos_y, pos_x;
     38 
     39 extern Cell **save_cells;
     40 extern int    save_cells_s;
     41 
     42 int  logic_init(int isWrapping, int index);
     43 int  evolution_init(int index);
     44 void do_evolution(int steps);
     45 int  logic_free(void);
     46 int  toggleAt(int i, int j);
     47 int  getAt(int i, int j);
     48 void deleteAt(int i, int j);
     49 void saveCell(int i, int j);
     50 void setPosition(int i, int j);
     51 void setAt(int i, int j, int val);
     52 
     53 #endif