refactor: just moving code here and there
This commit is contained in:
@@ -7,21 +7,16 @@ import (
|
||||
"strings"
|
||||
)
|
||||
|
||||
func init() {
|
||||
registry.Register("2015D6", ParseInput, PartOne, PartTwo)
|
||||
}
|
||||
|
||||
func ParseInput(filepath string) []string {
|
||||
content, _ := os.ReadFile(filepath)
|
||||
return strings.Split(strings.TrimSpace(string(content)), "\n")
|
||||
}
|
||||
|
||||
type instruction struct {
|
||||
operation string
|
||||
x1, y1 int
|
||||
x2, y2 int
|
||||
}
|
||||
|
||||
func init() {
|
||||
registry.Register("2015D6", ParseInput, PartOne, PartTwo)
|
||||
}
|
||||
|
||||
func parseInstruction(line string) (instruction, bool) {
|
||||
var op string
|
||||
var remaining string
|
||||
@@ -52,6 +47,11 @@ func parseInstruction(line string) (instruction, bool) {
|
||||
return instruction{operation: op, x1: x1, y1: y1, x2: x2, y2: y2}, true
|
||||
}
|
||||
|
||||
func ParseInput(filepath string) []string {
|
||||
content, _ := os.ReadFile(filepath)
|
||||
return strings.Split(strings.TrimSpace(string(content)), "\n")
|
||||
}
|
||||
|
||||
func PartOne(data []string) int {
|
||||
grid := make([]bool, 1000*1000)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user