Stair-climbing puzzle: Difference between revisions
Content added Content deleted
(Fixed Prolog to match requirements) |
Thundergnat (talk | contribs) (Rename Perl 6 -> Raku, alphabetize, minor clean-up) |
||
Line 170:
step_up()
}</lang>
=={{header|AWK}}==
<lang AWK>
Line 215 ⟶ 216:
}
}
}</lang>▼
=={{header|C sharp|C#}}==▼
<lang csharp>void step_up() {▼
while (!step()) step_up();▼
}</lang>
Line 227 ⟶ 233:
{
for (int i = 0; i < 1; step()? ++i : --i);
▲}</lang>
▲=={{header|C sharp|C#}}==
▲<lang csharp>void step_up() {
▲ while (!step()) step_up();
}</lang>
Line 274 ⟶ 275:
)
true))</lang>
=={{header|Common Lisp}}==
<lang lisp>(defun step-up ()
Line 852 ⟶ 854:
=={{header|Perl}}==
<lang perl>sub step_up { step_up until step; }</lang>
=={{header|Perl 6}}==▼
<lang perl6>sub step_up { step_up until step; }</lang>▼
=={{header|Phix}}==
Line 1,080 ⟶ 1,079:
(step-up 1)</lang>
(formerly Perl 6)
▲<lang perl6>sub step_up { step_up until step; }</lang>
=={{header|REBOL}}==
Line 1,152 ⟶ 1,155:
func stp
return 0
</lang>▼
=={{header|Run BASIC}}==▼
<lang runbasic>▼
result = stepUp()▼
Function stepUp()▼
While Not(stepp())▼
result = stepUp()▼
Wend▼
End Function▼
Function stepp()▼
stepp = int((Rnd(1) * 2))▼
print "Robot stepped "+word$("up down",stepp+1)▼
End Function▼
</lang>
Line 1,204 ⟶ 1,191:
"rise (0)"
"rise (1)"</pre>
▲=={{header|Run BASIC}}==
▲<lang runbasic>
▲result = stepUp()
▲Function stepUp()
▲ While Not(stepp())
▲ result = stepUp()
▲ Wend
▲End Function
▲Function stepp()
▲ stepp = int((Rnd(1) * 2))
▲ print "Robot stepped "+word$("up down",stepp+1)
▲End Function
▲</lang>
=={{header|SAS}}==
Line 1,279 ⟶ 1,282:
(cond ((zero? n-steps) 'done)
((step) (step-up (- n-steps 1)))
(else (step-up (+ n-steps 1)))))</lang>
=={{header|Seed7}}==
|