mirror of
https://gitlab.com/klmp200/LO27.git
synced 2024-11-22 09:53:19 +00:00
Fin
This commit is contained in:
parent
cc955328c6
commit
af11bb9d09
@ -688,4 +688,4 @@ void createSquare(Matrix matrix){
|
||||
setRowToTrue(matrix,matrix.rowCount*3/4);
|
||||
setColToTrue(matrix,matrix.colCount/4);
|
||||
setColToTrue(matrix,matrix.colCount*3/4);
|
||||
}
|
||||
}
|
||||
|
53
report.md
53
report.md
@ -19,6 +19,8 @@ We decided to create two different library. One for the graphical interface (whi
|
||||
|
||||
Every function and data type are described in the documentation given with the project. This documentation is generated with doxygen.
|
||||
|
||||
\newpage
|
||||
|
||||
# Algorithmic
|
||||
|
||||
The most interesting function are *getCellValue* and *setCellValue*. Those are the one we rely on the most. They are our way of dealing with our complex data structure allowing us to avoid to store false values. They are the functions that need the more computational power on the long run but are really useful due to their level of abstraction and their high level.
|
||||
@ -255,17 +257,11 @@ END
|
||||
|
||||
Functions *andColSequenceOnMatrix* and *orColSequenceOnMatrix* are implemented with *colSequenceOnMatrix* and are really not interesting so we're gonna provide the algorithm of the last one :
|
||||
|
||||
```C
|
||||
|
||||
```
|
||||
|
||||
This is the same thing for *andRowSequenceOnMatrix* and *orRowSequenceOnMatrix* :
|
||||
|
||||
```C
|
||||
colSequenceOnMatrix(m:Matrix, operator:(function(bool, bool):bool)): Matrix
|
||||
BEGIN
|
||||
a:integer
|
||||
b:integer
|
||||
a:bool
|
||||
b:bool
|
||||
i:integer
|
||||
j:integer
|
||||
newM:Matrix <- createMatrix()
|
||||
@ -275,10 +271,10 @@ BEGIN
|
||||
colCount(newM) <- 0
|
||||
colSequenceOnMatrix <- newM
|
||||
endif
|
||||
colCount(newM) <- colCount(m) - 1
|
||||
colCount(newM) <- value(colCount(m)) - 1
|
||||
|
||||
for i from 0 to colCount(m) - 2 do
|
||||
for j from 0 to rowCount(m) - 2 do
|
||||
for i from 0 to value(colCount(m)) - 2 do
|
||||
for j from 0 to value(rowCount(m)) - 2 do
|
||||
a <- getCellValue(m, i, j)
|
||||
b <- getCellValue(m, i + 1, j)
|
||||
if operator(a, b) then
|
||||
@ -290,6 +286,38 @@ BEGIN
|
||||
END
|
||||
```
|
||||
|
||||
This is the same thing for *andRowSequenceOnMatrix* and *orRowSequenceOnMatrix* :
|
||||
|
||||
```C
|
||||
rowSequenceOnMatrix(m:Matrix, operator:(function(bool, bool):bool)): Matrix
|
||||
BEGIN
|
||||
a:bool
|
||||
b:bool
|
||||
i:integer
|
||||
j:integer
|
||||
newM:Matrix <- createMatrix()
|
||||
|
||||
colCount(newM) <- value(colCount(m))
|
||||
if value(rowCount(m)) <= 1 then
|
||||
rowCount(newM) <- 0
|
||||
rowSequenceOnMatrix <- newM
|
||||
endif
|
||||
rowCount(newM) <- value(rowCount(m)) - 1
|
||||
|
||||
for i from 0 to value(rowCount(m)) - 1 do
|
||||
for j from 0 to value(colCount(m)) - 1 do
|
||||
a <- getCellValue(m, i, j)
|
||||
b <- getCellValue=(m, i, j + 1)
|
||||
if operator(a, b) then
|
||||
setCellValue(newM, i, j, true)
|
||||
endif
|
||||
endfor
|
||||
endfor
|
||||
|
||||
rowSequenceOnMatrix <- newM
|
||||
END
|
||||
```
|
||||
|
||||
Here are the algorithm of the function *applyRules* and all the one related to it :
|
||||
|
||||
```C
|
||||
@ -396,8 +424,11 @@ BEGIN
|
||||
endfor
|
||||
|
||||
getFromRules <- bools
|
||||
END
|
||||
```
|
||||
|
||||
\newpage
|
||||
|
||||
# Conclusion
|
||||
|
||||
As we said before, we decided to not store false values in our matrix. So, by default, all values are set to false and every time we created a new matrix, we only used setCellValue for true values.
|
||||
|
Loading…
Reference in New Issue
Block a user