Day 12 some cleanup
This commit is contained in:
parent
01a2490bc1
commit
e4a0a46036
2 changed files with 10 additions and 11 deletions
|
|
@ -27,8 +27,7 @@ Object subclass: UnionFind [
|
||||||
|
|
||||||
mergeInto: parent
|
mergeInto: parent
|
||||||
[ root := parent.
|
[ root := parent.
|
||||||
parent addSize: size.
|
parent addSize: size. ]
|
||||||
size := 0 ]
|
|
||||||
]
|
]
|
||||||
|
|
||||||
UnionFind subclass: Region [
|
UnionFind subclass: Region [
|
||||||
|
|
@ -72,7 +71,7 @@ Object subclass: GardenPlot [
|
||||||
combineAt: pos
|
combineAt: pos
|
||||||
[ | plant region |
|
[ | plant region |
|
||||||
plant := plantGrid at: pos.
|
plant := plantGrid at: pos.
|
||||||
region := regionGrid at: pos.
|
region := (regionGrid at: pos) find.
|
||||||
dirs with: dirsRot1 do: [
|
dirs with: dirsRot1 do: [
|
||||||
:off :off2 | | offPos oPlant same1 same2 same12 |
|
:off :off2 | | offPos oPlant same1 same2 same12 |
|
||||||
offPos := pos + off.
|
offPos := pos + off.
|
||||||
|
|
@ -83,11 +82,11 @@ Object subclass: GardenPlot [
|
||||||
|
|
||||||
same1
|
same1
|
||||||
ifTrue: [ region := region union: (regionGrid at: offPos) ]
|
ifTrue: [ region := region union: (regionGrid at: offPos) ]
|
||||||
ifFalse: [ region find addPerimeter: 1 ].
|
ifFalse: [ region addPerimeter: 1 ].
|
||||||
|
|
||||||
((same1 not & same2 not "outer corner") |
|
((same1 not and: [same2 not] "outer corner") or:
|
||||||
(same1 & same2 & same12 not "inner corner"))
|
[same1 and: [same2 and: [same12 not]] "inner corner"])
|
||||||
ifTrue: [ region find addCorners: 1 ]
|
ifTrue: [ region addCorners: 1 ]
|
||||||
]
|
]
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
|
||||||
8
run.sh
8
run.sh
|
|
@ -25,8 +25,8 @@ fi
|
||||||
export AOC_VIS="$DIR/vis/day$DAYP"
|
export AOC_VIS="$DIR/vis/day$DAYP"
|
||||||
|
|
||||||
export AOC_RUN
|
export AOC_RUN
|
||||||
if [ -z "$AOC_RUN" ] ; then
|
if [ -z "$AOC_RUN" ] ; then AOC_RUN=1; fi
|
||||||
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"
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue