1
0
mirror of https://gitlab.com/klmp200/LO27.git synced 2024-06-29 07:48:02 +00:00
LO27/LibAutomaton/matrix.c

23 lines
413 B
C

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