mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
tools: format most examples and tutorials, add them to v test-cleancode
(#9826)
This commit is contained in:
@ -79,15 +79,11 @@ pub fn (mut aa Automaton) update() {
|
||||
for y := 1; y < aa.field.maxy; y++ {
|
||||
for x := 1; x < aa.field.maxx; x++ {
|
||||
moore_sum := (0 + aa.field.get(x - 1, y - 1) + aa.field.get(x, y - 1) + aa.field.get(x +
|
||||
1, y - 1) + aa.field.get(x - 1, y) + 0 + aa.field.get(x + 1, y) + aa.field.get(x - 1, y + 1) +
|
||||
aa.field.get(x, y + 1) + aa.field.get(x + 1, y + 1))
|
||||
1, y - 1) + aa.field.get(x - 1, y) + 0 + aa.field.get(x + 1, y) +
|
||||
aa.field.get(x - 1, y + 1) + aa.field.get(x, y + 1) + aa.field.get(x + 1, y + 1))
|
||||
cell := aa.field.get(x, y)
|
||||
v := if cell == 1 { moore_sum in [2, 3] } else { moore_sum == 3 }
|
||||
aa.new_field.set(x, y, if v {
|
||||
1
|
||||
} else {
|
||||
0
|
||||
})
|
||||
aa.new_field.set(x, y, if v { 1 } else { 0 })
|
||||
}
|
||||
}
|
||||
tmp := aa.field
|
||||
|
Reference in New Issue
Block a user