-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrun.go
49 lines (44 loc) · 1007 Bytes
/
run.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
package main
import (
"bufio"
"fmt"
"os"
)
func read_file(txt_file_name string) *bufio.Scanner {
readFile, err := os.Open(txt_file_name)
if err != nil {
fmt.Println(err)
}
fileScanner := bufio.NewScanner(readFile)
return fileScanner
}
func place_text_into_array(file *bufio.Scanner) []string {
file.Split(bufio.ScanLines)
result := []string{}
for file.Scan() {
text := file.Text()
result = append(result, text)
}
return result
}
func main() {
switch os.Args[1] {
case "day1":
find_digits_in_lines()
fmt.Print("\n")
find_anything_in_lines()
case "day2":
determine_players()
fmt.Print("\n")
determine_least_amount_of_cubes()
case "day3":
fileScanner := read_file("day_three_input.txt")
text := place_text_into_array(fileScanner)
everything := determine_part_and_symbol_placements(text)
determine_if_a_real_part(everything)
case "day4":
fileScanner := read_file("day_four_input.txt")
text := place_text_into_array(fileScanner)
find_the_winners(text)
}
}