mirror of
https://gitlab.com/klmp200/LO27.git
synced 2024-11-05 10:48:03 +00:00
23 lines
413 B
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;
|
||
|
}
|