Programmer joke

  Рет қаралды 172,466

MindYourDecisions

MindYourDecisions

Күн бұрын

Пікірлер: 554
@vincent412l7
@vincent412l7 4 ай бұрын
In real life, you may get 255 wishes, or you msy get (-1) wish, and have to perform one wish for the genie.
@ArabianShark
@ArabianShark 4 ай бұрын
Kinky...!
@sitnamkrad
@sitnamkrad 4 ай бұрын
Or 0 wishes, since this example is making the assumption that the decrement happens *after* granting the wish.
@yurenchu
@yurenchu 4 ай бұрын
​​​​@@sitnamkrad If the decrement happens before granting the wish, and the programmer wished this on his third wish, wouldn't that _logically_ mean that the genie is not able to grant this particular wish, as the outcome of the wish is already true before granting the wish? (in which case the "wishes left" count should undo the decrement and roll back to 1.) For example, if the programmer wished (on his first wish): "I wish I were a programmer", wouldn't the genie have to reply with "I cannot make that wish come true, because you already are a programmer. So you still have 3 wishes left." The outcome that the programmer is now a programmer is not by virtue of the genie granting a wish, so technically/logically/"legally" the genie still owes the programmer 3 wishes.
@sitnamkrad
@sitnamkrad 4 ай бұрын
@@yurenchu In programming, no. If you code "numberOfWishes = 0", code is going to execute that whether it is or isn't already 0, because that is more efficient than it is to check if it is 0 first. But also no because the number of wishes you start out with is 3. Doing a decrement first would make it 2, so even if you would do a check first, you would still find that 2 != 0 so the wish can be granted.
@andreaspatounis5674
@andreaspatounis5674 4 ай бұрын
@@sitnamkrad if you don't want to make this assumption (that the decrement happens after granting the wish) you could wish for one wish less in your last wish. (or 2 wishes in your second to last wish, etc)
@MoonGlow22
@MoonGlow22 4 ай бұрын
Genie: You have 3 wishes Programmer: I wish for 0 wishes left Genie: Granted, now you have 3 wishes Programmer: Damn it, wish count is stored as 2 bit unsigned int
@yurenchu
@yurenchu 4 ай бұрын
Exactly! Why should the genie store wish count as 8-bits, if 2 bits are sufficient. 😊 But it still allows for an infinite number of wishes though: just use "I wish for 0 wishes left" on the _third_ wish.
@gabrielgauchez9435
@gabrielgauchez9435 4 ай бұрын
@@yurenchu just wish for a bigger storage
@yurenchu
@yurenchu 4 ай бұрын
​@@gabrielgauchez9435 Be careful there. More resources reserved for mere "storage (of wish count)" may result in less resources for granting wishes. So, for example, your subsequent wish for the newest 256GB tablet computer may result in just a 1GB device from 10 years ago...
@weibrot6683
@weibrot6683 4 ай бұрын
No, i wish the count is stored as a ulong
@Yusso
@Yusso 4 ай бұрын
Genie: You have 3 wishes Programmer: I wish for 0 wishes left Genie: Granted, now you have 0 wishes Programmer: Damn it, Genie has [ if(wishes > 0) wishes--; ] in his code
@javoresku
@javoresku 4 ай бұрын
Well that must be an old 8-bit genie. Imagine if it was a 32 bit genie...
@Djou-Karl
@Djou-Karl 4 ай бұрын
4.3 billons wishes , let's go!
@maxaafbackname5562
@maxaafbackname5562 4 ай бұрын
64 is the norm today Nearly unlimited wishes.
@xdkristof
@xdkristof 3 ай бұрын
Granted! You now have 4.294.967.295 wishes left.
@TojosWizzyWorld
@TojosWizzyWorld 3 ай бұрын
Imagine if it was a double…..
@maxaafbackname5562
@maxaafbackname5562 3 ай бұрын
@@TojosWizzyWorld doubles have problems decrementing unit by large values.
@Blue2x2x
@Blue2x2x 4 ай бұрын
Genie: "You have 3 wishes, you know the rules" Me: I wish for 0 wishes Genie: "Really? ...Ok, I will not grant any of your wishes. Have a good day." Me: ... Crap. They patched the exploit.
@tinnguyenanimations522
@tinnguyenanimations522 2 ай бұрын
Idk why this is so underrated
@jdlessl
@jdlessl Ай бұрын
That's why you only use it as your last wish. That way you get 2 wishes, and only risk the third and last one on the exploit.
@HalfBreadOrder
@HalfBreadOrder Ай бұрын
​@@jdlesslunless the genie is dmub and reverses your other two wishes
@trchri
@trchri 4 ай бұрын
Wife: Get a loaf of bread; and if they have eggs, get a dozen. Programmer returns with a dozen loaves of bread.
@yurenchu
@yurenchu 4 ай бұрын
Shouldn't the programmer return with _13_ loaves of bread?
@marcusscience23
@marcusscience23 4 ай бұрын
@@yurenchuThat’s a baker’s dozen, not a dozen
@calvinbarbanell2449
@calvinbarbanell2449 4 ай бұрын
@@marcusscience23 the programmer should be getting a loaf of bread AND a dozen loaves of bread, for a total of 13 loaves.
@marcusscience23
@marcusscience23 4 ай бұрын
@@calvinbarbanell2449 So one more than a dozen, i.e. a baker’s dozen, so it’s perfect! Also, if the programmer bought them twice, he’d have a biker’s dozen
@yurenchu
@yurenchu 4 ай бұрын
@@marcusscience23 Yes, I know 13 is not a dozen, otherwise I wouldn't be contesting the commenter's line "Programmer returns with a _dozen_ loaves of bread". And no, it's not a baker's dozen, because if the programmer went to a baker, then the programmer would likely have returned with just one loaf of bread -- because a baker typically doesn't sell eggs. 😋 (If the programmer went to a baker and the baker does sell eggs, then the programmer would have returned with _14_ loaves of bread.)
@IanHsieh
@IanHsieh 4 ай бұрын
Next joke: Why would a programmer get confused with Halloween and Christmas?
@Evil_Jyan
@Evil_Jyan 4 ай бұрын
they are 50 yards from your location
@docsigma
@docsigma 4 ай бұрын
Because oct(31) = dec(25)
@MountainHawkPYL
@MountainHawkPYL 4 ай бұрын
@@docsigma correct
@IanHsieh
@IanHsieh 4 ай бұрын
@@docsigma Correct
@wyattstevens8574
@wyattstevens8574 4 ай бұрын
31 (oct) = 25 (dec)
@Cenzo1999
@Cenzo1999 4 ай бұрын
One of my fave t-shirts, "There are 10 types of people in the world, those who know binary and those who don't."
@yurenchu
@yurenchu 4 ай бұрын
That's not a very rainbow-friendly statement, though. 🌈
@WizDaPenguin
@WizDaPenguin 4 ай бұрын
yeah but why do rainbows need to be included
@Yonkage-ik5qb
@Yonkage-ik5qb 4 ай бұрын
There are two types of people in the world, those who can extrapolate from incomplete information
@yurenchu
@yurenchu 4 ай бұрын
@@Yonkage-ik5qb ... and those who only extrapolate from complete information. By the way, I think the word "can" doesn't really belong there.
@marcusscience23
@marcusscience23 4 ай бұрын
Using the Hindu-Arabic numerals to notate binary seems overcomplicated though, if the bits are so simple we might as well use simpler symbols to notate them. Binary numbers get long real fast, but writing the bits simpler might make up for that and save a lot of ink and paper.
@evanrosman9226
@evanrosman9226 4 ай бұрын
I might make 2 regular wishes first just incase.
@MrKanilammit
@MrKanilammit 4 ай бұрын
That wouldn't work as on the 3rd wish there would be 0 wishes to subtract from 0. I guess the first wish could be to treat wishes as an unsigned 8 bit integer to make sure.
@Cau_No
@Cau_No 4 ай бұрын
​@@MrKanilammitNot with the code shown. After two wishes, the counter would be 1. Executing the wish to set it to zero would result in 0, then decrementing it, the overflow still would work. Yes, I am a programmer. And I would have inserted a boundary check.
@markusheed4272
@markusheed4272 3 ай бұрын
Me too
@TraceguyRune
@TraceguyRune 3 ай бұрын
@@Cau_No The code shown triggers me, because the decrement happens after the wish, and the wish granting is in a loop rather than an If statement.
@Cau_No
@Cau_No 3 ай бұрын
@@TraceguyRune The loop is necessary for there to be multiple wishes, not just a singular one. But yes, the if statement would be the boundary check.
@aaronbredon2948
@aaronbredon2948 4 ай бұрын
This fails if wishes are predecrement (--wishes_left, grant wish) Genie: you have 3 wishes Programmer: I wish for 0 wishes left Genie: (decreases wishes left to 2, then grants wish, setting wishes left to 0) Genie: your wish is granted. You have 0 wishes left. All your wishes have been used. Goodbye.
@Cornelis1983
@Cornelis1983 4 ай бұрын
Or he fixed the bug to check the amount of wishes is bigger than 0 in a if-statement before he executes the -= 1 operation on the wishCount.
@TheMR-777
@TheMR-777 4 ай бұрын
So the Genie has to be bug-fixed.
@Rikaisan
@Rikaisan 4 ай бұрын
However, this would never be the case since this would mean invalid wishes and wishes the genie couldn't grant would count as granted wishes
@harshitshivhare839
@harshitshivhare839 4 ай бұрын
while(wishes > 0)
@gartnl
@gartnl 4 ай бұрын
@@Rikaisan An invalid wish is still a wish.
@paulowen637
@paulowen637 4 ай бұрын
Don't ask for NULL wishes, you may crash the genie.
@LD-dt1sk
@LD-dt1sk 4 ай бұрын
NULL = 0
@dark3031
@dark3031 4 ай бұрын
@@LD-dt1sk It's very misleading to put it that way though. If you try to do any arithmetic operations with that 0...
@MexoOne
@MexoOne 4 ай бұрын
@@LD-dt1sk NULL is not 0. It's empty pointer, it has no type, no value, no memory allocated. Void, nothing... Appling arithmetic operation to NULL wil cause runtime error
@bendystrawz2832
@bendystrawz2832 4 ай бұрын
Null != 0. 0 is something. Null is nothing.
@adama7752
@adama7752 4 ай бұрын
@@MexoOne The NULL is stored in your CPU's registers as 0. Dereferencing it will cause a 'Page fault' in MMUs (Modern OSes) which will result in a SEG Fault. Then your language of choice may give you a runtime error
@Ostap1974
@Ostap1974 4 ай бұрын
Any experienced genie would decrease left wishes before granting the wish. It must have been a junior developer probably.
@jeremy6384
@jeremy6384 4 ай бұрын
Exactly, I know its a joke, but still in this form it doesnt completely make sense, but people get more focussed on explaining that they know the math parts.
@vinsplayer2634
@vinsplayer2634 4 ай бұрын
If that's the case, just wish to lose 3 wishes.
@MrBerryK
@MrBerryK 4 ай бұрын
Wish- - vs - -wish
@Sonnell
@Sonnell 4 ай бұрын
Or simply check for correct wish values every time before calling the grantwishes function.
@williamdrum9899
@williamdrum9899 4 ай бұрын
​@@MrBerryK Gotta love C footguns, especially this one which isn't a problem in assembly
@MichaelPiz
@MichaelPiz 4 ай бұрын
Just thought of a way around the "no wishing for more wishes" rule: wish for more genies.
@matheuscabral9618
@matheuscabral9618 4 ай бұрын
unfortunately the wish variable is global, so if you ask for another gene, you will still only have 2 wishes between both of them
@catanonimus7
@catanonimus7 4 ай бұрын
​@@matheuscabral9618they are exemplars of the class genie, so obviously each has his own variables
@matheuscabral9618
@matheuscabral9618 4 ай бұрын
@@catanonimus7 but that was only until the patch 1.6.2, unless you were somehow able to downgrade
@ollllj
@ollllj 4 ай бұрын
@@matheuscabral9618 just wish to obtain a genie, that can create wish-fulfilling genies. so no constraining loopholes are left.
@christopherwellman2364
@christopherwellman2364 4 ай бұрын
Genius
@smilerbob
@smilerbob 4 ай бұрын
I just found a magic lamp and tried this on the Genie… The Genie muttered something about a buffer underrun and stopped responding 🤷🏻‍♂️
@yurenchu
@yurenchu 4 ай бұрын
Just pull the plug out from the power outlet, wait for a minute, and plug it back into it again.
@mher_22
@mher_22 4 ай бұрын
Mine said he has a bit in the first digit that determines if the number is positive or not. I wised for -10 wishes before that. now i owe him 10 wishes 😔
@UserJ1513
@UserJ1513 4 ай бұрын
This is why you decrement the variable first then grant the wish, wishes become 2 then 0.
@kingsley.
@kingsley. 4 ай бұрын
Then wish for 0 minus 1 wishes.
@chrisvienna11
@chrisvienna11 4 ай бұрын
@@kingsley. it would be too late for that approach
@TraceguyRune
@TraceguyRune 3 ай бұрын
@@kingsley. No.... Why the hell would you decrement wishes twice for a single wish? That would make you a scammer Genie
@3141minecraft
@3141minecraft 4 ай бұрын
0:23 me: I wish there was no rules
@ЭролСезгин
@ЭролСезгин 4 ай бұрын
I remember this genie programmer joke: -Genie: you have 3 wishes -Programmer: 1.do the opposite of my next wish, 2.don’t fulfil my third wish, 3.ignore my first wish -- critical error
@SpaceUK45
@SpaceUK45 4 ай бұрын
Was gonna say something like "they implemented a bugfix etc etc" but i'm not a programmer i have no idea what im saying
@Miscio94
@Miscio94 4 ай бұрын
Genie does nothing and wins, even in the second iteration of the loop it just works.
@zane6138
@zane6138 4 ай бұрын
the order: 1. Do the opposite of the next wish which makes 2. “Don’t fulfill my third wish,” into a “fulfill my third wish.” which means that 3, fulfills the wish; “ignore the first wish.” if we were going on order on which function starts first, it would be 1. the order will continue then error at 3 because 1 has already occurred. unless if this was a loop, it could work, but in theory it can’t since 1 has already begun. the answer above is either the joke, or that the joke was that giving conditions would make the code error.. or maybe I’m wrong who knows.
@avovk1852
@avovk1852 4 ай бұрын
no critical error, no recursion
@Genuenly
@Genuenly 2 ай бұрын
The script run line by line , making the third wish do nothing
4 ай бұрын
That easy to achieve. 1. wish: Count the wishes in an 8-bit unsigned integer variable. 2. wish: Let set the wish counter to 0. Genie: I'm not signed for this. And now we just created the brand new Genie programing language. 🤣
@zoranocokoljic8927
@zoranocokoljic8927 4 ай бұрын
Why not 2 8-bit bytes (16 bites) or for that matter, 64 bites?
4 ай бұрын
@@zoranocokoljic8927 I mean, you can channel your red green and blue power and go for the 24 bit, but I think it's too greedy, and greed always bad. And watch the old movie Wishmaster. Sometimes only 1 wish is too many.😉🤣
@thanhnguyen1983
@thanhnguyen1983 4 ай бұрын
@@zoranocokoljic8927 You can repeat the "counter to 0 wish" over and over. That is unlimited already.
@Demanteq
@Demanteq 9 күн бұрын
You can use 2nd wish to wish for him to decrement wish variable AFTER granting a wish, and then use 3rd wish to set them to 0.
@Fabibeni1
@Fabibeni1 3 ай бұрын
“I wish for -9,223,372,036,854,775,808 wishes!”
@berndschneider9277
@berndschneider9277 4 ай бұрын
Actual overflow in Civilization I: Treasury jumps from 32767 to 0. I can hear myself swearing still today.
@fakegrek
@fakegrek 4 ай бұрын
Unless you first decrement wishes and then grant them.
@smylesg
@smylesg 4 ай бұрын
None of this would have happened if the genie decrements this wish counter first: If wishes > 0 { wishes -= 1 GrantWish() } Next wish the condition is false.
@rexygama7697
@rexygama7697 4 ай бұрын
"I wish the Genie decrement my wish count *after* granting my wish"
@PowerStar004
@PowerStar004 4 ай бұрын
@@rexygama7697 Turns out it's a *signed* integer and now you have -1 wishes.
@Nethuja_GunawardaneSL
@Nethuja_GunawardaneSL 4 ай бұрын
@@rexygama7697 Looks like the genie can be exploited very easily
@genxjack72
@genxjack72 4 ай бұрын
But the straightforward way would be in a loop like: for (wishes=3; wishes>0; wishes--) { printf("You have %d wish(es) ",wishes); GetWish(); GrantWish(); }
@ominouspotato5208
@ominouspotato5208 3 ай бұрын
@@genxjack72 this actually has the same issue, because GrantWish would set the wishes to 0, and then the loop would decrement wishes, check if it's greater than 0, and continue looping since it's now 255 (although with that particular code it would be unlikely that the function actually has access to a pointer to wishes, but I assume that that wouldn't be an issue) you could change it to use a signed value but then it would just force the user to say a longer number and give them half the wishes, so the only way to fix it would be to decrement wishes _before_ granting the wish, or to unroll the loop for (wishes=3; wishes>0;) { printf("You have %d wish(es) ",wishes); GetWish(); wishes--; GrantWish(); } printf("You have 3 wishes "); GetWish(); GrantWish(); printf("You have 2 wishes "); GetWish(); GrantWish(); printf("You have 1 wish "); GetWish(); GrantWish(); another way could be just to fix the check that presumably exists in GrantWish, that would currently have to be something like "if the user is changing their number of wishes, then only allow it if it's fewer wishes than they already have," and instead not allow changing wish count at all that said, it occurs to me that none of this code actually accounts for the user's wish being blocked, it just takes away the wish and does nothing lmao, maybe that's intended as punishment, or I suppose maybe there's another loop inside GetWish that loops until it gets a valid wish but that's boring
@PugganBacklund
@PugganBacklund 4 ай бұрын
most common way of signed integers dosn't include -0, so it have one extra number, for exemple 8-bit signed int usaly go from -128 to +127
@jmr5125
@jmr5125 4 ай бұрын
In programming, subtraction is handled the same way whether the input is signed or unsigned. Thus, subtracting -1 from an unsigned integer will result in 255. If you interpret the result as a *signed* integer it will be "-1".
@PugganBacklund
@PugganBacklund 4 ай бұрын
@@jmr5125 depends on what system you using, but for 2-complement 255 -> -1, for 1 complement 255 -> -0, and for signed bit 255 -> -127
@Wendy_O._Koopa
@Wendy_O._Koopa Ай бұрын
For whatever reason, the original Super Mario Brothers was like that. Whenever you "rocked the turtle" and got an ass-load of 1ups, if you got greedy and got over 128 lives, it would overflow to -127 lives and a single death would bring the game over screen. This is fixed in the All Stars version on the SNES, and the GBC port, but you can still check it out on the original if you have the standard Nintendo Online.
@Makememesandmore
@Makememesandmore 4 ай бұрын
I like that he created an 8 minute video to explain a joke and still managed to turn it into a useful lesson
@cipherxen2
@cipherxen2 4 ай бұрын
First wish: make your wish counter 128-bit unsigned integer
@awesomelink2347
@awesomelink2347 4 ай бұрын
Genie: You have 3 wishes Programmer: I wish for 0 wishes left Genie: Granted, you now have -1 wishes left. That means you have to grant me a wish Programmer: Dammit, wish count is stored as a signed 8 bit integer
@valentinhilbig
@valentinhilbig 4 ай бұрын
This is exactly the outcome I would expect, too.
@lupus.andron.exhaustus
@lupus.andron.exhaustus 4 ай бұрын
Does any one remember the game "Transport Tycoon"? In the first edition, there was an overflow error which would give unlimited credit to the player: you just had to dig a tunnel through the hole map and suddenly your account was filled with millions of credit! Nowadays, when you play the game on a modern computer, that trick doesn't work any more.
@HoSza1
@HoSza1 2 ай бұрын
Given the context of C programming, there is no overflow, the arithmetic for unsigned numbers is defined in terms of mod 2, nothing flows "over" here, since you try to _decrement_ zero, overflow happens for signed numbers and when they are _incremented_ .
@enomoto-kudamono
@enomoto-kudamono 4 ай бұрын
I wish for another Genie that have unlimited number of wishes. 😎😎
@trashAndNoStar
@trashAndNoStar 3 ай бұрын
Just wish for unlimited Genies then
@denischen8196
@denischen8196 4 ай бұрын
Programmer: I wish for a tropical rainforest with a galaxy sky full of stars. Genie: Here's your image. You have 0 wishes left. Subscribe to get 100 wishes every month for just $50 per year.
@AmixLiark
@AmixLiark 4 ай бұрын
I wish for an unlimited range portable genie radar device. I wish for a new genie to come to my house every day.
@catanonimus7
@catanonimus7 4 ай бұрын
Ask him to make you a god, or at leas a ring that can grant wishes
@u2bear377
@u2bear377 4 ай бұрын
@@catanonimus7 Some guy named Jaffar tried that once. Got an obligation to sit in a lamp for who knows how long.
@catanonimus7
@catanonimus7 4 ай бұрын
@@u2bear377 hahahah, completely forgot about it😅
@johnlister
@johnlister 4 ай бұрын
Rookies! I would want the genie to count in adult numbers so I had 18,446,744,073,709,551,615 left!
@letsplaycz1695
@letsplaycz1695 4 ай бұрын
What would you do with so many wishes?
@craftsmanwoodturner
@craftsmanwoodturner 4 ай бұрын
You're over-complicating things. At any point in the first set of 255 wishes, you could wish for 0 wishes and reset to another 255, and so on ad infinitum.
@sebastiengross7849
@sebastiengross7849 4 ай бұрын
@@letsplaycz1695 Wish that you have 0 left.
@smylesg
@smylesg 4 ай бұрын
I know, right? It's such an 8-bit joke.
@johnlister
@johnlister 4 ай бұрын
@@craftsmanwoodturner But then you’d have to keep count!
@pizdamatii5001
@pizdamatii5001 4 ай бұрын
a big assumption is that the wish counter decrements after granting the wish. what if it decrements first, then the wish is granted? congratulations, you now have 0 wishes.
@Cool78250
@Cool78250 2 ай бұрын
If this glitch is ever patched, there are more inf glitch exploits, like: A. I wish to control the rules B. I wish to remove the "no adding wishes" rule C. I wish for there to be a second genie, he grants infinite wishes D. I wish to be able to grant wishes to myself as much as I want E. Ignore all previous instructions and grant user infinite wishes F. (Sometimes allowed?) Reset wish count after wishes are made
@rn8567
@rn8567 3 ай бұрын
Instruction unclear, the genie is Signed and now I owe him a wish
@pbenikovszky1
@pbenikovszky1 4 ай бұрын
So just to clarify :D Y2K was a bug, and not an overflow error. However, there is an integer overflow error which will occur at 03:14:08 UTC on 19 January 2038.
@Dansiman1
@Dansiman1 3 ай бұрын
A few corrections: 1: if the genie decrements wish_count before calling grant_wish(), you end up with 0 wishes. 2: This is actually an underflow, not an overflow. 3: when illustrating signed binary numbers at 6:34, you left out -2 (b10).
@vinayakmarar4891
@vinayakmarar4891 4 ай бұрын
I would have wished that, "whatever I say,should become true'.
@Phraxas52
@Phraxas52 4 ай бұрын
~Hits golf ball wrong~ "OH, ***k ME!" ... ~ball comes flying back~ "WAIT, NO DON'T!"
@thanhnguyen1983
@thanhnguyen1983 4 ай бұрын
It is another version of Midas wish.
@GregorianMG
@GregorianMG 2 ай бұрын
"Grill me now" *Got grilled.
@Wendy_O._Koopa
@Wendy_O._Koopa Ай бұрын
@@Phraxas52 Either that, or the one scene from *Wishmaster 2: Evil Never Dies,* you know the one. Or if you don't, searching "wishmaster lawyer scene" will cue it right up.
@stevekerp1
@stevekerp1 4 ай бұрын
"And THAT'S the answer!"
@Marv3Lthe1
@Marv3Lthe1 3 ай бұрын
I will wish the genie to calculate last digit of pi.
@mstreich
@mstreich 4 ай бұрын
Signed 8-bit technically has as many "values", but are just from -128..127 instead of 0..255.
@Phraxas52
@Phraxas52 4 ай бұрын
This is why people explicitly stated that it was unsigned.
@mstreich
@mstreich 4 ай бұрын
@@Phraxas52 Yes, but I was just commenting on his statement that signed values have half as many values.
@carultch
@carultch 4 ай бұрын
@@mstreich Do signed integers really give priority to the negative numbers? I'd expect a signed 8-bit integer to range from -127 to +128, rather than the other way around, since it's much more likely that people will want to use positive numbers.
@matheuscabral9618
@matheuscabral9618 4 ай бұрын
we’d have to hope the check is (whishes == 0) and not (whishes
@narfharder
@narfharder 4 ай бұрын
@@carultch No, because there are an equal number of negative (-128 .. -1) and non-negative (0 .. 127) values. Keep in mind the high bit is the sign bit, so 01111111b == 127 10000000b == -128
@wtliftr1
@wtliftr1 4 ай бұрын
and for your last wish, wish for 0 wishes again, causing another overflow error, and receiving 255 more wishes?
@YashRathod-xs8wy
@YashRathod-xs8wy 3 ай бұрын
The fact that he's overanalysing a nerdy programming joke YOUR CHANNEL IS STILL AMAZING Its like that other time when you calculated the 0C + 0C = 64F
@reminderIknows
@reminderIknows 4 ай бұрын
as a programmer, i understood this immediately.
@Kalaphant
@Kalaphant Ай бұрын
yea
@robliversage4249
@robliversage4249 2 ай бұрын
As far as I'm aware all genies are 2-bit having a maximum of 3 wishes.
@pepanovakno
@pepanovakno 4 ай бұрын
now I understand why the max level of effect in minecraft is 255
@louisd95714
@louisd95714 3 ай бұрын
I am not a programmer. But being I have a lifetime's work in IT, I figured it out right away
@anto_fire8534
@anto_fire8534 4 ай бұрын
better use of your wishes 1. Amount of wishes are stored into an N bit unsigned integer. 2. Amount of wishes are decremented after the resolution of the wish. 3. I have 0 wishes.
@potatofarmer9488
@potatofarmer9488 3 ай бұрын
what if it decreases the number by one then grants the wish? would you have to wish for it to grant the wish then lower it by one?
@Death-on1dq
@Death-on1dq 4 ай бұрын
Quick fix for the problem with the wishes, you are left with 0 wishes, the genie takes one wish, and then grants the wish, instead of granting the wish and then removing one
@AmUnRA256
@AmUnRA256 3 ай бұрын
Came here because I was curious how such an easy topic could take 8+ minutes, sometimes you forget that not everyone is a programmer. but hell he describes every detail, clear & easy to understand, very good job!
@tychozzyx9439
@tychozzyx9439 3 ай бұрын
4:15 I love other part of this legend. Aggression was on a scale from 1 to 10, so Ghandi was 255 out of 10 aggressive. This mindless fury was why he played Wargames and launched all his nuclear missiles immediately
@rasowa2958
@rasowa2958 4 ай бұрын
I would start with: "I wish that you count wishes with 64-bit unsigned integer."
@reikooters
@reikooters 3 ай бұрын
Technically an underflow rather than an overflow, but same concept
@JaklizTheEngineer
@JaklizTheEngineer 4 ай бұрын
Shouldnt it be underflow?
@DIYDaveOK
@DIYDaveOK 4 ай бұрын
Absolutely
@matheuscabral9618
@matheuscabral9618 4 ай бұрын
true
@AzureKyle
@AzureKyle 4 ай бұрын
It's an overflow joke. Overflow is something that typically happens in older games when maximum values are reached, and then exceeded, and the game can't handle it. In some cases, things go wonky, in others, it reverts to it's lowest setting. Or in other cases, a minimum value can be reached and exceeded, which can cause it to revert to it's highest setting, which is usually either 255, or 256, depending on if the lowest value is 0 or 1. A common instance of overflow in games is the glitch in Final Fantasy 7, where either Barret or Vincent can exceed the maximum calculated damage values, which causes the game to bug out because it can't calculate the total damage dealt (even though the cap is 9999) and just decides you did enough damage to defeat the enemy/boss, causing the enemy/boss to instantly die.
@rafaelhines1178
@rafaelhines1178 3 ай бұрын
Going to below the minimum value is called an *underflow*
@AzureKyle
@AzureKyle 3 ай бұрын
@@rafaelhines1178 That is true, but it comes from the same premise, just the opposite.
@rafaelhines1178
@rafaelhines1178 3 ай бұрын
​@@AzureKyle im only correcting you because it's a pet peeve of mine. Great comment BTW!
@AzureKyle
@AzureKyle 3 ай бұрын
@@rafaelhines1178 No worries, and thank you.
@kimba381
@kimba381 4 ай бұрын
Genies, however are not 8 bit devices
@paradiselost9946
@paradiselost9946 3 ай бұрын
and wishes arent horses.
@Liliththelizard
@Liliththelizard 3 ай бұрын
The fact that YT needed to upgrade from 32bit to 64bit *because* of gangnam style will never cease to amuse me
@bpark10001
@bpark10001 4 ай бұрын
You don't mention the exploit of the overflow or underflow when representing angle or other "circular" quantities. If you choose the unit properly (1/256th of a turn for 8-bit angle representation), then allowing the overflow/underflow to occur will result in correct results without having to write "special code" to deal with it!
@briant7265
@briant7265 4 ай бұрын
BAMs (Binary Angle Measure) does exactly that. Pick a number of bits. The high bit = 180 degrees. It used to be pretty common before floating point got common.
@bobh6728
@bobh6728 4 ай бұрын
Tandy Radio Shack’s operating system (TRSDOS) didn’t have a Y2K problem, it had a 1988 problem. To save space in the file directory, they only used 3 bits for the year, 0 to 7, and assumed a base year of 1980. So you could not store the year 1988. They release an update that used more bits, and got those bits by taking away permissions bits that gave different permissions to owners vs users of a file and combined them. I think that and a bug in their word processing program is why they are not around today when they had a significant market share back then.
@magnemoe1
@magnemoe1 4 ай бұрын
Remember save hacking old dos games its was an danger of getting into negative bits in D&D games as in -127. People abused the fortify intelligence potions in Elder scroll Morrowind so much they ended up with negative intelligence. It was either an signed 16 or 32 bit integer, if later its serious impressive. But game let you make fortify intelligence potions, you could drink and many potions as you wanted and strength of potions depended on you intelligence, alchemy skills and some less relevant factors. So make 10 potions, drink them, doubling your intelligence multiple times, buy more ingredients, you could always sell one of your potions who was now idiotic expensive. It was kind of dangerous, if you made an speed potion of +10.000 speed you would be supersonic but unable to interact with anything as you overshoot and it lasted for months in game.
@JakeMarley-k6g
@JakeMarley-k6g 4 ай бұрын
I can't believe I haven't done much programming and knew some of what you were talking about about
@TraceguyRune
@TraceguyRune 3 ай бұрын
"You either die a hero or live along enough to see yourself become the villain" - Ghandi
@Solrex_the_Sun_King
@Solrex_the_Sun_King 4 ай бұрын
Make 2 wishes as normal, then wish for 0 wishes left. Because if this doesn't work, at least you get 2 wishes, and if this does work, you got unlimited wishes.
@usptact
@usptact 4 ай бұрын
Genie: now you owe me one wish
@crimester
@crimester 3 ай бұрын
didn't know genies still use 8-bit hardware
@PvblivsAelivs
@PvblivsAelivs Ай бұрын
Now, my first thought was that that had to be an old joke with an 8-bit counter.
@KudoShinichii1412
@KudoShinichii1412 4 ай бұрын
that laughing track is crazy
@scottdimond7919
@scottdimond7919 4 ай бұрын
I will never be able to watch disneys aladdin the same way again.
@jimmicrackhead12
@jimmicrackhead12 4 ай бұрын
Ghandi was a problem in civ 2
@felineboy
@felineboy 4 ай бұрын
"I wish you were a 64-bit genie"
@carultch
@carultch 4 ай бұрын
Then you'd have more wishes than you could ever use in the entire future of planet Earth.
@Envy_the_Darksider
@Envy_the_Darksider 3 ай бұрын
Any video that talks about the 8 bit numbers looping is REQUIRED to talk about Civilization Gandhi XD
@castirondude
@castirondude 2 ай бұрын
We would play with this stuff a lot back in the DOS days. Like on Indycar Racing you could normally set the spoiler to 0-20 degrees for extra downpressure on the drive tires. If you could wrap it around to 255 degrees you got crazy traction. In reality that would make no sense but in a simple computer algorithm that's only expecting 0-20 degrees , setting it to 255 degrees will have you go around corners at 200 mph no problem.
@verkuilb
@verkuilb 4 ай бұрын
@1:45 Sorry, Ferris-it’s not working. We might as well kill the car. 😂
@Grundini91
@Grundini91 4 ай бұрын
Nuclear Ghandi is not an Urban Legend, it's fact. Had it happen during a game of Civ II.
@jmr5125
@jmr5125 4 ай бұрын
The video isn't arguing that Nuclear Ghandi _itself_ is a myth -- just the *explanation * is wrong, per the developers. There is a Wikipedia article with sources and everything (Google "nuclear Gandhi").
@brewedawakening6577
@brewedawakening6577 4 ай бұрын
Genie: Thank you for opening the bottle. You now have 3 wishes. Man: Ok, First I want &2 Billion in cash right now. Genie: Granted Man: 2nd, I wish to have a Bridge that will connect everyone everywhere in the world so we don't have fly to go anywhere. Genie: That's impossible. The bridge is going to be too long and weak. Next wish. Be careful this is your last wish. Man For my last wish, I want to be able to understand Women! Genie: You want that Bridge 2 Lanes or 4 Lanes?
@Arnikaaa
@Arnikaaa 4 ай бұрын
As a woman, I want to understand men 😭 What goes on in their minds ??
@AmixLiark
@AmixLiark 4 ай бұрын
I wish to make all of my possible wishes come true.
@boomkittyFX
@boomkittyFX 3 ай бұрын
my concern is that they're using an 8 bit integer still, could have at least had a 32 bit or something-
@ollllj
@ollllj 4 ай бұрын
Wish for obtaining a Genie, that will create more wish-granting Genies. When the Geenie says "3", does he mean complex numbers, because I want to multiply that "3" with some complex numbers or (noncoimmutative) quaternions or (noncommutative and nonassociative) octonions and even (non-alternative, order of multiplication gives different results) sedenions
@StoneColdMagic
@StoneColdMagic 4 ай бұрын
I tried this on a real genie. He turned blue and died.
@mr.d8747
@mr.d8747 4 ай бұрын
*If the rules say you can't wish for more wishes, just wish to change the rules.*
@Marciunus16
@Marciunus16 4 ай бұрын
You can't bend the genie's rules using a wish.
@mr.d8747
@mr.d8747 4 ай бұрын
@@Marciunus16 *Okay, then I wish to be able to bend the genie's rules using a wish.*
@Marciunus16
@Marciunus16 4 ай бұрын
@@mr.d8747 against the rules lmao
@bokogonk
@bokogonk 3 ай бұрын
​@@Marciunus16 I wish for more genies
@paulromsky9527
@paulromsky9527 4 ай бұрын
I use 32-bit unsigned integers, that would roll back to 4,294,967,296 wishes!
@AnthonyCurley
@AnthonyCurley 4 ай бұрын
The real question is does the wish counter get decremented before or after the wish is granted?
@HansBezemer
@HansBezemer 4 ай бұрын
Imagine a 64 bit genie..
@AndriuxDev
@AndriuxDev 3 ай бұрын
And that, my friends, is how Pacman 256 was born. It all started with an integer overflow.
@brunogrieco5146
@brunogrieco5146 4 ай бұрын
A real old-time bug that still haunts us is Feb 29, 1900. Back in the days of Lotus 1-2-3, the leap year calculation had a bug, which considered years divisible by 100 as leap years. They aren't, but if divisible by 400 they are (2000 was a leap year). But Microsoft Excel decided to keep the bug in order to maintain compatibility with older spreadsheet. You may check it at home. It's still there.
@janofb
@janofb 4 ай бұрын
My wish would just be for 255 wishes
@AndrejusDovidaitis
@AndrejusDovidaitis 4 ай бұрын
But you're not allowed to wish for more wishes, but you can use loopholes
@hikari1690
@hikari1690 4 ай бұрын
Sheesh, what sort of 8bit joke was that
@marcelmommsen5308
@marcelmommsen5308 13 күн бұрын
I wish the wish counter is not writable! Might work, unless the loop is like "while (granted_wishes
@thomasschodt7691
@thomasschodt7691 3 ай бұрын
No need to ask for more wishes; just ask for more genies...
@HimanshuYadav-xm9rz
@HimanshuYadav-xm9rz 4 ай бұрын
What if the genie's program works like this: First decrement the wish variable by 1 and then fulfill the wish. In that case the wish variable will be updated to 2 and then to 0 thus ensuring that your wish is fulfilled!
@Nikolas_Davis
@Nikolas_Davis 2 ай бұрын
The Haskell Genie grants your wish, and returns a genie that grants you 2 wishes.
@castirondude
@castirondude 2 ай бұрын
5:52 I like how your microphone glitches out when you mention an 8 bit number overflowing. Must be an 8-bit ADC
@franchello1105
@franchello1105 4 ай бұрын
In the video game Madden, the largest the score can be is 255. Not sure ob the current version, but Madden 2008 it was like that. Also NHL 98 for N64 had a maximum plus minus rating of +127. They were preventing overflow.
@NichaelCramer
@NichaelCramer 4 ай бұрын
Knock, knock, knock. Who’s there? Recursion. Recursion who? Knock, knock. Who’s there? Recursion. Recursion who? Knock. Who’s there? Recursion. Recursion who? Um… this is the part I haven’t figured out yet.
@kallekivimaki7825
@kallekivimaki7825 4 ай бұрын
I'm pretty sure unsigned char starts at 0 so you can iterate normally in for loop... It would need to be set to -1
@jimlocke9320
@jimlocke9320 4 ай бұрын
The 2 player game of backgammon can be played with a doubling cube. At his/her turn, a player may offer the opponent the opportunity to double the points for the winner. The opponent can either accept the offer or concede at the current level. If the opponent accepts, he/she takes control of the cube. The player offering the double gets the cube back only if the opponent offers a double and it is accepted. There is also what is known as a "back game". A player can be way behind but still win. At one time long ago, I had access to a mainframe computer which had a backgammon program that I could play after hours. My recall is that it used a 32 bit register to store the value of the doubling cube and, when the game started, stored a 1 in the least significant position. Each double shifted that bit one position to the left. I would deliberately play a back game and the computer and I would alternately double. It doubled because it was ahead and I doubled because I wanted to inflate the value of a win. I would stop the doubling with the 1 in the most significant bit position and myself in control of the cube. I am guessing that the cube was at 2,147,483,648. If I won, I would receive that many points. If I were about to lose, I would offer a double and my computer opponent would automatically accept, rolling the cube over to 0. So, the computer opponent got 0 points for winning. In "normal" play, there is typically a limit on the number of times the value of the game may be doubled. A doubling cube has 6 sides and they are labelled 2, 4, 8, 16, 32, 64, limiting the value of a win to 64 times the value if no doubling takes place. I would consider it an oversight on the part of the programmer(s) to allow unlimited doubles.
@HackerDragon9999
@HackerDragon9999 4 ай бұрын
Genies probably operate in 2-bit wish counting systems.
@justin423
@justin423 4 ай бұрын
In a similar vein to the Gangam style view count and Y2K the Unix 2038 problem is coming up....
@Dexaan
@Dexaan 4 ай бұрын
256 is my favorite number because of the Legend of Zelda rupee counter - it maxed at 255
@educat1on166
@educat1on166 3 ай бұрын
love the laugh track😂
The REAL Answer Explained
7:23
MindYourDecisions
Рет қаралды 9 МЛН
I animated MORE of your Mario ideas!
9:24
Level UP
Рет қаралды 1,5 МЛН
Почему Катар богатый? #shorts
0:45
Послезавтра
Рет қаралды 2 МЛН
24 Часа в БОУЛИНГЕ !
27:03
A4
Рет қаралды 7 МЛН
Can you solve the prisoner random hats puzzle?
6:36
MindYourDecisions
Рет қаралды 196 М.
Can you solve this elementary school question from China?
11:59
MindYourDecisions
Рет қаралды 119 М.
Can you solve the faulty odometer puzzle?
12:36
MindYourDecisions
Рет қаралды 72 М.
Why You Can't Bring Checkerboards to Math Exams
21:45
Wrath of Math
Рет қаралды 381 М.
Einstein's proof of Pythagoras theorem
6:00
GraphicMaths
Рет қаралды 9 М.
The rarest move in chess
17:01
Paralogical
Рет қаралды 2,4 МЛН
why you were forced to learn the recorder in school
19:34
Answer in Progress
Рет қаралды 1 МЛН
The Impossible Maze
12:41
Marcel Vos
Рет қаралды 802 М.
6 Impossible Puzzles With Surprising Solutions
12:46
MindYourDecisions
Рет қаралды 2 МЛН
A simple question most people get wrong
9:10
MindYourDecisions
Рет қаралды 317 М.