EVLTEZ7YUPWGTWGKWN63JJFRZOQJONODNY3DCCIQE46SOV5ULVCAC
RWF2LQ276C4M5W2CWIUZXAE3IG6W7WAFD36KJ3YWZDFKXJDXEEHQC
down = 323 right = 3 * down tree = '#'
down = 323
right = 3 * down
tree = '#'
mapDown = 323 tree = '#'
mapDown = 323
var slopeKind = []struct { name string right int down int}{ {"r1d1", 1, 1}, {"r3d1", 3, 1}, {"r5d1", 5, 1}, {"r7d1", 7, 1}, {"r1d2", 1, 2},}
var slopeKind = []struct {
name string
right int
down int
}{
{"r1d1", 1, 1},
{"r3d1", 3, 1},
{"r5d1", 5, 1},
{"r7d1", 7, 1},
{"r1d2", 1, 2},
}
m, err := createMap() if err != nil { return err
m, err := createMap()
if err != nil {
return err
for _, s := range slopeKind { m, err := createMap(s.right * mapDown) if err != nil { return err } log.Println(s.name, countTrees(m, s.right, s.down))
for _, s := range slopeKind {
m, err := createMap(s.right * mapDown)
log.Println(s.name, countTrees(m, s.right, s.down))
log.Println(countTrees(m))
func countTrees(m []string) int {
func countTrees(m []string, right, down int) int {
for _, line := range m { if line[col] == tree {
for _, line := range m {
if line[col] == tree {
for i := 0; i < len(m); i += down { if m[i][col] == tree {
for i := 0; i < len(m); i += down {
if m[i][col] == tree {
col += 3
col += right
func createMap() ([]string, error) {
func createMap(mapRight int) ([]string, error) {
for line.Len() < right {
for line.Len() < mapRight {
if len(ret) != down {
if len(ret) != mapDown {