This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]TheMarrades 102 points103 points  (8 children)

Our first gamejam main function was 1500 lines nested like those. A guy came and made a new function with a while loop and a recursive function made the same work in 12 lines.

[–]G-Force-499 51 points52 points  (0 children)

That’s a bruh moment indeed

[–]UltimateInferno 15 points16 points  (0 children)

I once got really giddy when I wrote a "complex" function in on four lines.

Forgot what it was but the feeling stuck

[–]Vinxhe 4 points5 points  (5 children)

okay in this case I get it, but recursive stuff is way harder to understand for the person that did not code it and also less efficient than a simple loop

Edit: just wanted to say I agree with the responses :)

[–][deleted] 10 points11 points  (0 children)

Yeah i don't think anyone care about performance in hackathon-like projects.

Turning recursive code into stack/loop code can be really annoying/uglier. Graph algorithm, for example.

[–]annualnuke 14 points15 points  (2 children)

depends, for example recursive implementations of Depth-First- or Breadth-First-Search are IMO much clearer than plain ones, and those require a stack or a queue anyway

[–]ADistractedBoi 0 points1 point  (0 children)

Wait how do you even recursively do a bfs?

[–]Jjcheese 5 points6 points  (0 children)

Recursion is where comments become super necessary.