init, 2015 & 2016
This commit is contained in:
9
2016/internal/solutions/day01.go
Normal file
9
2016/internal/solutions/day01.go
Normal file
@@ -0,0 +1,9 @@
|
||||
package solutions
|
||||
|
||||
import "fmt"
|
||||
|
||||
func day01() {
|
||||
//in := utility.GetInput("input/test")
|
||||
//in := utility.GetInput("input/01")
|
||||
fmt.Println("01 is not implemented yet")
|
||||
}
|
||||
9
2016/internal/solutions/day02.go
Normal file
9
2016/internal/solutions/day02.go
Normal file
@@ -0,0 +1,9 @@
|
||||
package solutions
|
||||
|
||||
import "fmt"
|
||||
|
||||
func day02() {
|
||||
//in := utility.GetInput("input/test")
|
||||
//in := utility.GetInput("input/02")
|
||||
fmt.Println("02 is not implemented yet")
|
||||
}
|
||||
9
2016/internal/solutions/day03.go
Normal file
9
2016/internal/solutions/day03.go
Normal file
@@ -0,0 +1,9 @@
|
||||
package solutions
|
||||
|
||||
import "fmt"
|
||||
|
||||
func day03() {
|
||||
//in := utility.GetInput("input/test")
|
||||
//in := utility.GetInput("input/03")
|
||||
fmt.Println("03 is not implemented yet")
|
||||
}
|
||||
9
2016/internal/solutions/day04.go
Normal file
9
2016/internal/solutions/day04.go
Normal file
@@ -0,0 +1,9 @@
|
||||
package solutions
|
||||
|
||||
import "fmt"
|
||||
|
||||
func day04() {
|
||||
//in := utility.GetInput("input/test")
|
||||
//in := utility.GetInput("input/04")
|
||||
fmt.Println("04 is not implemented yet")
|
||||
}
|
||||
9
2016/internal/solutions/day05.go
Normal file
9
2016/internal/solutions/day05.go
Normal file
@@ -0,0 +1,9 @@
|
||||
package solutions
|
||||
|
||||
import "fmt"
|
||||
|
||||
func day05() {
|
||||
//in := utility.GetInput("input/test")
|
||||
//in := utility.GetInput("input/05")
|
||||
fmt.Println("05 is not implemented yet")
|
||||
}
|
||||
9
2016/internal/solutions/day06.go
Normal file
9
2016/internal/solutions/day06.go
Normal file
@@ -0,0 +1,9 @@
|
||||
package solutions
|
||||
|
||||
import "fmt"
|
||||
|
||||
func day06() {
|
||||
//in := utility.GetInput("input/test")
|
||||
//in := utility.GetInput("input/06")
|
||||
fmt.Println("06 is not implemented yet")
|
||||
}
|
||||
9
2016/internal/solutions/day07.go
Normal file
9
2016/internal/solutions/day07.go
Normal file
@@ -0,0 +1,9 @@
|
||||
package solutions
|
||||
|
||||
import "fmt"
|
||||
|
||||
func day07() {
|
||||
//in := utility.GetInput("input/test")
|
||||
//in := utility.GetInput("input/07")
|
||||
fmt.Println("07 is not implemented yet")
|
||||
}
|
||||
9
2016/internal/solutions/day08.go
Normal file
9
2016/internal/solutions/day08.go
Normal file
@@ -0,0 +1,9 @@
|
||||
package solutions
|
||||
|
||||
import "fmt"
|
||||
|
||||
func day08() {
|
||||
//in := utility.GetInput("input/test")
|
||||
//in := utility.GetInput("input/08")
|
||||
fmt.Println("08 is not implemented yet")
|
||||
}
|
||||
9
2016/internal/solutions/day09.go
Normal file
9
2016/internal/solutions/day09.go
Normal file
@@ -0,0 +1,9 @@
|
||||
package solutions
|
||||
|
||||
import "fmt"
|
||||
|
||||
func day09() {
|
||||
//in := utility.GetInput("input/test")
|
||||
//in := utility.GetInput("input/09")
|
||||
fmt.Println("09 is not implemented yet")
|
||||
}
|
||||
9
2016/internal/solutions/day10.go
Normal file
9
2016/internal/solutions/day10.go
Normal file
@@ -0,0 +1,9 @@
|
||||
package solutions
|
||||
|
||||
import "fmt"
|
||||
|
||||
func day10() {
|
||||
//in := utility.GetInput("input/test")
|
||||
//in := utility.GetInput("input/10")
|
||||
fmt.Println("10 is not implemented yet")
|
||||
}
|
||||
9
2016/internal/solutions/day11.go
Normal file
9
2016/internal/solutions/day11.go
Normal file
@@ -0,0 +1,9 @@
|
||||
package solutions
|
||||
|
||||
import "fmt"
|
||||
|
||||
func day11() {
|
||||
//in := utility.GetInput("input/test")
|
||||
//in := utility.GetInput("input/11")
|
||||
fmt.Println("11 is not implemented yet")
|
||||
}
|
||||
9
2016/internal/solutions/day12.go
Normal file
9
2016/internal/solutions/day12.go
Normal file
@@ -0,0 +1,9 @@
|
||||
package solutions
|
||||
|
||||
import "fmt"
|
||||
|
||||
func day12() {
|
||||
//in := utility.GetInput("input/test")
|
||||
//in := utility.GetInput("input/12")
|
||||
fmt.Println("12 is not implemented yet")
|
||||
}
|
||||
9
2016/internal/solutions/day13.go
Normal file
9
2016/internal/solutions/day13.go
Normal file
@@ -0,0 +1,9 @@
|
||||
package solutions
|
||||
|
||||
import "fmt"
|
||||
|
||||
func day13() {
|
||||
//in := utility.GetInput("input/test")
|
||||
//in := utility.GetInput("input/13")
|
||||
fmt.Println("13 is not implemented yet")
|
||||
}
|
||||
9
2016/internal/solutions/day14.go
Normal file
9
2016/internal/solutions/day14.go
Normal file
@@ -0,0 +1,9 @@
|
||||
package solutions
|
||||
|
||||
import "fmt"
|
||||
|
||||
func day14() {
|
||||
//in := utility.GetInput("input/test")
|
||||
//in := utility.GetInput("input/14")
|
||||
fmt.Println("14 is not implemented yet")
|
||||
}
|
||||
9
2016/internal/solutions/day15.go
Normal file
9
2016/internal/solutions/day15.go
Normal file
@@ -0,0 +1,9 @@
|
||||
package solutions
|
||||
|
||||
import "fmt"
|
||||
|
||||
func day15() {
|
||||
//in := utility.GetInput("input/test")
|
||||
//in := utility.GetInput("input/15")
|
||||
fmt.Println("15 is not implemented yet")
|
||||
}
|
||||
9
2016/internal/solutions/day16.go
Normal file
9
2016/internal/solutions/day16.go
Normal file
@@ -0,0 +1,9 @@
|
||||
package solutions
|
||||
|
||||
import "fmt"
|
||||
|
||||
func day16() {
|
||||
//in := utility.GetInput("input/test")
|
||||
//in := utility.GetInput("input/16")
|
||||
fmt.Println("16 is not implemented yet")
|
||||
}
|
||||
9
2016/internal/solutions/day17.go
Normal file
9
2016/internal/solutions/day17.go
Normal file
@@ -0,0 +1,9 @@
|
||||
package solutions
|
||||
|
||||
import "fmt"
|
||||
|
||||
func day17() {
|
||||
//in := utility.GetInput("input/test")
|
||||
//in := utility.GetInput("input/17")
|
||||
fmt.Println("17 is not implemented yet")
|
||||
}
|
||||
9
2016/internal/solutions/day18.go
Normal file
9
2016/internal/solutions/day18.go
Normal file
@@ -0,0 +1,9 @@
|
||||
package solutions
|
||||
|
||||
import "fmt"
|
||||
|
||||
func day18() {
|
||||
//in := utility.GetInput("input/test")
|
||||
//in := utility.GetInput("input/18")
|
||||
fmt.Println("18 is not implemented yet")
|
||||
}
|
||||
9
2016/internal/solutions/day19.go
Normal file
9
2016/internal/solutions/day19.go
Normal file
@@ -0,0 +1,9 @@
|
||||
package solutions
|
||||
|
||||
import "fmt"
|
||||
|
||||
func day19() {
|
||||
//in := utility.GetInput("input/test")
|
||||
//in := utility.GetInput("input/19")
|
||||
fmt.Println("19 is not implemented yet")
|
||||
}
|
||||
9
2016/internal/solutions/day20.go
Normal file
9
2016/internal/solutions/day20.go
Normal file
@@ -0,0 +1,9 @@
|
||||
package solutions
|
||||
|
||||
import "fmt"
|
||||
|
||||
func day20() {
|
||||
//in := utility.GetInput("input/test")
|
||||
//in := utility.GetInput("input/20")
|
||||
fmt.Println("20 is not implemented yet")
|
||||
}
|
||||
9
2016/internal/solutions/day21.go
Normal file
9
2016/internal/solutions/day21.go
Normal file
@@ -0,0 +1,9 @@
|
||||
package solutions
|
||||
|
||||
import "fmt"
|
||||
|
||||
func day21() {
|
||||
//in := utility.GetInput("input/test")
|
||||
//in := utility.GetInput("input/21")
|
||||
fmt.Println("21 is not implemented yet")
|
||||
}
|
||||
9
2016/internal/solutions/day22.go
Normal file
9
2016/internal/solutions/day22.go
Normal file
@@ -0,0 +1,9 @@
|
||||
package solutions
|
||||
|
||||
import "fmt"
|
||||
|
||||
func day22() {
|
||||
//in := utility.GetInput("input/test")
|
||||
//in := utility.GetInput("input/22")
|
||||
fmt.Println("22 is not implemented yet")
|
||||
}
|
||||
9
2016/internal/solutions/day23.go
Normal file
9
2016/internal/solutions/day23.go
Normal file
@@ -0,0 +1,9 @@
|
||||
package solutions
|
||||
|
||||
import "fmt"
|
||||
|
||||
func day23() {
|
||||
//in := utility.GetInput("input/test")
|
||||
//in := utility.GetInput("input/23")
|
||||
fmt.Println("23 is not implemented yet")
|
||||
}
|
||||
9
2016/internal/solutions/day24.go
Normal file
9
2016/internal/solutions/day24.go
Normal file
@@ -0,0 +1,9 @@
|
||||
package solutions
|
||||
|
||||
import "fmt"
|
||||
|
||||
func day24() {
|
||||
//in := utility.GetInput("input/test")
|
||||
//in := utility.GetInput("input/24")
|
||||
fmt.Println("24 is not implemented yet")
|
||||
}
|
||||
9
2016/internal/solutions/day25.go
Normal file
9
2016/internal/solutions/day25.go
Normal file
@@ -0,0 +1,9 @@
|
||||
package solutions
|
||||
|
||||
import "fmt"
|
||||
|
||||
func day25() {
|
||||
//in := utility.GetInput("input/test")
|
||||
//in := utility.GetInput("input/25")
|
||||
fmt.Println("25 is not implemented yet")
|
||||
}
|
||||
60
2016/internal/solutions/runner.go
Normal file
60
2016/internal/solutions/runner.go
Normal file
@@ -0,0 +1,60 @@
|
||||
package solutions
|
||||
|
||||
import "fmt"
|
||||
|
||||
func Run(day int) {
|
||||
switch day {
|
||||
case 1:
|
||||
day01()
|
||||
case 2:
|
||||
day02()
|
||||
case 3:
|
||||
day03()
|
||||
case 4:
|
||||
day04()
|
||||
case 5:
|
||||
day05()
|
||||
case 6:
|
||||
day06()
|
||||
case 7:
|
||||
day07()
|
||||
case 8:
|
||||
day08()
|
||||
case 9:
|
||||
day09()
|
||||
case 10:
|
||||
day10()
|
||||
case 11:
|
||||
day11()
|
||||
case 12:
|
||||
day12()
|
||||
case 13:
|
||||
day13()
|
||||
case 14:
|
||||
day14()
|
||||
case 15:
|
||||
day15()
|
||||
case 16:
|
||||
day16()
|
||||
case 17:
|
||||
day17()
|
||||
case 18:
|
||||
day18()
|
||||
case 19:
|
||||
day19()
|
||||
case 20:
|
||||
day20()
|
||||
case 21:
|
||||
day21()
|
||||
case 22:
|
||||
day22()
|
||||
case 23:
|
||||
day23()
|
||||
case 24:
|
||||
day24()
|
||||
case 25:
|
||||
day25()
|
||||
default:
|
||||
fmt.Println("Unknown day in 2015: ", day)
|
||||
}
|
||||
}
|
||||
29
2016/internal/utility/input.go
Normal file
29
2016/internal/utility/input.go
Normal file
@@ -0,0 +1,29 @@
|
||||
package utility
|
||||
|
||||
import (
|
||||
"os"
|
||||
"strconv"
|
||||
"strings"
|
||||
)
|
||||
|
||||
func GetInput(path string) string {
|
||||
data, err := os.ReadFile(path)
|
||||
Error(err)
|
||||
return string(data)
|
||||
}
|
||||
|
||||
func GetLines(path string) []string {
|
||||
data := GetInput(path)
|
||||
return strings.Split(data, "\n")
|
||||
}
|
||||
|
||||
func GetInts(path string) []int {
|
||||
data := GetLines(path)
|
||||
r := make([]int, len(data))
|
||||
for _, line := range data {
|
||||
t, err := strconv.Atoi(line)
|
||||
Error(err)
|
||||
r = append(r, t)
|
||||
}
|
||||
return r
|
||||
}
|
||||
35
2016/internal/utility/utility.go
Normal file
35
2016/internal/utility/utility.go
Normal file
@@ -0,0 +1,35 @@
|
||||
package utility
|
||||
|
||||
import (
|
||||
"crypto/md5"
|
||||
"encoding/hex"
|
||||
"log"
|
||||
)
|
||||
|
||||
func Error(err error) {
|
||||
if err != nil {
|
||||
log.Panic(err)
|
||||
}
|
||||
}
|
||||
|
||||
type Point struct {
|
||||
x int
|
||||
y int
|
||||
}
|
||||
|
||||
func NewPoint(x, y int) Point {
|
||||
return Point{x, y}
|
||||
}
|
||||
|
||||
func GetMD5Hash(in string) string {
|
||||
hash := md5.Sum([]byte(in))
|
||||
return hex.EncodeToString(hash[:])
|
||||
}
|
||||
|
||||
func RuneMap(in string) (m map[rune]int) {
|
||||
m = make(map[rune]int)
|
||||
for _, c := range in {
|
||||
m[c]++
|
||||
}
|
||||
return m
|
||||
}
|
||||
Reference in New Issue
Block a user