Here’s a challenge for you, Jow Forums.
Write a solver for Hanoi towers, knowing there will be exactly 5 disks on it.
PLOT TWIST (dun, dun, dun): Recursivity is not allowed.
Go.
Here’s a challenge for you, Jow Forums.
Write a solver for Hanoi towers, knowing there will be exactly 5 disks on it.
PLOT TWIST (dun, dun, dun): Recursivity is not allowed.
Go.
Do your own homework
require 'hanoi_solver'
HanoiSolver.solve(ARGV)
Do your own homework, jamal
just make the AI do it lmao
>use tail recursion in c++
>clang optimizes it away
>submit assembly
wow that was hard
while not solved:
move random disk to random peg
Go back to Vietnam and solve your own goddamn towers you commie
>iOS filename
fuck off
The trick is to use a stack
ezpz
#!/usr/bin/python
from PIL import Image
hanoi = Image.open('1549334993918.gif')
solution = hanoi.transpose(Image.FLIP_LEFT_RIGHT)
solution.save('solved.gif')
>there will be exactly 5 disks on it
so close
My solver is generalized and works for any number of disks
top kek
> 2^n - 1 steps
> paltry 5 disks
nigger just hardcode that shit
int main(void)
{
int n, x;
printf( "How many disks? " );
scanf( "%d", &n );
puts( "\n\n" );
for (x=1; x < (1
Hanoi with tail rec. Wanna see that.
>recursivity is not allowed
you cant use the easiest, most efficient, and most maintainable solution because... uhhhhh... i said so
no thanks, ill just get a job somewhere that isnt run by retards
here is
Use stack, negro
Interesting, gonna test that.
hanoitower.mkolar.org
web.archive.org
Note that the generalized one doesn't use recursion.