mirror of
https://gitlab.com/klmp200/LO27.git
synced 2024-11-26 17:44:15 +00:00
Tested compillation
This commit is contained in:
parent
3a91f0655a
commit
a91ea8a682
@ -1,22 +1,23 @@
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <Matrix.h>
|
#include <CellElement.h>
|
||||||
|
#include <matrix.h>
|
||||||
|
|
||||||
Matrix applyRules (Matrix matrix,int Rules, int N){
|
Matrix applyRules (Matrix matrix,int Rules, int N){
|
||||||
int pow = 2;
|
int power = 2;
|
||||||
int i = 0;
|
int i = 0;
|
||||||
if (Rules <= 0){
|
if (Rules <= 0){
|
||||||
return matrix;
|
return matrix;
|
||||||
} else {
|
} else {
|
||||||
while (Rules%pow == 0 ){
|
while (Rules%power == 0 ){
|
||||||
pow*=2;
|
power*=2;
|
||||||
}
|
}
|
||||||
for (i=0;i<N;i++){
|
for (i=0;i<N;i++){
|
||||||
printf("Apply rule %d \n",Rules%pow);
|
printf("Apply rule %d \n",Rules%power);
|
||||||
/*Replace it by the implementation of the rules*/
|
/*Replace it by the implementation of the rules*/
|
||||||
}
|
}
|
||||||
|
|
||||||
applyRules(matrix,Rules - Rules%pow,N);
|
applyRules(matrix,Rules - Rules%power,N);
|
||||||
}
|
}
|
||||||
return matrix;
|
return matrix;
|
||||||
}
|
}
|
||||||
|
8
main.c
8
main.c
@ -8,13 +8,17 @@
|
|||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <Matrix.h>
|
#include <matrix.h>
|
||||||
|
|
||||||
int main(int argc, char **argv){
|
int main(int argc, char **argv){
|
||||||
Matrix matrix;
|
Matrix matrix;
|
||||||
|
matrix.cols = CreateList();
|
||||||
|
matrix.rows = CreateList();
|
||||||
|
matrix.colCount = matrix.cols->size;
|
||||||
|
matrix.rowCount= matrix.rows->size;
|
||||||
int Rule = 170;
|
int Rule = 170;
|
||||||
int N = 1;
|
int N = 1;
|
||||||
applyRules (matrix,Rule,N);
|
applyRules(matrix,Rule,N);
|
||||||
/*
|
/*
|
||||||
Matrix matrix;
|
Matrix matrix;
|
||||||
cellElement * tree = NULL;
|
cellElement * tree = NULL;
|
||||||
|
Loading…
Reference in New Issue
Block a user