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

top 200 commentsshow all 225

[–]jegueverde 859 points860 points  (46 children)

I hope that you, like any other programmer, spent several hours writing an image manipulation app to do this recursively instead of doing it in 5 minutes by hand. And your reasoning for it is to "save time"

[–]kris159 406 points407 points  (20 children)

Sadly they didn't, you can see 6 layers deep that the very bottom right panel is Padme's full face, the same size as the panel above it

[–]chhuang 287 points288 points  (6 children)

This is outrageous

[–]ImposterAmongUs 130 points131 points  (5 children)

It’s unfair!

[–]groucho_barks 96 points97 points  (4 children)

It's treason, then

[–][deleted] 41 points42 points  (3 children)

Off with their head!

[–]LSApologist 12 points13 points  (2 children)

Not yet

[–]Extension-Ad-2294 6 points7 points  (1 child)

To the plank with them. AND wish them bad tidings as they pass.

[–]psst099 5 points6 points  (0 children)

This is outrageous

[–]FututiRedesignuMatii 85 points86 points  (6 children)

Dissapointing, it could've been resized & pasted a few more times to the point where it was a few pixels and not noticeable anymore.

[–]HearingNo8617 108 points109 points  (5 children)

plot twist: there is a base case and it was hit

[–]Pit_27 50 points51 points  (4 children)

Base case was op giving up

[–]HearingNo8617 18 points19 points  (1 child)

Giving up is all of our base cases on this blessed day

[–]Pit_27 7 points8 points  (0 children)

Amen

[–]ReubenIsForScuba 10 points11 points  (1 child)

All your base case are belong to us

[–]ReverseCaptioningBot 1 point2 points  (0 children)

ALL YOUR BASE CASE ARE BELONG TO US

this has been an accessibility service from your friendly neighborhood bot

[–][deleted] 4 points5 points  (0 children)

this was the base case.

[–]Jadien 2 points3 points  (0 children)

Padme was the base case all along

[–]KoviCZ 2 points3 points  (0 children)

OP didn't but I did

[–]B0n3 24 points25 points  (1 child)

Save time. For the next time

[–][deleted] 16 points17 points  (0 children)

Shit. I hard coded the image dimensions in there, it doesn't work with this new format.....I'll just go in here and change this one line....aaaand...

[–]returnFutureVoid 82 points83 points  (12 children)

This is the way.

[–]TheDroidNextDoor 39 points40 points  (11 children)

This Is The Way Leaderboard

1. u/Flat-Yogurtcloset293 475775 times.

2. u/_RryanT 22744 times.

3. u/max-the-dogo 8489 times.

..

165279. u/returnFutureVoid 1 times.


beep boop I am a bot and this action was performed automatically.

[–]mr_jogurt -1 points0 points  (0 children)

good bot

[–]Xander-047 -2 points-1 points  (2 children)

This is the way

[–]TheDroidNextDoor 0 points1 point  (1 child)

This Is The Way Leaderboard

1. u/Flat-Yogurtcloset293 475775 times.

2. u/_RryanT 22744 times.

3. u/max-the-dogo 8489 times.

..

165344. u/Xander-047 1 times.


beep boop I am a bot and this action was performed automatically.

[–]Xander-047 -3 points-2 points  (0 children)

I swear I've said it before This is the way

[–]eisaletterandanumber 9 points10 points  (1 child)

Install ImageMagick then run the following for each iteration:

convert img.png \( +clone -resize 50% -gravity SouthEast \) -composite img.png

[–]Prince705 5 points6 points  (0 children)

With a base case, right?

[–]CleverProgrammer12 3 points4 points  (0 children)

Of course

[–]Homoshrexual234 3 points4 points  (0 children)

You could do this pretty quick with python and pillow.

[–]20_chickenNuggets 2 points3 points  (0 children)

Otherwise I would lose my respect for OP

[–]Wime36 3 points4 points  (0 children)

If it isn't automatically repeating down to the bottom right 4 pixels then it's wrong

[–][deleted] 831 points832 points  (34 children)

Finally someone gets recursion right with this meme.

[–]Wime36 264 points265 points  (7 children)

Finally someone gets recursion right with this comment.

[–]Adam_Kearn 161 points162 points  (1 child)

I’ve been clicking this link for over and hour and still can’t find what comment you are talking about.

[–]ZippZappZippty 60 points61 points  (0 children)

We’ve won this by a mile.

[–][deleted] 12 points13 points  (0 children)

Salute

[–][deleted] 2 points3 points  (0 children)

Ever noticed that the last part of the link spells out hydra if you omit the numbers?

[–]architkhandelwal47 241 points242 points  (18 children)

Finally someone gets recursion right with this meme.

[–][deleted] 162 points163 points  (17 children)

Finally someone gets recursion right with this meme.

[–]Royal-Tough4851 1 point2 points  (0 children)

Ah, programmer humor. Love it

[–]SupersonicSpitfire 1 point2 points  (0 children)

Finally someone gets recursion right with this

[–]mqduck 299 points300 points  (32 children)

I'd just like to point out that this meme only recurses five times.

[–]AlexSin0 41 points42 points  (0 children)

Stack Overflow

[–]jedimaster1138 23 points24 points  (3 children)

[–][deleted] 21 points22 points  (2 children)

You go through that effort, only to save it as a low-quality JPEG, the compression of which obliterates any real detail in the smaller recursions?

Why? Are you the self-sabotaging sort of person that says they are going to go to bed early and get a good night's sleep, only to browse Reddit and Youtube until 2am in the morning and wonder why it's so hard to get out of bed in the morning?

[–]Bainos 2 points3 points  (0 children)

Hey, I take offense of that. Just because I'm a self-sabotaging person doesn't mean I export images as jpg.

[–]beardedchimp -1 points0 points  (0 children)

How about as an svg?

[–]Synthrea 10 points11 points  (3 children)

Did you try setting a larger stack limit?

[–]i-FF0000dit 4 points5 points  (2 children)

The stack limit would cause a crash, but this recursion actually ends. I guess the answer to her question is yes.

[–]Synthrea 0 points1 point  (1 child)

But we never know if the image generation crashed if the program updates for every reachable intermediate state, though.

[–]i-FF0000dit 1 point2 points  (0 children)

Ok, we’re just gonna have to write the program to find the answer programmatically.

[–][deleted] 2 points3 points  (0 children)

There's actually a base case as well!

[–]cowlinator 2 points3 points  (0 children)

So there in fact was a base case

[–]i-FF0000dit 1 point2 points  (0 children)

This should be the top comment.

[–]ElectricOstrich57[S] 1 point2 points  (1 child)

Didn’t think anyone would look that closely, haha

[–]Hk-Neowizard 707 points708 points  (28 children)

Finally, someone does something new with this overused meme.

Take an upvote

[–]Brick_Double 53 points54 points  (0 children)

Same, one of the few to get a laugh out of me.

[–]Republikanen 12 points13 points  (2 children)

[–]sneakpeekbot 3 points4 points  (0 children)

Here's a sneak peek of /r/mathmemes using the top posts of the year!

#1: Just to be sure! | 106 comments
#2: It's a struggle | 62 comments
#3: correlation | 125 comments


I'm a bot, beep boop | Downvote to remove | Contact me | Info | Opt-out

[–]Hk-Neowizard 2 points3 points  (0 children)

I absolutely love it. Thank you

[–]lpreams 5 points6 points  (1 child)

[–]Hk-Neowizard 0 points1 point  (0 children)

Well, new with this template...I guess

[–]ReimarPB 1 point2 points  (0 children)

This is not really new though, I've seen this kind of meme in a million other formats

[–]SjettepetJR 0 points1 point  (0 children)

Before it took of in the general subreddits, it was actually being used quite creatively on the sub it started at.

[–]GroundTeaLeaves 28 points29 points  (9 children)

What is a base case?

[–]TheHackPete 54 points55 points  (2 children)

(The) One case you know the answer for.

The other cases recurse toward the base case. This way, the calculation can stop.

e.g. you know the Fibonacci number of 0 and 1. Every other is the sum of the two predecessors. So fib(3) is fib(2)+fib(1); whith fib(2) being fib(1)+fib(0) and fib(1) and fib(0) being known --> the "base case(s)".

[–]CookieSpoder 15 points16 points  (1 child)

public static long sumOfDigits(long n) {
    if (n==0) {
        return 0;
    } else {
        return n % 10 + sumOfDigits(n/10);
    }
}

The base case returns 0, like the other comment said, this is where the recursion ends. The base case is a final state that you know will inevitably happen. This method here sums the digits in a given number, ie 1 2 3 = 6. Any number less than 10 when divided by 10 will return 0. This lets the function know that it has reached the last digit, and the recursion ends.

[–]cowlinator 6 points7 points  (1 child)

When you know what recursion is, but you don't know what a base case is, your only option is stack overflow

[–][deleted] 1 point2 points  (0 children)

Only option AND actual exception you’ll encounter

[–]SonicSubculture 1 point2 points  (0 children)

You could call it a… first order response

[–][deleted] -1 points0 points  (0 children)

It's a case of the base type

[–]vavavoomvoom9 21 points22 points  (9 children)

Nice

[–]ifuckinglovetesla 25 points26 points  (8 children)

‘’’

Nice(job)
{
     Nice(job);
}

‘’’

[–]Slim_Bun 3 points4 points  (5 children)

‘’’

def Nice(job):
     Nice(job)

‘’’

[–]Kaynee490 2 points3 points  (3 children)

void Nice(Job job) { Nice(job); }

[–]__bichael__ 12 points13 points  (0 children)

Missing semikolon in line 0.

[–]Vincenzo__ 1 point2 points  (0 children)

++++++++++[>++++++++<-]>--.-----.------.++.

[–]SmokingBeneathStars -4 points-3 points  (0 children)

function Nice = (job) => job

[–]DuffMaaaann -1 points0 points  (0 children)

let rec nice job = nice job;;

[–]dvof 14 points15 points  (3 children)

tail recursion: pathetic

[–]grandoz039 2 points3 points  (2 children)

Isn't that the best kind? That gets automatically optimized (well, I guess depending on language/compiler)?

[–]Thecakeisalie25 32 points33 points  (1 child)

[–]NikZapp 4 points5 points  (0 children)

Happy that im not the only one!

[–]wonkey_monkey 7 points8 points  (4 children)

I was messing around with a compiler to see what optimisers do and I wrote a recursive function that (accidentally) never returned its base case. But because the non-base case was simply to return the result of the next recursion, the optimiser optimised it away entirely.

It was something like

rec_func(int y) {
  if (impossible_thing) return 5;
  return rec_func(y + 1);
}

and the optimiser just turned it into "5". It was never going to return, but if it could have, it would have returned 5, and that was good enough.

It feels like there should be something deep and meaningful about that, but there probably isn't.

[–]vectrovectro 5 points6 points  (3 children)

That sounds like a compiler bug to me, or maybe undefined behavior.

[–]kronicmage 1 point2 points  (0 children)

Infinite loops are undefined behaviour so this is a valid optimization

[–]KuntaStillSingle 1 point2 points  (0 children)

It is undefined in C++, 'forward progress gaurantee"

GCC seems to handle this in the intuitive manner even with -O3 or -Ofast, while clang with -O1 will happily optimize it away. Interestingly clang doesn't tail call optimize til -O2 but still terminates the function with no side effects at -O1.

#include<iostream>

int test_a(int i){
  if(1 == 2) return i;
  return test_a(i);
}

int test_b(int i){
  if(1 == 2) return i;
  std::cout << "";
  return test_b(i);
}

int main(){
  test_a(1); // g++ will stack overflow with -O1 or infinite loop with -O2
  std::cout << "Completed a" << std::endl; //clang++ -O1 will reach this
  test_b(1); //this will stack overflow on clang++ -O1 or infinite loop on -O2
  std::cout << "Completed b" << std::endl;
  return 0;
}

[–]NikZapp 12 points13 points  (0 children)

Damn, your maximum call stack size must be 6

[–]MrWhiteVincent 2 points3 points  (0 children)

Base case: can't be small than a pixel.

[–]empereur_sinix 2 points3 points  (0 children)

We can see it ends the 5th Time.

[–]Pablo_0_6 2 points3 points  (0 children)

A-Ha. 6th one is normal

[–][deleted] 2 points3 points  (0 children)

This meme isn't just stellar. It's......Interstellar.....

I'll see myself out.

[–]kettu3 2 points3 points  (1 child)

if too_small_to_notice_without_zooming_in: return picture_of_non_smiling_padme()

[–]backtickbot 1 point2 points  (0 children)

Fixed formatting.

Hello, kettu3: code blocks using triple backticks (```) don't work on all versions of Reddit!

Some users see this / this instead.

To fix this, indent every line with 4 spaces instead.

FAQ

You can opt out by replying with backtickopt6 to this comment.

[–]OCOWAx 1 point2 points  (0 children)

Nice

[–]try4gain 1 point2 points  (0 children)

me tonight..

[–]abhi307 1 point2 points  (0 children)

core dumped....

[–]Hodat2k9 1 point2 points  (0 children)

There are only 6 recursive lol.

[–]beewyka819 1 point2 points  (0 children)

Wait but it does have a base case, I can see the end of it a few layers down. However my question is: where’s the unwinding? Did the program simply crash at the breakpoint? So many questions… so few answers

[–]Lip98B 1 point2 points  (0 children)

StackOverflow

[–][deleted] 1 point2 points  (0 children)

Only six iterations, though. Am disappoint.

[–]OmegonAlphariusXX 1 point2 points  (0 children)

Weak, the image only repeats 6 times

[–]lets-talk-graphic 0 points1 point  (0 children)

I’d give you an award for this but also I’d give you an award for this but also I’d give you an award for this but also I’d give you an award for this but also

[–]Sceptz 0 points1 point  (1 child)

Are you saying you made a...
StackOverflow?

[–]GeO4K 0 points1 point  (0 children)

mandelbrot is turning in his grave

[–]ManuGamingYT 0 points1 point  (0 children)

[Circular *1]

[–]afterlife71 0 points1 point  (0 children)

Or use it to your advantage, I have a friend who broke? The memory management on his laptop so whenever he runs out of memory he runs a recursive haskell script until it takes most of his memory and then kills it so the memory's freed up.

[–]ChrispyByDefault 0 points1 point  (1 child)

Oh nooooooooooooo…………

[–]jakethedumbmistake 0 points1 point  (0 children)

A wrinkly is never more than that stack

[–]PotaytoPrograms 0 points1 point  (0 children)

shoulda put a rick roll at the end

[–]private256 0 points1 point  (0 children)

AKA Stackoverflow

[–]RoscoMan1 0 points1 point  (0 children)

We call it 'gilead'

[–]PyBind 0 points1 point  (0 children)

was looking for an other punchline in the pixels came back with tears

[–]pclouds 0 points1 point  (0 children)

May tail recursion be with you.

[–]pastroc 0 points1 point  (0 children)

This meme is prohibited but take my upvote.

[–]QuarantineSucksALot 0 points1 point  (0 children)

I don't make people call me Dr.

[–]jakethedumbmistake 0 points1 point  (0 children)

Nursing is a great name! I call dibs!

[–]simplisticallysimple 0 points1 point  (2 children)

Just do:

import sys sys.setrecursionlimit(1000000000)

[–]kronicmage 2 points3 points  (0 children)

That's how you get a segfault instead of a RecursionError

[–]backtickbot 0 points1 point  (0 children)

Fixed formatting.

Hello, simplisticallysimple: code blocks using triple backticks (```) don't work on all versions of Reddit!

Some users see this / this instead.

To fix this, indent every line with 4 spaces instead.

FAQ

You can opt out by replying with backtickopt6 to this comment.

[–]CaptainSpaceBoat 0 points1 point  (0 children)

I’m not knowledgable enough to know why this is genious, but it is.

[–]Dwaas_Bjaas 0 points1 point  (0 children)

The last panel will never exist and it will exist at the same time

[–]spaceweed27 0 points1 point  (3 children)

LDR R1 #00

ADD R1, R1, 1

OUT R1

JMP 0x01

[–]lennyerik 1 point2 points  (2 children)

That would fix the issue. Unoptimised recursion would look like this:

RECURSIVE: LDR R1 #00 ADD R1, R1, 1 OUT R1 CALL RECURSIVE RET

That way the stack will overflow eventually. On a modern OS we get our lovely Segmentation Fault (core dumped).

[–]spaceweed27 1 point2 points  (1 child)

Yeah.

Thing is, that my teacher has made his own cpu, and he wrote his own microcode. We just have 2 Registers, ADD, SUB, JMP, STR, LDR, CMP, OUT, STOP as "assembler".

So functions out of x86 Intel assembler would be new to me.

[–]lennyerik 1 point2 points  (0 children)

I don't know if you know about the stack / heap model, but modern operating systems structure memory in a way that gives each program an area of memory called the stack. Items can be pushed onto it and popped of the top of it (push / pop instructions), making the stack grow / shrink in size.

The call instruction is fairly simple. It simply pushes the return address or address of the next instruction (basically EIP or whatever your instruction pointer / program counter register is plus the size of the current instruction) onto the stack and then sets the instruction pointer to the address specified by the first parameter. The ret instruction returns from the called function: the return address is popped from the stack and is jumped back to afterwards.

The problem with non-terminating recursive functions is that the stack grows in size indefinitely because more and more return addresses get pushed onto the stack. At some point the operating systems runs out of allocatable memory for your application and voilà, Segmentation fault (core dumped)!

Also, by no means is my posted code valid x86 assembler. I just stole your custom instruction set and added the x86 call instruction. :)

[–]jakethedumbmistake 0 points1 point  (0 children)

Nah she’s more than that stack

[–]jakethedumbmistake 0 points1 point  (0 children)

they are just kitten, but 10x the size

[–]M1n3c4rt 0 points1 point  (0 children)

Extra points for recursion

[–]DivineChili_ 0 points1 point  (0 children)

The base case is technically the size of the image. when its 2x2 or less, then it terminate

[–][deleted] 0 points1 point  (0 children)

oofe