1
0
mirror of https://gitlab.com/klmp200/LO27.git synced 2024-07-03 08:38:01 +00:00
LO27/LibAutomaton/matrix.c
2016-12-13 15:12:55 +01:00

24 lines
443 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;
}