Skip to content

Commit

Permalink
Update walk.go
Browse files Browse the repository at this point in the history
post decrement
  • Loading branch information
neurlang committed Jun 22, 2024
1 parent 4da3075 commit 44e0fa7
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions walk.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,41 +18,41 @@ func WalkVals[T Number](mat []T, width uint, to func(prev T, this T, x uint, y u
left := x - 1 + width*(y)
if diag >= 0 {
if mat[diag] < mat[left] && mat[diag] < mat[up] {
x--
y--
if to(mat[here], mat[diag], x, y) {
return
}
x--
y--
continue
}
}
if left >= 0 && up >= 0 {
if mat[up] < mat[left] {
y--
if to(mat[here], mat[up], x, y) {
return
}
y--
continue
} else {
x--
if to(mat[here], mat[left], x, y) {
return
}
x--
continue
}
}
if left >= 0 {
x--
if to(mat[here], mat[left], x, y) {
return
}
x--
continue
}
if up >= 0 {
y--
if to(mat[here], mat[up], x, y) {
return
}
y--
continue
}
}
Expand Down

0 comments on commit 44e0fa7

Please sign in to comment.