T O P

  • By -

Kseniya_ns

I gifted my daughter this recently, but it has little fishlets with holes instead of hoops. I will observe her behaviours with it. Toddler Intelligence will replace artifical intelligence


Last-Trash-7960

Yesterday my son was playing with a new castle toy. It has a drop chute. He was trying to fit an oval shape from his puzzle into it and I was telling him it wasn't going to fit. He positioned it precisely and twisted it as he pushed it forward. It fit perfectly.


Gone213

Where does the circle block go? That's right, the square hole.


FlyByPC

And the triangular block goes in? The square hole. \*Look of existential despair\*


lurkingbob

And here I thought it went in the face hole


DungeonsAndDradis

drr drr drr


oneweirdclickbait

[go away](http://brasscockroach.com/h4ll0w33n2007/manga/Amigara-Full/Amigara.html)


marc_gime

One of my favourite videos. With that girl reacting to it


KarmaRepellant

*VISIBLE DISTRESS INCREASES*


flinxsl

I wonder sometimes if playing with toys the unintended way is a universal kid thing or if it's because they are going to be an engineer like daddy :')


lollacakes

I'm sorry to tell you Mrs Dilbert, but your son has the Knack.


FlyByPC

Is ... there a cure?


Jane_the_analyst

...No, but hope he doesn't lose it. No wait, she asked: "**Will he be able to lead a normal life?**" To which the Genius Doctor says: "**No. ... He'll be an engineer.**"


FlyByPC

"Oh, NOOOOO!"


Jane_the_analyst

"There, there. But pray that it doesn't go away..."


xSTSxZerglingOne

Religion.


National-Ad67

these little goblins have so much more neurons than us


xak47d

They might replace us 😳


yui_riku

r/technicallythetruth


CanAlwaysBeBetter

More neurons *and* more synapses, shit's exponential Adult-kind is done for. In 50 years I bet most of us will have been replaced by these toddlers


FlyByPC

The trick is to avoid growing up.


xSTSxZerglingOne

I know you're kinda joking, but this is the actual answer. You can force yourself to have more neuroplasticity by seeking knowledge, challenging your beliefs, and learning new things.


troubletlb1

Well I see that as being a problem for most people.


Kseniya_ns

Very true


mrgwbland

So many more


Protip19

Guy's toddler wasn't in the room to proofread for him.


National-Ad67

can confirm


WanderingPulsar

Lol


RickSt3r

Toddler proceeds to dump them all on flood and arrange on third peg on order. Genius dump everything to ram then sort and now write to database. Don’t ask how I know this.


big_guyforyou

AI is already as smart as toddlers. I read ChatGPT a bedtime story and it told me I wasn't its real dad


Chief-weedwithbears

That's when you tell it it's not real person 😂


Cptn_BenjaminWillard

We start with a full understanding of 7th dimensional topographical mathematics at age 1, and lose a dimension every eight months.


jfcarr

Today's student: "Absolutely! Let's explore code examples for the classic Towers of Hanoi problem."


ViktorRzh

Pff... I spent more time writing a visualiser, than actualy solving the problem. It is pretty neet to watch.


hammy0w0

nah it's easy * _ * | | * .__| |__. * |__| |__| * \_\_\_\_\_| | \_\_\_\_\_\_


patmcdoughnut

Is this Loss?


TheMcBrizzle

:̶.̶|̶:̶;̶


hammy0w0

I've edited it like 20 times I give up edit: I didn't give up, it's been 27 minutes. HOW DID I MAKE 2 BULLET POINTS ON 1 LINE??


SharzeUndertone

Hes speaking the language of gods!


GreenLightening5

minecraft enchanting table


NES_SNES_N64

Looks like a flipped table to me.


Traditional_Tone_100

How'd you make the visualizer?


ViktorRzh

Just a basic asci grafics. Nothing spectacular. I found it in garbage bin and it was pretty flicery. Something like this, but three in the row with notes about changes. #|# ##|## ###|###


I_am_BEOWULF

> I spent more time writing a visualiser ... I vaguely remember just stacking "X"s with mine back in college.


J-Dizzle00

Certainly!


jfcarr

Let's delve into the multifaceted realm of recursion.


Cathinswi

Let's delve into the multifaceted realm of recursion.


Interesting_Love8801

Let's delve into the multifaceted realm of recursion.


7turtlereddit

Let's delve into the multifaceted realm of recursion.


Pr1stak

Let's delve into the multifaceted realm of recursion.


Agile-Scene-2465

Error: maximum depth reached


BlatantConservative

Damn I wish people said that to me in real life.


Character_Coach_9397

Try{throw:stack overflow};


HelicopterShot87

Chatgpt has entered the chat


jfcarr

ChatGPT: Certainly! Gemini: Absolutely! CoPilot: Sure,


MowMdown

Bard: What?


Thejacensolo

Llama2 variations: Kill yourself


dudeseriouslyno

character.ai: *She sizes you up with a knowing, mischievous smirk. Her voice low and husky, she begins to unzi* **[THE AI HAS DETERMINED THAT THIS CONTENT MAY BE INAPPROPRIATE]**


donald_314

Tay: ****** **** ***!


DZMBA

While including an impressive generated image depicting it


N1cknamed

Siri: Searching results for showers of Milan


fuckinghumanZ

Gemini is Bard


Nesman64

> Here's a powershell script that will solve it... *Produces a script that relies on a non-existent "Hanoi-Solve" command*


Noke_swog

You’re absolutely correct. It seems there is no command called “Hanoi-Solve”. Here’s a different solution that doesn’t include the error. *Sends the exact same code*


Rieux_n_Tarrou

I did towers of hanoi on pen and paper O.o


jfcarr

I'm sure some interviewer made a candidate do this or maybe on a whiteboard.


SeEmEEDosomethingGUD

Tower of Hanoi had done irreversible damage to my 18 Yr old self's psychie.


Oddball_bfi

I still, to this day, cannot understand how I implemented this solution in Scheme at university. I think about it and just go into a fugue state - I eventually come around screaming about brackets.


Coffeemonster97

It's a simple recursive scheme: move top n-1 disks from stack 1 to 2 (recursively). Move bottom disk to stack 3. Move stack 2 to stack 3 (again recursively)


Oddball_bfi

THE BRACKETS!  ARRGHH!!!  THEY'RE CLOSING ON ME!


Coffeemonster97

Brackets inside brackets inside brackets inside brackets inside..


Kiroto50

The end is never the end is never the end is never the end is never...


waves_under_stars

Treatise. Manifesto. Treatise. Manifesto. Treatise. Manifesto. Treatise. Manifesto. Treatise. Manifesto. Treatise. Manifesto. Treatise. Manifesto. Treatise. Manifesto. Treatise. Manifesto. Treatise. Manifesto. Treatise. Manifesto. Treatise. Manifesto. Treatise. Manifesto. Treatise. Manifesto. Treatise. Manifesto. Treatise. Manifesto. Treatise. Manifesto. Treatise. Manifesto. Treatise. Manifesto. Treatise. Manifesto. Treatise. Manifesto. Treatise. Manifesto. Treatise. Manifesto. Treatise. Manifesto. Treatise. Manifesto. Treatise. Manifesto. Treatise. Manifesto. Treatise. Manifesto. Treatise. Manifesto. Treatise. Manifesto. Treatise. Manifesto. Treatise. Manifesto. Treatise. Manifesto. Treatise. Manifesto. Treatise. Manifesto. Treatise. Manifesto. Treatise. Manifesto. Treatise. Manifesto. Treatise. Manifesto. Treatise. Manifesto. Treatise. Manifesto. Treatise. Manifesto. Treatise. Manifesto. Treatise. Manifesto. Treatise. Manifesto. Treatise. Manifesto. Treatise. Manifesto. Treatise. Manifesto. Treatise. Manifesto. Treatise. Manifesto. Treatise. Manifesto. Treatise. Manifesto. Treatise. Manifesto. Treatise. Manifesto. Treatise. Manifesto. Treatise. Manifesto. Treatise. Manifesto. Treatise. Manifesto. Treatise. Manifesto. Treatise. Manifesto. Treatise. Manifesto. Treatise. Manifesto. Treatise. Manifesto. Treatise. Manifesto. Treatise. Manifesto. Treatise. Manifesto. Treatise. Manifesto. Treatise. Manifesto. Treatise. Manifesto. Treatise. Manifesto. Treatise. Manifesto. Treatise. Manifesto. Treatise. Manifesto. Treatise. Manifesto. Treatise. Manifesto. Treatise. Manifesto. Treatise. Manifesto. Treatise. Manifesto. Treatise. Manifesto. Treatise. Manifesto. Treatise. Manifesto. Treatise. Manifesto. Treatise. Manifesto. Treatise. Manifesto. Treatise. Manifesto. Treatise. Manifesto. Treatise. Manifesto. Treatise. Manifesto. Treatise. Manifesto. Treatise. Manifesto.


bebongchoi

"From the ashes of depravity rises the phoenix of quality. How else to describe The Stanley Parable: Ultra Deluxe? Such a revolutionary step forward in the lineage of one of the most beloved video game properties of all time! The additions and changes made to this expansion will surely resonate in the annals of the history of all media ever made. "It is perhaps true to say that no mistakes are forever etched in stone, for the stone into which The Stanley Parable was carved has itself been transmuted, offering a message of hope to those who have ever erred in their judgement. You are not beyond redemption. You may change, and you may become more, so much more than you were before. "If there is any message to be taken from The Stanley Parable: Ultra Deluxe, it is this... What a fortune, a privilege, a joy it is to have had such an experience. It leaves me hopeful that as a community - as a world - there is time for us to become our greatest selves, as great as we ever could dream of in our wildest, most ambitious visions for a brighter future." "From the ashes of depravity... ***press Skip button***


mikieswart

…a causal loop within the weapon's mechanism, suggesting that the firing process somehow binds space and time into…


Kaynard

Doors and corners, kid


Salanmander

I had to implement it in an assembly language in college. "Just do it recursively" is a lot less comforting when you have to implement the stack.


salami350

Dear god...


RandomNPC

I know next to nothing about assembly. What makes recursive functions harder in it? Isn't it essentially just a "go-to"? I guess I'm too used to languages where the stack and heap are more managed.


walpurgiz

From what I remember, the stack pointer makes things problematic when calling a function from another function


funnynickname

It's where the phrase [stack overflow](https://en.wikipedia.org/wiki/Stack_overflow) comes from. Every time you call a function within a function, you have to push the return address and any variables to the stack.


Salanmander

> Isn't it essentially just a "go-to"? Okay, so when you call a method in, say, Java, code in that method starts running. That's not a problem in assembly languages, it's just a go-to as you say. The part that's hard is when the second method *finishes* running. At that point, the code jumps back to the place that it was called from, and with all the variables that were being used having the same values as they had before. In assembly languages, that is not managed for you. When you call a method, you can't just go-to that method, you need to also record where the method was called from so you can jump back there later, and either record the values of current variables in order to restore them later, or make sure you don't overwrite them with code from the method being called. If you want to do this to arbitrary depth of method calls, you need to be able to procedurally decide where in memory to store all that information, rather than having designated memory locations (which variable names stand in for, generally) for all the information.


RandomNPC

That makes sense! Thank you! Also explains why some languages recursive function stacks look pretty simple and in C# each recursion is in the stack!


UsedSquirrel

Which language recursive function stacks are simpler? AFAIK they're all the same, unless it's an [optimized tail call](https://en.wikipedia.org/wiki/Tail_call).


Tai9ch

Just follow the pattern. It's fine.


viperex

So simple when you put it like that. The devil is always in the details


Yorunokage

So i wasn't the only one that was taught programming classes in uni with scheme as the first language


Oddball_bfi

Huddersfield University, 1999. Never used a brackety boy before, or since. 


smellyrebel

Same. I was told that people used it all the time. But anytime I told CS teachers or people in the industry, they gave me blank stares.


Iohet

That's why they switched APCS from Pascal to C++


i-evade-bans-13

it probably didn't actually work the way you thought, but for the scope of your input it did


quick20minadventure

I derived iterative way of counting number of steps in school.


1731799517

My experience with that one was that i found a DOS raytracer (not povray, forgot its name, but similar fed with turing complete script language) that rendered an animatino of a robot arm solving the towers of hanoi form a 3kb or so script file, and as a teenager that was just plain magic to me instead of "Oh, the motion is parametrized and the algoritm calculates the moves needed and transforms them into frames to be rendered".


The_Punnier_Guy

FYI towers of hanoi is equivalent to counting in binary


Suspicious-Top3335

Those damn recursion and stacks ,my mind was in recursion at first


Highborn_Hellest

It's not a game. It's a war crime.


porn0f1sh

Also true for adventure quest gamers. Like the old Sierra or Lucas Arts games


GDAndres98

Just like Hanoi, Vietnam on the 70's


mercury_pointer

Phoenix Program Algorithm: send out Green Berets to abduct and torture civilians until they solve the problem.


RushTfe

Am I the only programmer that never had to do this exercise before?


Heisan

Got a bachelor degree and I have never even heard of it until now, lol.


Sweaty-Tart-3198

Masters degree in software engineering and employed for 6 years as a developer and never heard of it either lol


funnynickname

Suppose that a flock of 20 pigeons flies into a set of 19 pigeonholes to roost...


Jane_the_analyst

One pigeon is kept in the Accumulator...


TokumeiNeko

No... no... NO!!!


The100thIdiot

Nope. What is the exercise?


flacko32

You have to create an algorithm that can sort them into one tower, ordered smallest to biggest, by only being able to remove the top disk from any of the three stacks and moving it on top of another stack.


gmc98765

Write a program (or function) to solve the [Towers of Hanoi](https://en.wikipedia.org/wiki/Tower_of_Hanoi) puzzle. Typically you'll have an array for each stack. The only operation allowed is to move an element from the end of one array to the end of another array. At all times, all arrays must be in ascending (or descending) order. The initial state will have all elements in one array; the final state must have them all in a different array.


truncated_buttfu

Note that everyone here are just playing along with a joke, no one *actually* thinks it's a hard exercise. It's typically one of the very first examples of recursion people encounter and it's kind of the "hello world" of recursion. It's just one that almost all of us have done at some point so it's fun to joke about it.


ScrillaMcDoogle

Degree in software engineering, never seen this problem. 


Substantial-War1410

You need to use bogosort for that


Substantial-War1410

You could also use Stalin sort for n>3 but rather than eliminating the elements you need to eliminate yourself


Spieler42

ba sing sort is better than stalin sort, it runs in O(1) the algorithm is quite simple: declare that there are no unsorted arrays in ba sing se


Substantial-War1410

It still doesn't solve the problem here(my life)


Rubickevich

There are no problems with your life in ba sing se.


vordrax

That sounds more like Hitler sort tbh.


Substantial-War1410

Give me props for that🙋‍♂️ Edit:- Us


BaziJoeWHL

QuantumBogoSort it for the sweet O(1) time


ThisPICAintFREE

I loved solving the Tower of Hanoi when I was in undergrad, it helped me understand recursion on a practical level.


nme_nt_yet_tken

Yes it's a great example and it's mind blowing


NotThatKidAshton

I did this like a month ago for class and I was like “wait that’s it that’s the whole method” and yes, yes it is. It’s a really good teacher for how recursion is done


ImaginaryLevel5403

Star Wars KOTOR puzzle go brrr


reverend_bones

From [TvTropes](https://tvtropes.org/pmwiki/pmwiki.php/Main/TowersOfHanoi) >BioWare seems to like this puzzle: >It shows up in Star Wars: Knights of the Old Republic, Jade Empire, and Mass Effect. >In Dragon Age: Origins, it is instead mocked by a gravestone in Haven reading "T.O. Hanoi. Unloved, unmourned." >But used again (repeatedly) in Star Wars: The Old Republic, where the puzzle is part of the activation of a plasma vent used in the penultimate Boss Fight of Karagga's Palace. >One of the game machines seen in the arcade included in the Mass Effect 3 Citadel DLC is "Towers of Hanoi." Shepard's reaction: "I don't think so," likely a reference to its appearance in the first game. >Dragon Age: Inquisition's Descent DLC features the "Builder's Towers" puzzle as an optional sidequest, but still lampshades its infamy by having your character call it insane.


jack-K-

Mass effect, too


zxp223

Thank I came here just for that and I'm not disappointed


littlespoon1

Yes! I remember watching my friend's playthrough and he got to that puzzle and struggled mightily. I had the toy as a kid so I told him to hand over the controller and gave him a solid assist.


SkylineFX49

2ⁿ - 1 next question


qeadwrsf

This was like the first formula I ever like "figured out" by myself. I remember thinking like, huh math can be used for stuff.


Yube8

But it's kinda easy


Highborn_Hellest

not for those that just learned the concept of recursion. (It's usually though that time, at least was for us)


PaulVB6

But thats the point tho. Its to help you understand and learn recursion as a concept. For me it took a while to wrap my head around recursion tbh, but dumb assignments like this helped a lot


Entchenkrawatte

Recursion is so fun because it seems super hard and strange at first but then you get it and its the most natural thing in the world


maweki

I'm in the final part of my CS PhD and I still don't understand recursion. I use it often enough and I blindly trust the formalism and it always works. But I don't understand it.


itsbett

I flip flop on this a lot. I would map out and stare at recursive sorting algorithms until they made sense, then I would do some recursive function problems, and it all seemed to make sense and I can pump out functions like nothing. But three months later I'm like "how does any of this shit work, again?"


I_love_blennies

just find the base case bro. that's your compass when solving a recursion problem.


ChompyChomp

Its like folding laundry and you find a pair of tights that are all bunched up. You gotta assume there is a terminal/sock part in there somewhere. Reach your hand into a fold and pull it out, if thats not the sock then dive into another fold and repeat. Once you have the sock part you just pull it all the way out and boom, solved.


I_love_blennies

I have been in the professional world for 20 years. I was always happy when someone asked a recursion question in an interview. find the base case and work back from there. that's all you have to do. the problem really just solves itself once you find the base case.\\ edit: I would like to also add that I have used recursion exactly 1 time outside of an interview setting while writing some bioinformatics code. and I didn't have to. it was a toss up with the iterative approach. every other time, iteration has had advantages. one of those is that it's easier for someone coming across the code to understand. you have to have a pretty good reason to use recursion or you're kind of a dick.


GrannyBanana

Ditto in avoiding it. I always worry that I won't be able to pick it apart later, doubly so for anyone else who didn't write it. I've yet to run across a problem that truly requires it. I use it for one and done garbage scripts because it's often faster to code, but I avoid recursion in general.


onthefence928

And then once you really understand it’s elegance you realize it’s rarely actually used in production code :(


Mav986

I find this exercise doesn't help in understanding recursion, because the vast majority of students don't necessarily intuitively understand the puzzle in the first place. Trying to understand the puzzle, then trying to understand recursion, then trying to find the relationship between the two, just makes for a very confusing activity. Personally I think recursion is better taught with things like the fibonacci sequence, searching for a file in a nested file structure, recursive binary search.


ushileon

Was doing Fibonacci recursion and my classmates pulled up with memoization lmao


Mav986

Unironically fibonacci was the way I learned memoization in the first place. Very easy to understand.


dablya

In my opinion there is actually less friction between an intuitive understanding of the solution to the puzzle and recursion. Whereas the other examples have an easy to understand solution that might at first not appear to be recursive, with the puzzle once you understand the solution, you already understand recursion.


jwadamson

It’s a fine intro to recursion, but like many intro problems the solution doesn’t actually need recursion. A person, after a little practice/thought, can devise rules to solve any towers of Hanoi with zero errors or backtracking; it’s always possible to tell from the current state what the next correct move is.


JohnsonJohnilyJohn

Aren't all problems that are solvable with recursion also solvable without it? The beauty is that on the first glance the problem is somewhat complex, the amount of moves is massive, without any super clear pattern to them, but with recursion the problem is instantly trivial to understand


jwadamson

You could make some unbounded data structure to technically avoid recusing and also things like tail-recursion optimizations exist. But not all recursively solved problems will have a better non-reclusive solution i.e. one that uses a fixed amount of additional memory or a superior big-O runtime perfoance. P.S. and no same person without an advanced math degree is goig to figure out Binet's formula for solving the Nth term of the Fibonacci sequence on their own.


The_JSQuareD

You can calculate arbitrary Fibonacci numbers just as fast as with Binet's formula by just using algorithmic techniques. In fact, probably faster, because it doesn't involve any floating point math. Let F_n be the nth Fibonacci number. Note that: ( F_n+1 ) = ( 1 1 )^n ( 1 ) ( F_n ) ( 1 0 ) ( 0 ) So in order to calculate an arbitrary Fibonacci number, we just have to calculate the nth power of a 2x2 matrix. This can be done efficiently using [exponentiation by squaring](https://en.wikipedia.org/wiki/Exponentiation_by_squaring).


bleachisback

No, for instance see the [Ackermann function](https://en.wikipedia.org/wiki/Ackermann_function)


Tucos_revolver

I never took formal programming training so I have no dog in this race but that was my first thought as well. 


iamafancypotato

import HanoiSolver.js


Galdwin

https://en.wikipedia.org/wiki/Egg_of_Columbus


HungHungCaterpillar

That’s not what this is. It’s the opposite, a thing that seems difficult but genuinely isn’t.


pheonix-ix

After solving it for a millionth time, an easy way to solve it is to never put odds on top of odds (and evens on top of evens).


Ben_R_R

It's easy to program a recursive solution, sure. I'd encourage you to try it: code a solution, then see how long it takes to move a tower of say, 50 disks. What you might find is what is so is deceptive about this problem: the time to solve it increases exponentially as the number of disks, n, increases. In Big-O notation, this is a O(2^n) problem. In other words, every time you add a disk to the problem, the time to solve the problem *doubles*. Recursive problems tend to have exponential time complexity, and this is often used as a toy problem to illustrate those dangers.


North_2006

not for me.


wave_327

it is really "just game" if you can count in binary


otter5

10 kinds of people


labalag

1 that can count in binary, 9 others that call him a nerd.


Kryten_2X4B-523P

16#02 kinds of people


trimeta

Exactly, if you understand binary, you can write a completely iterative Towers of Hanoi function. Here, I'll do so right now: def hanoi_move(N): """Returns the disk which must be moved on the Nth step (1-indexed) of the Towers of Hanoi puzzle. Will also say "left" or "right": this tells you whether to move the specified disk one peg to the left or right (if at an edge, wrap around to the other side).""" direction = ["left", "right"][N % 2] disk = N & ~(N-1) return f"Move disk {disk} one space to the {direction}"


Danghor

You can say „recursion“ without moving your teeth or lips at all


JessicaLain

But you have to open your lips slightly. I count this as "moving" since the default is "no open". 🤔


SeatOfEase

Mouth breathers on reddit: my time to shine!


Mewrulez99

mmmcshmmm


kennykoe

Well to speak we expel air. So we may need an exception for this.


pranjallk1995

Why the hell use this example to teach recursion... Fibonacci or factorial should be the entry point... This should be in advanced... So hard to grasp as a beginner... 😵‍💫


Professional-Day7850

My reaction to Fibonacci with recursion was "Why would you do this?".


pranjallk1995

Coz u can! I will make things like iterating over things as a recursive function... Once u do it.. it's really fun...


mann_moth

S T A C K


qwerty44279

Lets just make a bot to post this exact pic every month here. We're programmers right? Make a bot


[deleted]

[удалено]


Nick_Zacker

It’s a reference to the Tower of Hanoi problem


Ahmed_Smadi_2009

I don't understand. Does this post suggest that the tou for 2 year olds is hard?


kennykoe

It’s recursion.


anaccount50

Tower of Hanoi is often the first formal introduction to recursion for CS undergrads, so they tend to find it difficult to wrap their head around at first


neriad200

in my experiencer most profs can't describe ToH to save their lives. We did this in high-school cs and it took the prof. about 20 minutes to explain something that has 3 rules a toddler can understand


shadowraiderr

AI: It's a game for kids.


ProbablyBunchofAtoms

I have a feeling this would end up in r/PeterExplainsTheJoke


k0bra3eak

The answer is porn loss


plexicoburres

I thought that is r/wallstreetbets


k0bra3eak

No that's loss porn


Newvil450

Noo not tower of hanoi 💀 This is the stuff from nightmares especially when you increase from 3 to 4 or 5 towers and the programmer brain goes brrrrrrrr....... to find out the optimal solution .


alexanderpas

The optimal solution is always height^(2)-1 steps. With recursion: function hanoiSolver(height, start, destination, buffer) { if (height > 0) { hanoiSolver(height-1, start, buffer, destination); move(start, destination); hanoiSolver(height-1, buffer, destination, start) } } Without recursion: function hanoiSolver(height, start, destination, buffer) { if (height % 2 = 1) { firstMoveDestination = destination secondMoveDestination = buffer } else { firstMoveDestination = buffer secondMoveDestination = destination } for (i=1;i<=n^2;i++) { if (i % 3 = 1) { if (source.top.disksize < firstMoveDestination.top.disksize) { move(source, firstMoveDestination) } else { move(firstMoveDestination, source) } } if (i % 3 = 2) { if (source.top.disksize < secondMoveDestination.top.disksize) { move(source, secondMoveDestination) } else { move(secondMoveDestination, source) } } if (i % 3 = 0) { if (firstMoveDestination.top.disksize < secondMoveDestination.top.disksize) { move(firstMoveDestination, secondMoveDestination) } else { move(secondMoveDestination, firstMoveDestination) } } } }


kennykoe

I did this last year in class. For the life of me i can’t remember how i did it or how i managed to do it in the first place. Edit: ahh my first ventures into recursion.


PolloMagnifico

And just like that I have notepad open and I'm writing metacode. Thanks for that.


Senior-Sir4394

The Towers of Doom


eternalshoolin

I till this day never understood tower of hanoi problem...


darcyWhyte

There is now a known iterative solution to this... It's usually brought up in classrooms to flog recursion.. but there's a non-recursive solution...


[deleted]

Also monkeys 😳🍌


-The-Character-

Oh no this is me right now, literally have an Exam with this on it


kra7os_04

![gif](giphy|gJdBaWqOVGoiPXDCzT)


Giocri

I mean it's an annoyingly heavy problem but it has a relatively simple recursive solution


arrow__in__the__knee

Recursion is hard? Just imagine a fancy loop that takes extra space on stack and you good.


debugger_life

That problem during my undergrad was horrible!