mirror of
https://gitlab.com/klmp200/LO27.git
synced 2024-11-05 13:58:05 +00:00
24 lines
443 B
C
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;
|
|
}
|