Skip to content

Commit 685e9a1

Browse files
committed
chore(2020-22/angch): Minimal cleanup
1 parent bf2287b commit 685e9a1

1 file changed

Lines changed: 6 additions & 14 deletions

File tree

2020-22/angch/main.go

Lines changed: 6 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,6 @@ import (
1212
type Hands map[int][]int
1313

1414
func (h *Hands) Hash() string {
15-
// m, err := json.Marshal(*h)
16-
17-
// if err != nil {
18-
// log.Fatal(err)
19-
// }
20-
// k := md5.Sum(m)
2115
j := md5.New()
2216
for _, v := range (*h)[1] {
2317
j.Write([]byte{byte(v)})
@@ -76,27 +70,23 @@ a:
7670
} else {
7771
hands[2] = append(hands[2], top[2], top[1])
7872
}
79-
log.Println(hands)
73+
// log.Println(hands)
8074
}
8175

82-
log.Println(hands)
83-
for _, v := range hands {
76+
for k, v := range hands {
8477
if len(v) == 0 {
8578
continue
8679
}
80+
log.Println("Winner", k, hands)
8781

8882
for k2, v2 := range v {
8983
ret1 += v2 * (len(v) - k2)
90-
log.Println(v2, (len(v) - k2))
9184
}
9285
}
93-
// ret1 = count
94-
9586
return ret1, ret2
9687
}
9788

9889
var debug = false
99-
10090
var history2 = map[string]int{}
10191

10292
func subgame(hands Hands, round int, game int) (int, Hands) {
@@ -224,13 +214,15 @@ func do2(fileName string) (ret1 int, ret2 int) {
224214
}
225215
}
226216
// ret1 = count
217+
// log.Println(history2)
218+
ret2 = len(history2)
227219

228220
return ret1, ret2
229221
}
230222

231223
func main() {
232224
// log.Println(do("test.txt"))
233225
// log.Println(do2("test.txt"))
234-
// log.Println(do("input.txt"))
226+
log.Println(do("input.txt"))
235227
log.Println(do2("input.txt"))
236228
}

0 commit comments

Comments
 (0)