2nd: small refactor of variables

This commit is contained in:
Daniel Aberger
2021-12-02 15:36:10 +01:00
parent 5a31176884
commit e8bc03c2a6
+3 -7
View File
@@ -9,10 +9,6 @@ import (
"strings" "strings"
) )
var depth int
var horizontalPosition int
var aim int
func Run() { func Run() {
commands := readInput() commands := readInput()
fmt.Printf("1st final position: %d\n", solve(commands, false)) fmt.Printf("1st final position: %d\n", solve(commands, false))
@@ -20,9 +16,9 @@ func Run() {
} }
func solve(commands []string, alt bool) int { func solve(commands []string, alt bool) int {
depth = 0 depth := 0
horizontalPosition = 0 horizontalPosition := 0
aim = 0 aim := 0
for _, v := range commands { for _, v := range commands {
command := strings.Split(v, " ") command := strings.Split(v, " ")