mirror of
https://gitlab.com/klmp200/LO27.git
synced 2024-11-05 06:38:03 +00:00
Merge branch 'NaejBranch' into 'master'
fait les fx de merde demandées See merge request !21
This commit is contained in:
commit
4dae911316
@ -35,10 +35,7 @@ Matrix applyRules (Matrix matrix,int Rules, int N){
|
||||
tempMatrix2 = matrixFromRules(tempMatrix1,i, RulesMatrix);
|
||||
freeMatrix(tempMatrix1);
|
||||
|
||||
tempMatrix1.colCount = tempMatrix2.colCount;
|
||||
tempMatrix1.rowCount = tempMatrix2.rowCount;
|
||||
tempMatrix1.cols = tempMatrix2.cols;
|
||||
tempMatrix1.rows = tempMatrix2.rows;
|
||||
tempMatrix1 = tempMatrix2;
|
||||
}
|
||||
|
||||
return tempMatrix1;
|
||||
@ -621,10 +618,81 @@ bool * GetFromRules(Matrix m, int ColPos, int RowPos, int n, int rules[]){
|
||||
|
||||
}
|
||||
|
||||
bool isMatrixEmpty(Matrix matrix){
|
||||
if (matrix.colCount < 1 || matrix.rowCount < 1){
|
||||
return true;
|
||||
}
|
||||
if (matrix.cols->size == 0 || matrix.rows->size == 0){
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool isMatrixSquare(Matrix matrix){
|
||||
if (matrix.colCount == matrix.rowCount){
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool isColumnEmpty(Matrix matrix,int nb){
|
||||
ListElement * Col = NULL;
|
||||
|
||||
if (matrix.colCount < 1 || matrix.rowCount < 1){
|
||||
return true;
|
||||
}
|
||||
if (matrix.cols->size == 0 || matrix.rows->size == 0){
|
||||
return true;
|
||||
}
|
||||
|
||||
Col = GetElementPos(matrix.cols,nb);
|
||||
if (Col == NULL || Col->data == NULL){
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool isRowEmpty(Matrix matrix,int nb){
|
||||
ListElement * Row = NULL;
|
||||
|
||||
if (matrix.colCount < 1 || matrix.rowCount < 1){
|
||||
return true;
|
||||
}
|
||||
if (matrix.cols->size == 0 || matrix.rows->size == 0){
|
||||
return true;
|
||||
}
|
||||
Row = GetElementPos(matrix.rows,nb);
|
||||
if (Row == NULL || Row->data == NULL){
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool equalsMatrix(Matrix m1, Matrix m2){
|
||||
int i = 0;
|
||||
int j = 0;
|
||||
|
||||
if (m1.colCount == m2.colCount && m1.rowCount == m2.rowCount){
|
||||
for (i=0;i<m2.colCount;i++){
|
||||
for (j=0;j<m1.rowCount;j++){
|
||||
if (GetCellValue(m1,i,j)!=GetCellValue(m2,i,j)){
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}else{
|
||||
|
||||
return false;
|
||||
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/* todos :
|
||||
*mulMatrix
|
||||
*
|
||||
*chasser les bugs
|
||||
*faire les fontions débiles qui restent
|
||||
*ecrire doc
|
||||
*faire un print + opti pour que sli l'adapte avec sdl
|
||||
*/
|
||||
|
@ -340,8 +340,26 @@ bool bottom_rightRule(Matrix m, int ColPos, int RowPos);
|
||||
*/
|
||||
bool * GetFromRules(Matrix m, int ColPos, int RowPos, int n, int rules[]);
|
||||
|
||||
/*---applyRules---
|
||||
*A function tha allows you to apply some rules n times on the matrix and returns it
|
||||
*
|
||||
*@matrix : A matrix on whitch you would apply the rules
|
||||
*
|
||||
*@Rules : Integer describing the rules
|
||||
*
|
||||
*@N : number of time the rules will be applied
|
||||
*
|
||||
*/
|
||||
Matrix applyRules(Matrix matrix,int Rules, int N);
|
||||
|
||||
Matrix sumMatrix(Matrix matrix1,Matrix matrix2);
|
||||
Matrix mulMatrix(Matrix matrix1,Matrix matrix2);
|
||||
bool isMatrixEmpty(Matrix matrix);
|
||||
bool isMatrixSquare(Matrix matrix);
|
||||
bool isColumnEmpty(Matrix matrix,int nb);
|
||||
bool isRowEmpty(Matrix matrix,int nb);
|
||||
bool equalsMatrix(Matrix m1, Matrix m2);
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user