From e8bc03c2a6d718fdf42640cc3587a790a56dc026 Mon Sep 17 00:00:00 2001 From: Daniel Aberger Date: Thu, 2 Dec 2021 15:36:10 +0100 Subject: [PATCH] 2nd: small refactor of variables --- pkg/two/two.go | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/pkg/two/two.go b/pkg/two/two.go index 5366ada..9066c0d 100644 --- a/pkg/two/two.go +++ b/pkg/two/two.go @@ -9,10 +9,6 @@ import ( "strings" ) -var depth int -var horizontalPosition int -var aim int - func Run() { commands := readInput() fmt.Printf("1st final position: %d\n", solve(commands, false)) @@ -20,9 +16,9 @@ func Run() { } func solve(commands []string, alt bool) int { - depth = 0 - horizontalPosition = 0 - aim = 0 + depth := 0 + horizontalPosition := 0 + aim := 0 for _, v := range commands { command := strings.Split(v, " ")