p2
This commit is contained in:
@@ -80,6 +80,25 @@ func main() {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if lines[y][x] == 'A' {
|
||||
if y >= 1 && y < h-1 && x >= 1 && x < w-1 {
|
||||
check := string([]byte{lines[y-1][x-1], lines[y-1][x+1], lines[y+1][x-1], lines[y+1][x+1]})
|
||||
if check == "MSMS" {
|
||||
p2++
|
||||
}
|
||||
if check == "SMSM" {
|
||||
p2++
|
||||
}
|
||||
if check == "MMSS" {
|
||||
p2++
|
||||
}
|
||||
if check == "SSMM" {
|
||||
p2++
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user