Tested compillation

This commit is contained in:
Antoine Bartuccio 2016-12-13 15:12:55 +01:00
parent 3a91f0655a
commit a91ea8a682
3 changed files with 17 additions and 12 deletions

View File

@ -5,7 +5,7 @@
#include <list.h>
/*---Matrix---
*Abstract type that describe a boolean matrix
*Abstract type that describe a boolean matrix
*
*@colCount : the number of columns of the matrix
*@rowIndex : the number of rows of the matrix
@ -38,4 +38,4 @@ typedef struct Matrix {
Matrix applyRules (Matrix matrix,int Rules, int N);
#endif

View File

@ -1,22 +1,23 @@
#include <stdio.h>
#include <stdlib.h>
#include <Matrix.h>
#include <CellElement.h>
#include <matrix.h>
Matrix applyRules (Matrix matrix,int Rules, int N){
int pow = 2;
int power = 2;
int i = 0;
if (Rules <= 0){
return matrix;
} else {
while (Rules%pow == 0 ){
pow*=2;
while (Rules%power == 0 ){
power*=2;
}
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*/
}
applyRules(matrix,Rules - Rules%pow,N);
}
applyRules(matrix,Rules - Rules%power,N);
}
return matrix;
}

8
main.c
View File

@ -8,13 +8,17 @@
#include <stdio.h>
#include <stdlib.h>
#include <Matrix.h>
#include <matrix.h>
int main(int argc, char **argv){
Matrix matrix;
matrix.cols = CreateList();
matrix.rows = CreateList();
matrix.colCount = matrix.cols->size;
matrix.rowCount= matrix.rows->size;
int Rule = 170;
int N = 1;
applyRules (matrix,Rule,N);
applyRules(matrix,Rule,N);
/*
Matrix matrix;
cellElement * tree = NULL;