I hate code

This commit is contained in:
Nico 2020-12-09 17:25:32 +00:00
parent 3098f26734
commit a3a27299b6
1 changed files with 4 additions and 1 deletions

View File

@ -3,6 +3,7 @@ package main
import ( import (
"fmt" "fmt"
"io/ioutil" "io/ioutil"
"sort"
"strconv" "strconv"
"strings" "strings"
) )
@ -38,7 +39,7 @@ func main() {
} }
} }
if has == false { if has == false {
fmt.Println("Part 1: ", bad) fmt.Println("Part 1:", bad)
break break
done = true done = true
} }
@ -60,7 +61,9 @@ func main() {
total += digit total += digit
} }
if total == bad { if total == bad {
sort.Ints(sl) // a bad bodge
fmt.Printf("Part 2: %d\n", sl[0]+sl[len(sl)-1:][0]) fmt.Printf("Part 2: %d\n", sl[0]+sl[len(sl)-1:][0])
fmt.Println(sl)
return return
} }
} }