Programmer joke

  Рет қаралды 138,273

MindYourDecisions

MindYourDecisions

Күн бұрын

Пікірлер: 532
@vincent412l7
@vincent412l7 2 ай бұрын
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 2 ай бұрын
Kinky...!
@sitnamkrad
@sitnamkrad 2 ай бұрын
Or 0 wishes, since this example is making the assumption that the decrement happens *after* granting the wish.
@yurenchu
@yurenchu 2 ай бұрын
​​​​@@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 2 ай бұрын
@@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 2 ай бұрын
@@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 2 ай бұрын
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 2 ай бұрын
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 2 ай бұрын
@@yurenchu just wish for a bigger storage
@yurenchu
@yurenchu 2 ай бұрын
​@@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 2 ай бұрын
No, i wish the count is stored as a ulong
@Yusso
@Yusso 2 ай бұрын
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 2 ай бұрын
Well that must be an old 8-bit genie. Imagine if it was a 32 bit genie...
@Djou-Karl
@Djou-Karl 2 ай бұрын
4.3 billons wishes , let's go!
@maxaafbackname5562
@maxaafbackname5562 2 ай бұрын
64 is the norm today Nearly unlimited wishes.
@xdkristof
@xdkristof 2 ай бұрын
Granted! You now have 4.294.967.295 wishes left.
@TojosWizzyWorld
@TojosWizzyWorld 2 ай бұрын
Imagine if it was a double…..
@maxaafbackname5562
@maxaafbackname5562 2 ай бұрын
@@TojosWizzyWorld doubles have problems decrementing unit by large values.
@Blue2x2x
@Blue2x2x 2 ай бұрын
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 Ай бұрын
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.
@Cenzo1999
@Cenzo1999 2 ай бұрын
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 2 ай бұрын
That's not a very rainbow-friendly statement, though. 🌈
@WizDaPenguin
@WizDaPenguin 2 ай бұрын
yeah but why do rainbows need to be included
@Yonkage-ik5qb
@Yonkage-ik5qb 2 ай бұрын
There are two types of people in the world, those who can extrapolate from incomplete information
@yurenchu
@yurenchu 2 ай бұрын
@@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 2 ай бұрын
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.
@aaronbredon2948
@aaronbredon2948 2 ай бұрын
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 2 ай бұрын
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 2 ай бұрын
So the Genie has to be bug-fixed.
@Rikaisan
@Rikaisan 2 ай бұрын
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 2 ай бұрын
while(wishes > 0)
@gartnl
@gartnl 2 ай бұрын
@@Rikaisan An invalid wish is still a wish.
@IanHsieh
@IanHsieh 3 ай бұрын
Next joke: Why would a programmer get confused with Halloween and Christmas?
@Evil_Jyan
@Evil_Jyan 2 ай бұрын
they are 50 yards from your location
@docsigma
@docsigma 2 ай бұрын
Because oct(31) = dec(25)
@MountainHawkPYL
@MountainHawkPYL 2 ай бұрын
@@docsigma correct
@IanHsieh
@IanHsieh 2 ай бұрын
@@docsigma Correct
@wyattstevens8574
@wyattstevens8574 2 ай бұрын
31 (oct) = 25 (dec)
@evanrosman9226
@evanrosman9226 2 ай бұрын
I might make 2 regular wishes first just incase.
@MrKanilammit
@MrKanilammit 2 ай бұрын
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 2 ай бұрын
​@@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 2 ай бұрын
Me too
@TraceguyRune
@TraceguyRune 2 ай бұрын
@@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 2 ай бұрын
@@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.
@MichaelPiz
@MichaelPiz 2 ай бұрын
Just thought of a way around the "no wishing for more wishes" rule: wish for more genies.
@matheuscabral9618
@matheuscabral9618 2 ай бұрын
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 2 ай бұрын
​@@matheuscabral9618they are exemplars of the class genie, so obviously each has his own variables
@matheuscabral9618
@matheuscabral9618 2 ай бұрын
@@catanonimus7 but that was only until the patch 1.6.2, unless you were somehow able to downgrade
@ollllj
@ollllj 2 ай бұрын
@@matheuscabral9618 just wish to obtain a genie, that can create wish-fulfilling genies. so no constraining loopholes are left.
@christopherwellman2364
@christopherwellman2364 2 ай бұрын
Genius
@trchri
@trchri 2 ай бұрын
Wife: Get a loaf of bread; and if they have eggs, get a dozen. Programmer returns with a dozen loaves of bread.
@yurenchu
@yurenchu 2 ай бұрын
Shouldn't the programmer return with _13_ loaves of bread?
@marcusscience23
@marcusscience23 2 ай бұрын
@@yurenchuThat’s a baker’s dozen, not a dozen
@calvinbarbanell2449
@calvinbarbanell2449 2 ай бұрын
@@marcusscience23 the programmer should be getting a loaf of bread AND a dozen loaves of bread, for a total of 13 loaves.
@marcusscience23
@marcusscience23 2 ай бұрын
@@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 2 ай бұрын
@@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.)
@Ostap1974
@Ostap1974 2 ай бұрын
Any experienced genie would decrease left wishes before granting the wish. It must have been a junior developer probably.
@jeremy6384
@jeremy6384 2 ай бұрын
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 2 ай бұрын
If that's the case, just wish to lose 3 wishes.
@MrBerryK
@MrBerryK 2 ай бұрын
Wish- - vs - -wish
@Sonnell
@Sonnell 2 ай бұрын
Or simply check for correct wish values every time before calling the grantwishes function.
@williamdrum9899
@williamdrum9899 2 ай бұрын
​@@MrBerryK Gotta love C footguns, especially this one which isn't a problem in assembly
@ЭролСезгин
@ЭролСезгин 2 ай бұрын
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 2 ай бұрын
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 2 ай бұрын
Genie does nothing and wins, even in the second iteration of the loop it just works.
@zane6138
@zane6138 2 ай бұрын
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 2 ай бұрын
no critical error, no recursion
@Genuenly
@Genuenly 17 күн бұрын
The script run line by line , making the third wish do nothing
@smilerbob
@smilerbob 2 ай бұрын
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 2 ай бұрын
Just pull the plug out from the power outlet, wait for a minute, and plug it back into it again.
@mher_22
@mher_22 2 ай бұрын
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 😔
@paulowen637
@paulowen637 2 ай бұрын
Don't ask for NULL wishes, you may crash the genie.
@LD-dt1sk
@LD-dt1sk 2 ай бұрын
NULL = 0
@dark3031
@dark3031 2 ай бұрын
@@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 2 ай бұрын
@@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 2 ай бұрын
Null != 0. 0 is something. Null is nothing.
@adama7752
@adama7752 2 ай бұрын
@@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
@3141minecraft
@3141minecraft 2 ай бұрын
0:23 me: I wish there was no rules
2 ай бұрын
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 2 ай бұрын
Why not 2 8-bit bytes (16 bites) or for that matter, 64 bites?
2 ай бұрын
@@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 2 ай бұрын
@@zoranocokoljic8927 You can repeat the "counter to 0 wish" over and over. That is unlimited already.
@UserJ1513
@UserJ1513 2 ай бұрын
This is why you decrement the variable first then grant the wish, wishes become 2 then 0.
@kingsley.
@kingsley. 2 ай бұрын
Then wish for 0 minus 1 wishes.
@chrisvienna11
@chrisvienna11 2 ай бұрын
@@kingsley. it would be too late for that approach
@TraceguyRune
@TraceguyRune 2 ай бұрын
@@kingsley. No.... Why the hell would you decrement wishes twice for a single wish? That would make you a scammer Genie
@berndschneider9277
@berndschneider9277 2 ай бұрын
Actual overflow in Civilization I: Treasury jumps from 32767 to 0. I can hear myself swearing still today.
@smylesg
@smylesg 2 ай бұрын
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 2 ай бұрын
"I wish the Genie decrement my wish count *after* granting my wish"
@PowerStar004
@PowerStar004 2 ай бұрын
@@rexygama7697 Turns out it's a *signed* integer and now you have -1 wishes.
@Nethuja_GunawardaneSL
@Nethuja_GunawardaneSL 2 ай бұрын
@@rexygama7697 Looks like the genie can be exploited very easily
@genxjack72
@genxjack72 2 ай бұрын
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 Ай бұрын
@@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
@fakegrek
@fakegrek 2 ай бұрын
Unless you first decrement wishes and then grant them.
@johnlister
@johnlister 2 ай бұрын
Rookies! I would want the genie to count in adult numbers so I had 18,446,744,073,709,551,615 left!
@letsplaycz1695
@letsplaycz1695 2 ай бұрын
What would you do with so many wishes?
@craftsmanwoodturner
@craftsmanwoodturner 2 ай бұрын
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 2 ай бұрын
@@letsplaycz1695 Wish that you have 0 left.
@smylesg
@smylesg 2 ай бұрын
I know, right? It's such an 8-bit joke.
@johnlister
@johnlister 2 ай бұрын
@@craftsmanwoodturner But then you’d have to keep count!
@Fabibeni1
@Fabibeni1 2 ай бұрын
“I wish for -9,223,372,036,854,775,808 wishes!”
@PugganBacklund
@PugganBacklund 2 ай бұрын
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 2 ай бұрын
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 2 ай бұрын
@@jmr5125 depends on what system you using, but for 2-complement 255 -> -1, for 1 complement 255 -> -0, and for signed bit 255 -> -127
@Makememesandmore
@Makememesandmore 2 ай бұрын
I like that he created an 8 minute video to explain a joke and still managed to turn it into a useful lesson
@Cool78250
@Cool78250 Ай бұрын
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
@pizdamatii5001
@pizdamatii5001 2 ай бұрын
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.
@lupus.andron.exhaustus
@lupus.andron.exhaustus 2 ай бұрын
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.
@enomoto-kudamono
@enomoto-kudamono 2 ай бұрын
I wish for another Genie that have unlimited number of wishes. 😎😎
@trashAndNoStar
@trashAndNoStar 2 ай бұрын
Just wish for unlimited Genies then
@AmixLiark
@AmixLiark 2 ай бұрын
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 2 ай бұрын
Ask him to make you a god, or at leas a ring that can grant wishes
@u2bear377
@u2bear377 2 ай бұрын
@@catanonimus7 Some guy named Jaffar tried that once. Got an obligation to sit in a lamp for who knows how long.
@catanonimus7
@catanonimus7 2 ай бұрын
@@u2bear377 hahahah, completely forgot about it😅
@vinayakmarar4891
@vinayakmarar4891 2 ай бұрын
I would have wished that, "whatever I say,should become true'.
@Phraxas52
@Phraxas52 2 ай бұрын
~Hits golf ball wrong~ "OH, ***k ME!" ... ~ball comes flying back~ "WAIT, NO DON'T!"
@thanhnguyen1983
@thanhnguyen1983 2 ай бұрын
It is another version of Midas wish.
@GregorianMG
@GregorianMG 23 күн бұрын
"Grill me now" *Got grilled.
@awesomelink2347
@awesomelink2347 2 ай бұрын
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 2 ай бұрын
This is exactly the outcome I would expect, too.
@mstreich
@mstreich 2 ай бұрын
Signed 8-bit technically has as many "values", but are just from -128..127 instead of 0..255.
@Phraxas52
@Phraxas52 2 ай бұрын
This is why people explicitly stated that it was unsigned.
@mstreich
@mstreich 2 ай бұрын
@@Phraxas52 Yes, but I was just commenting on his statement that signed values have half as many values.
@carultch
@carultch 2 ай бұрын
@@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 2 ай бұрын
we’d have to hope the check is (whishes == 0) and not (whishes
@narfharder
@narfharder 2 ай бұрын
@@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
@verkuilb
@verkuilb 2 ай бұрын
@1:45 Sorry, Ferris-it’s not working. We might as well kill the car. 😂
@HoSza1
@HoSza1 Ай бұрын
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_ .
@Dansiman1
@Dansiman1 2 ай бұрын
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).
@anto_fire8534
@anto_fire8534 2 ай бұрын
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.
@YashRathod-xs8wy
@YashRathod-xs8wy 2 ай бұрын
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
@wtliftr1
@wtliftr1 2 ай бұрын
and for your last wish, wish for 0 wishes again, causing another overflow error, and receiving 255 more wishes?
@tychozzyx9439
@tychozzyx9439 2 ай бұрын
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
@rn8567
@rn8567 2 ай бұрын
Instruction unclear, the genie is Signed and now I owe him a wish
@pbenikovszky1
@pbenikovszky1 2 ай бұрын
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.
@Death-on1dq
@Death-on1dq 2 ай бұрын
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
@JaklizTheEngineer
@JaklizTheEngineer 2 ай бұрын
Shouldnt it be underflow?
@DIYDaveOK
@DIYDaveOK 2 ай бұрын
Absolutely
@matheuscabral9618
@matheuscabral9618 2 ай бұрын
true
@robliversage4249
@robliversage4249 23 күн бұрын
As far as I'm aware all genies are 2-bit having a maximum of 3 wishes.
@louisd95714
@louisd95714 2 ай бұрын
I am not a programmer. But being I have a lifetime's work in IT, I figured it out right away
@Solrex_the_Sun_King
@Solrex_the_Sun_King 2 ай бұрын
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.
@Makememesandmore
@Makememesandmore 2 ай бұрын
4:58 - 5:48 that'll be fun to turn into algebraic equations
@rasowa2958
@rasowa2958 2 ай бұрын
I would start with: "I wish that you count wishes with 64-bit unsigned integer."
@magnemoe1
@magnemoe1 2 ай бұрын
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.
@cipherxen2
@cipherxen2 2 ай бұрын
First wish: make your wish counter 128-bit unsigned integer
@potatofarmer9488
@potatofarmer9488 2 ай бұрын
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?
@Liliththelizard
@Liliththelizard 2 ай бұрын
The fact that YT needed to upgrade from 32bit to 64bit *because* of gangnam style will never cease to amuse me
@NichaelCramer
@NichaelCramer 2 ай бұрын
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.
@Marv3Lthe1
@Marv3Lthe1 Ай бұрын
I will wish the genie to calculate last digit of pi.
@AzureKyle
@AzureKyle 2 ай бұрын
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 2 ай бұрын
Going to below the minimum value is called an *underflow*
@AzureKyle
@AzureKyle 2 ай бұрын
@@rafaelhines1178 That is true, but it comes from the same premise, just the opposite.
@rafaelhines1178
@rafaelhines1178 2 ай бұрын
​@@AzureKyle im only correcting you because it's a pet peeve of mine. Great comment BTW!
@AzureKyle
@AzureKyle 2 ай бұрын
@@rafaelhines1178 No worries, and thank you.
@castirondude
@castirondude Ай бұрын
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.
@brewedawakening6577
@brewedawakening6577 2 ай бұрын
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 2 ай бұрын
As a woman, I want to understand men 😭 What goes on in their minds ??
@Envy_the_Darksider
@Envy_the_Darksider Ай бұрын
Any video that talks about the 8 bit numbers looping is REQUIRED to talk about Civilization Gandhi XD
@reikooters
@reikooters 2 ай бұрын
Technically an underflow rather than an overflow, but same concept
@Grundini91
@Grundini91 2 ай бұрын
Nuclear Ghandi is not an Urban Legend, it's fact. Had it happen during a game of Civ II.
@jmr5125
@jmr5125 2 ай бұрын
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").
@justin423
@justin423 2 ай бұрын
In a similar vein to the Gangam style view count and Y2K the Unix 2038 problem is coming up....
@PvblivsAelivs
@PvblivsAelivs 5 күн бұрын
Now, my first thought was that that had to be an old joke with an 8-bit counter.
@pepanovakno
@pepanovakno 2 ай бұрын
now I understand why the max level of effect in minecraft is 255
@AmUnRA256
@AmUnRA256 Ай бұрын
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!
@kimba381
@kimba381 2 ай бұрын
Genies, however are not 8 bit devices
@paradiselost9946
@paradiselost9946 Ай бұрын
and wishes arent horses.
@uplink-on-yt
@uplink-on-yt 2 ай бұрын
Another analogy: when Ms Pacman exits the board on the edge of the screen and pops back in on the opposite edge. What's Ms Pacman, you ask? Well, I'd tell you to get off my lawn if I had a lawn. 😆
@jimmicrackhead12
@jimmicrackhead12 2 ай бұрын
Ghandi was a problem in civ 2
@reminderIknows
@reminderIknows 2 ай бұрын
as a programmer, i understood this immediately.
@Kalaphant
@Kalaphant 13 күн бұрын
yea
@TraceguyRune
@TraceguyRune 2 ай бұрын
"You either die a hero or live along enough to see yourself become the villain" - Ghandi
@paulromsky9527
@paulromsky9527 2 ай бұрын
I use 32-bit unsigned integers, that would roll back to 4,294,967,296 wishes!
@Dexaan
@Dexaan 2 ай бұрын
256 is my favorite number because of the Legend of Zelda rupee counter - it maxed at 255
@ArandelaGriffe
@ArandelaGriffe 7 күн бұрын
Born in 80', Play "pong" Atari7800, 8bit Master system, 16bit Megadrive, 32bit Genesis, 64bit N64... Those are the bits of my life XD
@HimanshuYadav-xm9rz
@HimanshuYadav-xm9rz 2 ай бұрын
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!
@JakeMarley-k6g
@JakeMarley-k6g 2 ай бұрын
I can't believe I haven't done much programming and knew some of what you were talking about about
@jonathanhibberd9983
@jonathanhibberd9983 2 ай бұрын
My favorite programmer joke: Why did the computer programmer confuse Christmas and Halloween? Because Oct31 = Dec25.
@bokogonk
@bokogonk 2 ай бұрын
Four programmers are seated in a restaurant. The waiter asks, "do you all want water?" Programmer #1 says, "I don't know". Programmer #2 says, "I don't know". Programmer #3 says, "I don't know". Programmer #4 says, "Yes. 4 waters please".
@jonathanhibberd9983
@jonathanhibberd9983 2 ай бұрын
@@bokogonk That's got very "Brennan Lee Mulligan at the start of every Make Some Noise episode he's in" energy. 🤣
@Kalaphant
@Kalaphant 13 күн бұрын
@@bokogonk Can you explain?
@bokogonk
@bokogonk 13 күн бұрын
@@Kalaphant the question is whether they ALL want water. Each programmer wants water, but they don't know whether the others want water too. If "true" means they want water and "false" means they don't, then all of them wanting water would look like: true AND true AND true AND true = true. If even just a single one of them doesn't want water, then: true AND true AND false AND true = false. So if Programmer #1 wants water (true), they don't know the answer to the question because any one of them could say no. But if Programmer #1 doesn't want water (false), then it doesn't matter what the others want because the statement would return "false" anyway, so they would just say no. Programmers 2-3 follow the same logic. When it's Programmer #4's turn to answer, 1-3 already said "I don't know". Since none of them said "no" (false), that means the three of them do want water (true). Since #4 also wants water (true), they say "yes, four waters please"
@Kalaphant
@Kalaphant 13 күн бұрын
@@bokogonk Thanks! That's really cool lol (Reminds me of the green eyed riddle)
@atlas2296
@atlas2296 2 ай бұрын
Just hope the genie programming language uses wraparound overflow errors and doesn’t just spit out “error overflow line 13”
@stevekerp1
@stevekerp1 2 ай бұрын
"And THAT'S the answer!"
@mr.d8747
@mr.d8747 2 ай бұрын
*If the rules say you can't wish for more wishes, just wish to change the rules.*
@Marciunus16
@Marciunus16 2 ай бұрын
You can't bend the genie's rules using a wish.
@mr.d8747
@mr.d8747 2 ай бұрын
@@Marciunus16 *Okay, then I wish to be able to bend the genie's rules using a wish.*
@Marciunus16
@Marciunus16 2 ай бұрын
@@mr.d8747 against the rules lmao
@bokogonk
@bokogonk 2 ай бұрын
​@@Marciunus16 I wish for more genies
@HackerDragon9999
@HackerDragon9999 2 ай бұрын
Genies probably operate in 2-bit wish counting systems.
@Tyranitar66501
@Tyranitar66501 2 ай бұрын
Reminds me of the Experience Underflow glitch in Pokemon Red and Blue.
@AndriuxDev
@AndriuxDev 2 ай бұрын
And that, my friends, is how Pacman 256 was born. *It all started with an integer overflow.*
@boomkittyFX
@boomkittyFX 2 ай бұрын
my concern is that they're using an 8 bit integer still, could have at least had a 32 bit or something-
@bobh6728
@bobh6728 2 ай бұрын
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.
@darko_n6819
@darko_n6819 2 ай бұрын
Ask the genie for a pointer and he will take a dump to your core.
@SusanBell-dl5gr
@SusanBell-dl5gr 2 ай бұрын
If the programmer has 3 wishes to start with they need to wish the Genie has a 64 bit counter first before wishing they have 0 wishes.
@sergeboisse
@sergeboisse Ай бұрын
A Genie that stupidly executes all wishes is called a Golem. Golem are very dangerous. If you ask one of them to, say, solve the Goldbach conjecture, he would possibly turn the whole planet, including all life on it, into a giant quantum computer. Sooner or later (and maybe sooner that you expect) we'll be facing that kind of challenge with nano-powered AI. Solution ? We MUST create only human-friendly AIs.
@brunogrieco5146
@brunogrieco5146 2 ай бұрын
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.
@That1SupportiveFriend
@That1SupportiveFriend 2 ай бұрын
Another example of the integer overflow occurs in Pokémon red, blue, green and yellow. Through a series of steps, you can encounter a wild level 1 Nidoking in viridian forest before the first gym. After catching it, just level it up once from a battle and it will cause the overflow. The overflow will cause the Nidoking to insta level up to 100 and from there you can effectively steam roll through the rest of the game.
@wesplybon9510
@wesplybon9510 2 ай бұрын
That's just bad code. Been a software developer for 20 years. Immediately understood the premise, but the specifics took me a few to wrap my head around. That whole, decrement AFTER the wish is not how I would have written it. In addition to allowing the underflow to happen, all the user has to do is figure out a way to crash the program after the wish has been granted (or enough of the wish has been granted) but before the decrement and the genie would have NO clue that anything at all happened.
@bpark10001
@bpark10001 2 ай бұрын
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 2 ай бұрын
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.
@Nikolas_Davis
@Nikolas_Davis Ай бұрын
The Haskell Genie grants your wish, and returns a genie that grants you 2 wishes.
@Rudxain
@Rudxain 2 ай бұрын
This is known as modular ("wrap-around") arithmetic, in contrast to saturating ("clamping") arithmetic (commonly used by fixed-precision floating-point numbers)
@pierreabbat6157
@pierreabbat6157 2 ай бұрын
All right, I'll byte. A related bug is the Taveuni bug, which is the inability of some geographic programs to cross the 180th meridian. In OpenStreetMap, Taveuni, which straddles the antimeridian, is in two pieces because of this bug.
@chrisbecke2793
@chrisbecke2793 2 ай бұрын
Now explain 2s complement.
@briant7265
@briant7265 2 ай бұрын
To get the negative, flip all bits (ones complement) and add 1. 1 = 0000 0001 1's complement = 1111 1110 2's complement = 1111 1111 It makes for simple computation. Also 0 = 0000 0000 subtract 0000 0001 -1 = 1111 1111 (underflow) And continues as you count farther backwards. Negative is indicated by the high bit, so 0111 1111 = 127 plus 1 is 1000 0000 = -128 (overflow)
@StoneColdMagic
@StoneColdMagic 2 ай бұрын
I tried this on a real genie. He turned blue and died.
@aaronmorris1513
@aaronmorris1513 2 ай бұрын
Genie 2.0 moves the decrement operation before the wish grant operation.
@matheuscabral9618
@matheuscabral9618 2 ай бұрын
so you say “decrease the number of wishes I have by one” when you have 1 wish
@castirondude
@castirondude Ай бұрын
5:52 I like how your microphone glitches out when you mention an 8 bit number overflowing. Must be an 8-bit ADC
@bg6b7bft
@bg6b7bft 2 ай бұрын
The Nintendo game Wild Arms had this bug. You input your actions for your three characters at the beginning of each round. If you have 1 potion, you can use two potions and end up with 255 potions.
@felineboy
@felineboy 2 ай бұрын
"I wish you were a 64-bit genie"
@carultch
@carultch 2 ай бұрын
Then you'd have more wishes than you could ever use in the entire future of planet Earth.
@BronyNumber4096
@BronyNumber4096 2 ай бұрын
When I saw the thumbnail, I thought it was just one of those "I don't WANT the wishes! I know how you genies work! I know you twist the wishes into something horrible!"
AI can be bad at math, and stubborn
10:47
MindYourDecisions
Рет қаралды 112 М.
ТЫ В ДЕТСТВЕ КОГДА ВЫПАЛ ЗУБ😂#shorts
00:59
BATEK_OFFICIAL
Рет қаралды 3,7 МЛН
ТВОИ РОДИТЕЛИ И ЧЕЛОВЕК ПАУК 😂#shorts
00:59
BATEK_OFFICIAL
Рет қаралды 4 МЛН
Someone improved my code by 40,832,277,770%
28:47
Stand-up Maths
Рет қаралды 2,6 МЛН
Impossible Logic Puzzle from Indonesia!
13:46
MindYourDecisions
Рет қаралды 138 М.
Why Are Cooling Towers Shaped Like That?
19:48
Practical Engineering
Рет қаралды 2,5 МЛН
How To Catch A Cheater With Math
22:38
Primer
Рет қаралды 5 МЛН
Internet is going wild over this problem
9:12
MindYourDecisions
Рет қаралды 908 М.
The Strange Physics Principle That Shapes Reality
32:44
Veritasium
Рет қаралды 6 МЛН
Viral logic test from Brazil
6:41
MindYourDecisions
Рет қаралды 2,9 МЛН
How on Earth does ^.?$|^(..+?)\1+$ produce primes?
18:37
Stand-up Maths
Рет қаралды 392 М.
Impossible Dutchmen's Wives Puzzle
11:51
MindYourDecisions
Рет қаралды 88 М.
The Quest To Make Unbreakable Glass
22:23
Veritasium
Рет қаралды 2,4 МЛН
ТЫ В ДЕТСТВЕ КОГДА ВЫПАЛ ЗУБ😂#shorts
00:59
BATEK_OFFICIAL
Рет қаралды 3,7 МЛН