diff --git a/days/day12.st b/days/day12.st index 486cefd..7216c94 100644 --- a/days/day12.st +++ b/days/day12.st @@ -27,8 +27,7 @@ Object subclass: UnionFind [ mergeInto: parent [ root := parent. - parent addSize: size. - size := 0 ] + parent addSize: size. ] ] UnionFind subclass: Region [ @@ -72,7 +71,7 @@ Object subclass: GardenPlot [ combineAt: pos [ | plant region | plant := plantGrid at: pos. - region := regionGrid at: pos. + region := (regionGrid at: pos) find. dirs with: dirsRot1 do: [ :off :off2 | | offPos oPlant same1 same2 same12 | offPos := pos + off. @@ -83,11 +82,11 @@ Object subclass: GardenPlot [ same1 ifTrue: [ region := region union: (regionGrid at: offPos) ] - ifFalse: [ region find addPerimeter: 1 ]. + ifFalse: [ region addPerimeter: 1 ]. - ((same1 not & same2 not "outer corner") | - (same1 & same2 & same12 not "inner corner")) - ifTrue: [ region find addCorners: 1 ] + ((same1 not and: [same2 not] "outer corner") or: + [same1 and: [same2 and: [same12 not]] "inner corner"]) + ifTrue: [ region addCorners: 1 ] ] ] diff --git a/run.sh b/run.sh index 94e408e..6a38449 100755 --- a/run.sh +++ b/run.sh @@ -25,8 +25,8 @@ fi export AOC_VIS="$DIR/vis/day$DAYP" export AOC_RUN -if [ -z "$AOC_RUN" ] ; then - AOC_RUN=1 -fi +if [ -z "$AOC_RUN" ] ; then AOC_RUN=1; fi -exec gst --emacs-mode -g "days/utils.st" $AOC_EXTRA_FILES "days/day$DAYP.st" < "$AOC_INPUT" +if [ -z "$GST" ] ; then GST=gst ; fi + +exec $GST --emacs-mode -g "days/utils.st" $AOC_EXTRA_FILES "days/day$DAYP.st" < "$AOC_INPUT"