Hello,
I try to solve a adventofcode challenge where I must find out when santa
is first at the basement. the floor is there -1.
So I thought I use a while loop like this :
santaFloorOnBasement
"calculates which step take Santa to the basement"
| index|
index := 1.
??? when: (floor >=0 ) do:
[ floor := (input at: index = '(' )
ifTrue: [ floor + 1 ]
ifFalse: [ floor - 1 ].
index := index + 1 ].
but I cannot find out what must be instead of the ??
index is the index of the string which has to start with a 1.
floor and input are both instance variables. floor contains the current
floor and input the input of the challenge.
Can someone help me figure this out so the next time I can do this on my
own.
Roelof