1
0
mirror of https://gitlab.com/klmp200/LO27.git synced 2024-11-05 11:28:03 +00:00
LO27/LibAutomaton/matrix.c
2016-12-13 17:28:13 +01:00

33 lines
603 B
C

#include <stdio.h>
#include <stdlib.h>
#include <CellElement.h>
#include <matrix.h>
Matrix applyRules (Matrix matrix,int Rules, int N){
int power = 2;
int i = 0;
if (Rules <= 0){
return matrix;
} else {
while (Rules%power == 0 ){
power*=2;
}
for (i=0;i<N;i++){
printf("Apply rule %d \n",Rules%power);
/*Replace it by the implementation of the rules*/
}
applyRules(matrix,Rules - Rules%power,N);
}
return matrix;
}
Matrix CreateMatrix(){
Matrix matrix;
matrix.colCount = 0;
matrix.rowCount = 0;
matrix.cols = CreateList();
matrix.rows = CreateList();
return matrix;
}