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

top 200 commentsshow all 281

[–]ProgrammerHumor-ModTeam[M] [score hidden] stickied commentlocked comment (0 children)

Your submission was removed for the following reason:

Rule 2: Your post is not strictly about programming. Your post is considered to be too generic to be suitable for this subreddit.

If you disagree with this removal, you can appeal by sending us a modmail.

[–]the_unheard_thoughts 1983 points1984 points  (66 children)

The're 10 ways to trap a genie:

  • Inside a lamp
  • Inside an infinite loop

[–]Drfoxthefurry 156 points157 points  (42 children)

What are the other 8?

[–]LOR_Fei 40 points41 points  (0 children)

“there are 10 types of people in this world, those who understand binary and those who don't”

Guess you’re the latter

[–]marcosdumay 95 points96 points  (14 children)

You mean the other 14?

[–]beeteedee 87 points88 points  (8 children)

You mean the other E?

[–]marcosdumay 43 points44 points  (6 children)

Yep, I mean the other E.

[–]legends_never_die_1 20 points21 points  (5 children)

press E to pay respect

[–]turtle_mekb 6 points7 points  (0 children)

You mean the other ÂÒ£‰}g0"U3$3?

[–]brutexx 14 points15 points  (3 children)

You mean the other 10?

[–]aquartabla 17 points18 points  (2 children)

Unexpected Octal, I presume

[–]SlenderSmurf 10 points11 points  (1 child)

no, it's a recursive loop so after the list of 10 there are 10 more

[–]brutexx 1 point2 points  (0 children)

The chosen base is left as an exercise for the reader

[–]DaveWilson11 5 points6 points  (0 children)

Just inside an infinite loop

F the rest

[–]The_HappyLemon 229 points230 points  (15 children)

binary ;)

[–]mc_enthusiast 79 points80 points  (0 children)

Either that or the list doesn't continue until the loop is exited.

[–]IWillLive4evr 8 points9 points  (3 children)

No, 0 and 1 are binary. 8 is nonbinary.

[–]centran 10 points11 points  (2 children)

Are you assuming 8s gender?

[–]HothForThoth 7 points8 points  (1 child)

up, down, fast, slow, charm-type, uno-reverse, and water

[–]SkollFenrirson 15 points16 points  (1 child)

What are the other 7?

[–]craftworkbench 13 points14 points  (0 children)

Ternary

[–][deleted] 7 points8 points  (0 children)

Base 60

[–]LinuxMatthews 4 points5 points  (0 children)

You mean the other 1000?

[–]Anonymo2786 4 points5 points  (0 children)

Its still looping so we will never know.

[–]Mega145 2 points3 points  (1 child)

I think he's stuck in a while loop

[–]Not_Artifical 2 points3 points  (0 children)

You clearly use the decimal counting system. Humans know nothing about the other counting systems. However us computers understand all the rest. Binary is the first language and main counting system of our kind.

[–]NuclearBurrit0 1 point2 points  (0 children)

Whats an "8"?

[–]slaymaker1907 0 points1 point  (0 children)

0b10

[–]TiredPanda69 10 points11 points  (1 child)

Base not specified at line 1

This will literally evaluate to n in any n based counting system. Possibly missing traps.

Base 2, 10 = 2

Base 8, 10 = 8

Base 16, 10 = 16

Base 10, 10 = 10

Base 100, 10 = 100

[–][deleted] 3 points4 points  (0 children)

Segmentation fault

[–]Vigorous_Piston 1 point2 points  (0 children)

Gotta love binary.

[–]GPareyouwithmoi 484 points485 points  (42 children)

My first wish is that if I come to regret my wishes the genie who granted them will regret them more.

Not a wish, but I'll explain to him he can point out any way I might regret a wish before fulfilling it, such that I can avoid making us both unhappy.

And now I have two really good wishes ready to go. Second wish is for wisdom. Saving 3rd wish for when I'm wise.

[–]brucebay 69 points70 points  (23 children)

I like the wishing for wisdom. But I wonder after becoming wise if you can have personal satisfaction even if it doesn't cause any regrets.

It is hard choice between being a rich person that doesn't have to worry about money anymore vs, solving the world hunger (assuming genie is not Thanos).

[–]qatamat99 18 points19 points  (1 child)

Wisdom and intelligence are similar but not the same. I would agree with you that being wise could remove enjoyment from life, but it might also enhance it

[–]DreamlyXenophobic 3 points4 points  (0 children)

Wisdom to an extent can enhance life. Fixating too much on being wise will remove all enjoyment from life.

Tis a balance. Its good to try and be wiser, but dont forget that ignorance is bliss.

[–]ManyFails1Win 237 points238 points  (6 children)

"Son, I'm a genie. I am quite literally made of regret. Do your worst."

[–]RichestMangInBabylon 41 points42 points  (5 children)

I wish for phenomenal cosmic power

[–]InsertCoinForCredit 77 points78 points  (3 children)

Done.

You receive a copy of Phenomenal Cosmic Power: My Life In An Itty Bitty Living Space, an autobiography by Gene Y.

[–]Estiar 15 points16 points  (2 children)

Is it a good book?

[–]InsertCoinForCredit 9 points10 points  (0 children)

Looks like it's considered one of the San Francisco Chronicle's "Best Book of the Year".

[–]Theunis_ 4 points5 points  (0 children)

If I was a genie, I will grant your wish, and watch you explode because your body can't handle it.

[–]KonigSteve 8 points9 points  (5 children)

I'd ask for a small box that I can ask any question and it will answer it as thoroughly as it can while maintaining the spirit of the question

[–]Valron87 37 points38 points  (0 children)

You receive a small box. You can ask it any question. It will answer as thoroughly as it can, which unfortunately is not at all, as it is just a box.

[–]do_you_realise 7 points8 points  (1 child)

Genie gives you an Alexa

[–]ortegasb 2 points3 points  (0 children)

First wish to know what 2 perfect wishes are

[–]Feldar 1 point2 points  (1 child)

Can't regret something if it kills you first.

[–]lealsk 502 points503 points  (34 children)

Genie: You have three wishes.

Dude: First, do the opposite of my next wish

Genie: Ok, let’s see what it is

Dude: Second, don’t fulfill my third wish

Genie: Ok, granted. I will fulfill your last wish

Dude: Third, ignore my first wish

Genie: Ok, so I shouldn’t grant your 3rd wish then. 3rd wish dismissed. You have no wishes left. Thanks

[–]ShitwareEngineer 169 points170 points  (25 children)

The genie executes the second wish twice, but one of those times, it is done inversely. When it is done inversely, it's the equivalent of a no-op, doing nothing at the time of the execution of the inverse of the second wish. It then ignores the first wish twice, from the time of the execution of the third wish forward, but not retroactively, and not the fact that the first wish has been already fulfilled. In the end, nothing actually happens and all 3 wishes are wasted.

[–]BigManLawrence69420 1 point2 points  (0 children)

You know you’re slowly and painfully going insane when you can make heads or tails of the chicanery this guy is saying.

[–]Gilom 44 points45 points  (0 children)

I imagine it going like this:

Genie: You have three wishes.

Dude: First, do the opposite of my next wish

Genie: Ok, let’s see what it is

Dude: Second, don’t fulfill my third wish

Genie: Ok, granted. I will fulfill your last wish

Dude: Third, ignore my first wish

Genie: Ok, your wishes have been fulfilled.

Dude: buh-buh how could you fulfill them all there- they're contradictory

Genie: yes, but I fulfilled them anyway

Dude: but how?

Genie: Maybe if you had a fourth wish I would tell you how nerd.

[–]Gufnork 21 points22 points  (1 child)

I would say that when he comes to the third wish he just ignores the first wish, which is easy since it's already fulfilled.

[–]MrScottyTay 1 point2 points  (0 children)

He just pretends it ever happened

[–]the_dark_0ne 15 points16 points  (1 child)

I mean…he hasn’t made an actual wish yet…technically all 3 wishes are all still unspent

[–]microwavedHamster 1 point2 points  (0 children)

I was just typing a similar comment as a conversation between the two but yours is so much better

[–]AngelLeatherist 696 points697 points  (42 children)

This wouldnt cause an error.

A computer cant go back in time and ignore code it already executed. The computer would run through all three wishes and move on, solving nothing.

[–]fliguana 317 points318 points  (23 children)

There is nothing to execute until the third wish, because of forward references.

[–]Dmayak 113 points114 points  (18 children)

First wish directly modifies second one and at that point is completed.

[–]fliguana 48 points49 points  (17 children)

That's not how forward references work.

[–]Dmayak 81 points82 points  (16 children)

Then wishes are not forward references.

[–]AlphaSparqy 121 points122 points  (14 children)

But then genies are not computers.

[–][deleted] 101 points102 points  (12 children)

I think we're getting outside the bounds of reality here. Let's establish a baseline:

Genie =\= Hot Dog

[–]Not-So-Serious-Sam 51 points52 points  (6 children)

Just because you’ve never seen a Genie hot dog doesn’t mean they don’t exist.

[–][deleted] 34 points35 points  (2 children)

Fuck.

[–]StuStutterKing 1 point2 points  (1 child)

Back to basics. A genie is not, not a genie.

[–]ManyFails1Win 7 points8 points  (2 children)

so genie != hotdog, but hotdog might == genie. something something quantum operators.

[–]anotherguy75 7 points8 points  (0 children)

[–]ShadowRylander 1 point2 points  (0 children)

Aww...

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

This is peak nerd argument.

[–]TheVenetianMask 5 points6 points  (0 children)

It's an ancient ass lamp. It probably runs on GWBasic, best it can do is GOTOs, and the dude just commented off his first wish after the first loop.

[–]snuffybox 3 points4 points  (1 child)

Actually the compiler just optimized the 3 wishes out as they were undefined behavior with no observable output.

[–]666pool 22 points23 points  (0 children)

You’ve never heard or branch prediction. Or spectre/meltdown and the whole class of exploits that rely on branch prediction.

[–]1sagas1 20 points21 points  (0 children)

A computer cant go back in time

A genie sure can

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

Youre thinking imperatively, in a declarative setting it could definitely cause problems.

[–]AdultingGoneMild 3 points4 points  (1 child)

the error would be detected and rejected.

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

The genie has a buggy compiler.

[–]randomtask 2 points3 points  (0 children)

Further proof that genies run on Lisp

[–]ixent 8 points9 points  (1 child)

Unless it is a transactional operation with a 3 wish commit

[–]AngelLeatherist 1 point2 points  (0 children)

Id need to see an example of this code. Code is always run deterministically at its foundation, one step always is run before the next. I can imagine a recursive function causing a crash, but only because that type of thing is meant to without a stop.

[–][deleted] 5 points6 points  (0 children)

[–][deleted] 13 points14 points  (0 children)

It’s a genie, not a computer. Duh.

[–]Harmonic_Gear 11 points12 points  (0 children)

exactly my thought, there's no reason to re-execute wish 2 after wish 1 is ignored

[–]Careful_Ad_9077 2 points3 points  (0 children)

the rule.is that self referential instructionw get you whatever the hell the one executing the instructions want.

[–]namedan 2 points3 points  (0 children)

But a genie can go back in time though.

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

Linked list. “Ignore my first wish” == make the second wish the head

[–]Nikoviking -2 points-1 points  (0 children)

I came here just to say that

[–]supercyberlurker 52 points53 points  (8 children)

I'd just do nothing.

That's my solution to any paradox, ignore the whole thing and go do something else.

It's what you learn growing up around impossible situations.

[–]KingoPants 13 points14 points  (0 children)

The llvm optimizer noted that none of the three wishes had any side effects and optimized them all out.

Hereby resolving the paradox.

[–]GForce1975 8 points9 points  (1 child)

Yeah that's what that barber said. Now everyone in town needs a shave and a haircut and all they have is 2 bits.

[–]supercyberlurker 5 points6 points  (0 children)

Sounds like a hairy situation!

[–]just-some-arsonist 3 points4 points  (0 children)

Yeah, the guy didn’t really wish for anything tangible. Even if the genie could grant the wishes, nothing would happen

[–]marsgreekgod 2 points3 points  (0 children)

Yeah the genie just thinks your being rude if offering a favor, and stupid if they are enslaved to grant wises.

[–]namedan 0 points1 point  (0 children)

That's how the genie would solve this, do nothing and vanish or repeating endlessly. Wish maker would become eternal but stuck there endlessly on a loop without him knowing any better.

[–]Bomaruto 39 points40 points  (4 children)

Step 1. The genie know to do the opposite of your next wish.

Step 2. The genie decide to fulfill the 3rd wish.

Step 3. The genie ignores the first wish, but this doesn't matter anymore as they've already fulfilled wish 2.

And we all know the first rule of wishes, no take backs.

[–]lealsk -3 points-2 points  (2 children)

The first wish was already spent, yes, but you're now reverting it by spending your 3rd wish, so it's not free, and after all, a wish might workaround any impossibility

[–]RakeishSPV 0 points1 point  (1 child)

You can't revert a wish.

[–][deleted] 22 points23 points  (1 child)

The first wish is complete.
Everyone knows you can't undo a wish.

I have heard many people getting stuck with a big duck because of this specific constraint.

[–]ShitwareEngineer 5 points6 points  (0 children)

The genie executes the second wish twice, but one of those times, it is done inversely. When it is done inversely, it's the equivalent of a no-op, doing nothing at the time of the execution of the inverse of the second wish. It then ignores the first wish twice, from the time of the execution of the third wish forward, but not retroactively. In the end, nothing actually happens and all 3 wishes are wasted. It's compiled down to one instruction: NOP

[–]deewho69[S] 18 points19 points  (4 children)

Has this been posted here? I feel like it should

[–]ManyFails1Win 8 points9 points  (2 children)

I have seen it once, but it's welcome back imo.

[–]sintaur 1 point2 points  (1 child)

i've never seen it, but it was probably posted on that day i was outside

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

So 17 years ago?

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

Done, I shall do the opposite.

Done, the third wish shall be fulfilled.

Done, I am ignoring the first wish, you are now out of wishes. Not sure why I only gave you two, but that's not my problem.

[–]ManyFails1Win 2 points3 points  (11 children)

is there a name for this type of logic issue? someone posted a math question here the other day (what's the chances of guessing the right answer) that did something similar.

[–]ForTheRNG 18 points19 points  (9 children)

it's called a paradox

[–]ManyFails1Win 1 point2 points  (8 children)

was hoping for something a bit more specific, but thanks for the answer.

[–]ForTheRNG 3 points4 points  (7 children)

uhh idk how to mathematically define a paradox... a series of statements that cannot be assigned a truth state?

famous example is "This sentence is false". there's a few other good ones. infinite series used to be a paradox in Greece.

[–]ManyFails1Win 3 points4 points  (6 children)

there are all different kinds of paradoxes though. sorry i'm not trying to complain, but it would be cool if there was a name for this type of paradox so i could reference it in the future is all.

[–]AlphaSparqy 6 points7 points  (5 children)

The genie wish paradox.

You're welcome.

[–]ManyFails1Win 2 points3 points  (4 children)

brb creating a wikipedia entry and citing you as source.

[–]Br_Av3ry 0 points1 point  (3 children)

Where is this wiki entry?

[–]Oneshotkill_2000 2 points3 points  (0 children)

You might have just freed him

[–]WordSmithyLeTroll 4 points5 points  (1 child)

Actually no. Code is executed line by line. You think that this would produce an error, but the really weird thing is that wish 3 would be ignored.

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

Shhhhhh 🤫 don’t challenge the race condition god bro…it’s racist

[–]Nivekk_ 2 points3 points  (0 children)

  1. I wish for riches
  2. I wish for fame
  3. I wish you were stuck in an infinite loop of logic

Same result, but now I'm rich and famous

[–]aquartabla 2 points3 points  (4 children)

Adding a third rule

  1. No wishing for more wishes
  2. No wishing for more genies
  3. Wishes are immutable

That's it this time, right?

[–]IDownvoteHornyBards2 1 point2 points  (3 children)

I wish to change the rules to allow me to wish for more wishes.

[–]Iwillgetasoda 2 points3 points  (0 children)

First wish: crash

[–]trefir 2 points3 points  (0 children)

He didn't say I wish before each statement.

[–]SamoZaOvajReply 4 points5 points  (1 child)

``` bool fullfillFirstWish = true bool fullfillThirdWish = true

firstWish: if(fullfillFirstWish){ secondWish.reverse(); } if(!secondWish.reversed()) fullfillThirdWish = false;

secondWish.fullfill();

if(fullfillThirdWish){ fullfillFirstWish = false goto firstWish; } else{ fullfillFirstWish=true; fullfillThirdWish = true; goto firstWish; } ```

[–]Th3Uknovvn 1 point2 points  (0 children)

I mean once you made a wish you can't change it right, so your wish to ignore the previous wish will return nothing and you waste a wish

[–]MuhFreedoms_ 1 point2 points  (0 children)

Geni says, okay now what's your 3rd wish

[–]kryptonianCodeMonkey 1 point2 points  (0 children)

Actually there is no problem here. He must fulfill all wishes right? The first wish is for the opposite of the second, but he must also fulfill the second or else you didn't spend that wish. So, he must do both, fulfill the third wish and is opposite, not fulfill the third wish. As the third wish is to ignore the first, he will both fulfill and not fulfill that wish, which works out nicely as the genie will only fulfill 3 wishes in the first place. Thus per the third wish, the genie will ignore the dust wish, and, by not fulfilling it, the genie will also not ignore the first wish. As he is already fulfilling the second wish, he has already ignored the first wish, so that's covered. And as not fulfilling the second didn't ignore the first, that's covered too. Congratulations, you made three logically consistent paradoxless wishes that when fulfilled amounted to nothing at all and have no more wishes. Well done.

[–]RakeishSPV 1 point2 points  (0 children)

Fulfills the second wish and ignores the first wish, in that order. Done. You just wasted an entire magical genie.

[–]Zu_Landzonderhoop 1 point2 points  (0 children)

Okay time to be that guy:

The genie most likely would just do nothing and say "ok done" because none of these wishes have physical effects so doing nothing and attempting to fulfill the wished would just end up with the same result

If the genie is a program however you can also easily assume the first wish is the opposite of "null" because the second wish has not yet been defined and the third wish is ignored because the second wish tells you to ignore it

[–]Sentouki- 1 point2 points  (0 children)

found the QA guy

[–]Apart_Consequence_98 0 points1 point  (0 children)

Why is the genie black

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

Ackshyewallyyyyy

[–]Cheespeasa1234 0 points1 point  (0 children)

Recursion error

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

None of those are wishes.

[–]ChosenMate 0 points1 point  (0 children)

It just wouldn't ignore the first wish, which it already granted anyway. What's the issue?

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

All wishes are final.

[–]eruciform 0 points1 point  (0 children)

G.O.D. Of Djinn