Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit b71822e

Browse files
committed
Day 15 not done nor ever will be probably.
Im not doing some convoluted game simulation just for the sake of being convoluted. It is not fun nor challenging and has too many edge cases that will just burn me out.
1 parent c954f7f commit b71822e

File tree

2 files changed

+79
-0
lines changed

2 files changed

+79
-0
lines changed

‎2018/day15/fifteen.go‎

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
package main
2+
3+
import (
4+
"bufio"
5+
"fmt"
6+
"os"
7+
)
8+
9+
type Point struct {
10+
x int
11+
y int
12+
}
13+
14+
func main() {
15+
fmt.Println("Hi")
16+
area := createMap()
17+
fmt.Println(area)
18+
// Im not doing some convoluted game simulation for the sake of being convoluted.
19+
// It is not fun nor challenging and has too many edge cases that will just burn me out.
20+
}
21+
22+
func createMap() [][]rune {
23+
f, _ := os.Open("input.txt")
24+
scanner := bufio.NewScanner(f)
25+
area := [][]rune{}
26+
27+
for scanner.Scan() {
28+
line := scanner.Text()
29+
row := []rune{}
30+
for _, char := range line {
31+
row = append(row, char)
32+
}
33+
area = append(area, row)
34+
}
35+
return area
36+
}
37+
38+
func ManhattanDistance(p1, p2 Point) int {
39+
return abs(p1.x-p2.x) + abs(p1.y-p2.y)
40+
}
41+
42+
func abs(x int) int {
43+
if x < 0 {
44+
return -x
45+
}
46+
return x
47+
}

‎2018/day15/input.txt‎

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
################################
2+
##########################.#####
3+
##########################.#####
4+
##########################.#.###
5+
#######################......###
6+
#################....#........##
7+
##############.##....G......G.##
8+
#############..#G...##.........#
9+
#############.GG..G..##.......##
10+
#############.................##
11+
#############G.........G....#.##
12+
###########G..........E........#
13+
###########...#####............#
14+
###########..#######...........#
15+
#######.....#########........###
16+
#######....G#########.......####
17+
##...G.G....#########...#....###
18+
#...G..G...G#########.###E...###
19+
##.......#..#########.#####..E##
20+
#............#######..##########
21+
#.GG........G.#####...##########
22+
#................E.....#########
23+
########..........##.###########
24+
#########.....###.....##########
25+
##########.E..##......##########
26+
#######..#....###.E...##########
27+
######.........###.E############
28+
######.#..G....##..#############
29+
######.....##..##.E#############
30+
#######....##.E...E#############
31+
######....G#......##############
32+
################################

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /