day23: track games in set, not vector

master
Clyne 3 years ago
parent 7bf455637f
commit 6dda086d5c

@ -74,7 +74,7 @@
nil])) nil]))
(defn do-turns [fields] (defn do-turns [fields]
(into [] (into #{}
(r/fold (r/fold
r/cat r/cat
#(if-let [t (apply do-slot %2)] #(if-let [t (apply do-slot %2)]
@ -92,7 +92,7 @@
(do (do
(println "Splitting...") (println "Splitting...")
(doseq [p (partition 50000 turns)] (doseq [p (partition 50000 turns)]
(play-games (into [] p) tc))) (play-games (into #{} p) tc)))
(do (do
(let [new-turns (do-turns turns) (let [new-turns (do-turns turns)
winners (filter winner? new-turns)] winners (filter winner? new-turns)]
@ -106,6 +106,6 @@
(defn -main (defn -main
"I don't do a whole lot ... yet." "I don't do a whole lot ... yet."
[& args] [& args]
(play-games [[init-field 0]] 0) (play-games #{[init-field 0]} 0)
(println (first (sort @wins)))) (println (first (sort @wins))))

Loading…
Cancel
Save