Premiers algorithmes

This commit is contained in:
Antoine Bartuccio 2017-01-01 20:47:27 +01:00
parent 0d50d00a90
commit 7761f897c5
1 changed files with 25 additions and 0 deletions

View File

@ -36,7 +36,32 @@ Functions *andColSequenceOnMatrix* and *orColSequenceOnMatrix* are implemented w
This is the same thing for *andRowSequenceOnMatrix* and *orRowSequenceOnMatrix* :
```C
colSequenceOnMatrix(m:Matrix, operator:(function(bool, bool):bool)): Matrix
BEGIN
a:integer
b:integer
i:integer
j:integer
newM:Matrix <- createMatrix()
rowCount(newM) <- rowCount(m)
if (colCount(m) <= 1) then
colCount(newM) <- 0
colSequenceOnMatrix <- newM
endif
colCount(newM) <- colCount(m) - 1
for i from 0 to colCount(m) - 2, step 1
for j from 0 to rowCount(m) - 2, step 1
a <- getCellValue(m, i, j)
b <- getCellValue(m, i + 1, j)
if operator(a, b) then
setCellValue(newM, i, j, true)
endif
endfor
endfor
colSequenceOnMatrix <- newM;
END
```
Here are the algorithm of the function *applyRules* and all the one related to it :