Skip to content

Commit

Permalink
Year 2022, Days 8+13+15+16
Browse files Browse the repository at this point in the history
Removed unused variables
  • Loading branch information
uvg committed Dec 2, 2023
1 parent 57dec9c commit d04436c
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 8 deletions.
2 changes: 0 additions & 2 deletions src/AOC2022/Day08.cls
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ ClassMethod Part1(verbose = 0) As %String [ Private ]
set answer="",line="",width=$length(recordsArr(1)),height=$order(recordsArr(""),-1),counter=0
for {
set line=$order(recordsArr(line)) quit:line=""
set record=recordsArr(line)
if (line=1)||(line=height) {
set counter=counter+width
continue
Expand Down Expand Up @@ -72,7 +71,6 @@ ClassMethod Part2(verbose = 0) As %String [ Private ]
if (line=1)||(line=height) {
continue
}
set record=recordsArr(line)
for x=2:1:width-1 {
set scenicScore=..GetScenicScore(.recordsArr,x,line,width,height,verbose)
set:scenicScore>maxScenicScore maxScenicScore=scenicScore
Expand Down
4 changes: 2 additions & 2 deletions src/AOC2022/Day13.cls
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ ClassMethod IsList(string)
ClassMethod GetListSize(string As %String) As %Integer
{
if '$length(string) quit 0
set size=0,squares=0,manip=$extract(string,2,*-1),pos=1
set size=0,manip=$extract(string,2,*-1),pos=1
for {
quit:pos>$length(manip)
if $extract(manip,pos)'="[" {
Expand Down Expand Up @@ -102,7 +102,7 @@ ClassMethod GetListSize(string As %String) As %Integer
ClassMethod GetElement(string As %String, elemId As %Integer) As %String
{
if '$length(string) quit ""
set size=0,squares=0,manip=$extract(string,2,*-1),pos=1
set size=0,manip=$extract(string,2,*-1),pos=1
for {
quit:pos>$length(manip)
if $extract(manip,pos)'="[" {
Expand Down
4 changes: 2 additions & 2 deletions src/AOC2022/Day15.cls
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ ClassMethod Part1(verbose = 0) As %String [ Private ]
}
do ..GridDisplay(.grid)
}
set sensor="",counter=0,left=maxX,right=minX
set sensor="",counter=0
for {
set sensor=$order(sensorArr(sensor)) quit:sensor=""
//set sensorArr($increment(sensorArr))=$listbuild(sensorY,sensorX,beaconY,beaconX,dist)
Expand Down Expand Up @@ -162,7 +162,7 @@ ClassMethod Part2(verbose = 0) As %String [ Private ]
quit:answer
}
*/
set sensor="",found=0,findSize=$select(test:20,1:4000000)
set sensor="",findSize=$select(test:20,1:4000000)
for {
set sensor=$order(sensorArr(sensor)) quit:sensor=""
set data=sensorArr(sensor)
Expand Down
4 changes: 2 additions & 2 deletions src/AOC2022/Day16.cls
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ ClassMethod FindShortestPathPriorityQueue(ByRef arr, from As %String, steps As %
//arr(from)=$listbuild(rate,to)
if maxsteps,steps>maxsteps quit 999999
kill ^||Queue,^||cachedArr
set ^||Queue(0,$increment(^||Queue))=$listbuild(steps,path,$list(arr(from),1),"",from),maxFlow=0,maxPath="",best=0,lastbest=best
set ^||Queue(0,$increment(^||Queue))=$listbuild(steps,path,$list(arr(from),1),"",from),maxFlow=0,best=0,lastbest=best

for {
//write !!!! zwrite ^||Queue //hang 1
Expand Down Expand Up @@ -184,7 +184,7 @@ ClassMethod FindShortestPathPriorityQueue2(ByRef arr, from As %String, elephant
//arr(from)==$listbuild(rate,to)
if maxsteps,steps>maxsteps quit 999999
kill ^||Queue,^||cachedArr
set ^||Queue(0,$increment(^||Queue))=$listbuild(steps,path,$list(arr(from),1),"",from,elephant,""),maxFlow=0,maxPath="",best=0,lastbest=best
set ^||Queue(0,$increment(^||Queue))=$listbuild(steps,path,$list(arr(from),1),"",from,elephant,""),maxFlow=0,best=0,lastbest=best

for {
//write !!!! zwrite ^||Queue //hang 1
Expand Down

0 comments on commit d04436c

Please sign in to comment.