1
1
(ns y2022.d19
2
2
(:require [advent-of-code-clj.utils :refer [sum]]
3
- [clojure.string :as str])
4
- (:import (java.util ArrayDeque)))
3
+ [clojure.string :as str]))
5
4
6
5
(def test-data " Blueprint 1: Each ore robot costs 4 ore. Each clay robot costs 2 ore. Each obsidian robot costs 3 ore and 14 clay. Each geode robot costs 2 ore and 7 obsidian.
7
6
Blueprint 2: Each ore robot costs 2 ore. Each clay robot costs 3 ore. Each obsidian robot costs 3 ore and 8 clay. Each geode robot costs 3 ore and 12 obsidian." )
@@ -27,15 +26,15 @@ Blueprint 2: Each ore robot costs 2 ore. Each clay robot costs 3 ore. Each obsid
27
26
(map parse-blueprint (str/split-lines data)))
28
27
29
28
(defn build-ore-bot [{{ore-cost :ore } :ore-bot :keys [max-ore-cost]}
30
- [ore clay obsidian geode obot :as st]]
29
+ [ore _clay _obsidian _geode obot :as st]]
31
30
(when (and (> max-ore-cost obot)
32
31
(>= ore ore-cost))
33
32
(-> st
34
33
(update 0 - ore-cost)
35
34
(update 4 inc))))
36
35
37
36
(defn build-clay-bot [{{ore-cost :ore } :clay-bot :keys [max-clay-cost]}
38
- [ore clay obsidian geode obot cbot :as st]]
37
+ [ore _clay _obsidian _geode _obot cbot :as st]]
39
38
(when (and (> max-clay-cost cbot)
40
39
(>= ore ore-cost))
41
40
(-> st
@@ -53,15 +52,15 @@ Blueprint 2: Each ore robot costs 2 ore. Each clay robot costs 3 ore. Each obsid
53
52
(update 6 inc))))
54
53
55
54
(defn build-geode-bot [{{ore-cost :ore obsidian-cost :obsidian } :geode-bot }
56
- [ore clay obsidian :as st]]
55
+ [ore _clay obsidian :as st]]
57
56
(when (and (>= ore ore-cost)
58
57
(>= obsidian obsidian-cost))
59
58
(-> st
60
59
(update 0 - ore-cost)
61
60
(update 2 - obsidian-cost)
62
61
(update 7 inc))))
63
62
64
- (defn heuristic [blueprint [ore clay obsidian geode orebot claybot obsidianbot geodebot]]
63
+ (defn heuristic [blueprint [_ore _clay _obsidian _geode orebot claybot obsidianbot geodebot]]
65
64
(float (+ geodebot
66
65
(/ (+ geodebot
67
66
(/ (+ (/ orebot (-> blueprint :geode-bot :ore ))
0 commit comments