From 11114c033735fc29ddc563de23d41682a6d101e3 Mon Sep 17 00:00:00 2001 From: Nat Lasseter Date: Mon, 25 Dec 2017 00:44:40 +0000 Subject: Day24 Part1 --- day24/part1 | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/day24/part1 b/day24/part1 index b608bae..223d117 100755 --- a/day24/part1 +++ b/day24/part1 @@ -43,18 +43,20 @@ class BridgeFactory end bfs = [BridgeFactory.new(input)] +maxs = 0 loop do new_bfs = [] bfs.each do |bf| if bf.complete? then - new_bfs << bf + s = bf.strength + maxs = s if s > maxs else new_bfs += bf.build_iter end end - break if new_bfs.map(&:complete?).all? + break if new_bfs.empty? bfs = new_bfs end -puts bfs.map(&:strength).max +puts maxs -- cgit v1.2.3