diff --git a/src/AOC2022/Day08.cls b/src/AOC2022/Day08.cls index e430cc8..5afb339 100644 --- a/src/AOC2022/Day08.cls +++ b/src/AOC2022/Day08.cls @@ -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 @@ -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 diff --git a/src/AOC2022/Day13.cls b/src/AOC2022/Day13.cls index 87ec92c..26b6ee3 100644 --- a/src/AOC2022/Day13.cls +++ b/src/AOC2022/Day13.cls @@ -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)'="[" { @@ -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)'="[" { diff --git a/src/AOC2022/Day15.cls b/src/AOC2022/Day15.cls index ba0a5f7..43ce6a1 100644 --- a/src/AOC2022/Day15.cls +++ b/src/AOC2022/Day15.cls @@ -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) @@ -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) diff --git a/src/AOC2022/Day16.cls b/src/AOC2022/Day16.cls index 6d23314..ed99830 100644 --- a/src/AOC2022/Day16.cls +++ b/src/AOC2022/Day16.cls @@ -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 @@ -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