In real life, you may get 255 wishes, or you msy get (-1) wish, and have to perform one wish for the genie.
@ArabianShark2 ай бұрын
Kinky...!
@sitnamkrad2 ай бұрын
Or 0 wishes, since this example is making the assumption that the decrement happens *after* granting the wish.
@yurenchu2 ай бұрын
@@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.
@sitnamkrad2 ай бұрын
@@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.
@andreaspatounis56742 ай бұрын
@@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)
@MoonGlow222 ай бұрын
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
@yurenchu2 ай бұрын
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.
@gabrielgauchez94352 ай бұрын
@@yurenchu just wish for a bigger storage
@yurenchu2 ай бұрын
@@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...
@weibrot66832 ай бұрын
No, i wish the count is stored as a ulong
@Yusso2 ай бұрын
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
@javoresku2 ай бұрын
Well that must be an old 8-bit genie. Imagine if it was a 32 bit genie...
@Djou-Karl2 ай бұрын
4.3 billons wishes , let's go!
@maxaafbackname55622 ай бұрын
64 is the norm today Nearly unlimited wishes.
@xdkristof2 ай бұрын
Granted! You now have 4.294.967.295 wishes left.
@TojosWizzyWorld2 ай бұрын
Imagine if it was a double…..
@maxaafbackname55622 ай бұрын
@@TojosWizzyWorld doubles have problems decrementing unit by large values.
@Blue2x2x2 ай бұрын
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Ай бұрын
Idk why this is so underrated
@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.
@Cenzo19992 ай бұрын
One of my fave t-shirts, "There are 10 types of people in the world, those who know binary and those who don't."
@yurenchu2 ай бұрын
That's not a very rainbow-friendly statement, though. 🌈
@WizDaPenguin2 ай бұрын
yeah but why do rainbows need to be included
@Yonkage-ik5qb2 ай бұрын
There are two types of people in the world, those who can extrapolate from incomplete information
@yurenchu2 ай бұрын
@@Yonkage-ik5qb ... and those who only extrapolate from complete information. By the way, I think the word "can" doesn't really belong there.
@marcusscience232 ай бұрын
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.
@aaronbredon29482 ай бұрын
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.
@Cornelis19832 ай бұрын
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-7772 ай бұрын
So the Genie has to be bug-fixed.
@Rikaisan2 ай бұрын
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
@harshitshivhare8392 ай бұрын
while(wishes > 0)
@gartnl2 ай бұрын
@@Rikaisan An invalid wish is still a wish.
@IanHsieh3 ай бұрын
Next joke: Why would a programmer get confused with Halloween and Christmas?
@Evil_Jyan2 ай бұрын
they are 50 yards from your location
@docsigma2 ай бұрын
Because oct(31) = dec(25)
@MountainHawkPYL2 ай бұрын
@@docsigma correct
@IanHsieh2 ай бұрын
@@docsigma Correct
@wyattstevens85742 ай бұрын
31 (oct) = 25 (dec)
@evanrosman92262 ай бұрын
I might make 2 regular wishes first just incase.
@MrKanilammit2 ай бұрын
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_No2 ай бұрын
@@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.
@markusheed42722 ай бұрын
Me too
@TraceguyRune2 ай бұрын
@@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_No2 ай бұрын
@@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.
@MichaelPiz2 ай бұрын
Just thought of a way around the "no wishing for more wishes" rule: wish for more genies.
@matheuscabral96182 ай бұрын
unfortunately the wish variable is global, so if you ask for another gene, you will still only have 2 wishes between both of them
@catanonimus72 ай бұрын
@@matheuscabral9618they are exemplars of the class genie, so obviously each has his own variables
@matheuscabral96182 ай бұрын
@@catanonimus7 but that was only until the patch 1.6.2, unless you were somehow able to downgrade
@ollllj2 ай бұрын
@@matheuscabral9618 just wish to obtain a genie, that can create wish-fulfilling genies. so no constraining loopholes are left.
@christopherwellman23642 ай бұрын
Genius
@trchri2 ай бұрын
Wife: Get a loaf of bread; and if they have eggs, get a dozen. Programmer returns with a dozen loaves of bread.
@yurenchu2 ай бұрын
Shouldn't the programmer return with _13_ loaves of bread?
@marcusscience232 ай бұрын
@@yurenchuThat’s a baker’s dozen, not a dozen
@calvinbarbanell24492 ай бұрын
@@marcusscience23 the programmer should be getting a loaf of bread AND a dozen loaves of bread, for a total of 13 loaves.
@marcusscience232 ай бұрын
@@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
@yurenchu2 ай бұрын
@@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.)
@Ostap19742 ай бұрын
Any experienced genie would decrease left wishes before granting the wish. It must have been a junior developer probably.
@jeremy63842 ай бұрын
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.
@vinsplayer26342 ай бұрын
If that's the case, just wish to lose 3 wishes.
@MrBerryK2 ай бұрын
Wish- - vs - -wish
@Sonnell2 ай бұрын
Or simply check for correct wish values every time before calling the grantwishes function.
@williamdrum98992 ай бұрын
@@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
@SpaceUK452 ай бұрын
Was gonna say something like "they implemented a bugfix etc etc" but i'm not a programmer i have no idea what im saying
@Miscio942 ай бұрын
Genie does nothing and wins, even in the second iteration of the loop it just works.
@zane61382 ай бұрын
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.
@avovk18522 ай бұрын
no critical error, no recursion
@Genuenly17 күн бұрын
The script run line by line , making the third wish do nothing
@smilerbob2 ай бұрын
I just found a magic lamp and tried this on the Genie… The Genie muttered something about a buffer underrun and stopped responding 🤷🏻♂️
@yurenchu2 ай бұрын
Just pull the plug out from the power outlet, wait for a minute, and plug it back into it again.
@mher_222 ай бұрын
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 😔
@paulowen6372 ай бұрын
Don't ask for NULL wishes, you may crash the genie.
@LD-dt1sk2 ай бұрын
NULL = 0
@dark30312 ай бұрын
@@LD-dt1sk It's very misleading to put it that way though. If you try to do any arithmetic operations with that 0...
@MexoOne2 ай бұрын
@@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
@bendystrawz28322 ай бұрын
Null != 0. 0 is something. Null is nothing.
@adama77522 ай бұрын
@@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
@3141minecraft2 ай бұрын
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. 🤣
@zoranocokoljic89272 ай бұрын
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.😉🤣
@thanhnguyen19832 ай бұрын
@@zoranocokoljic8927 You can repeat the "counter to 0 wish" over and over. That is unlimited already.
@UserJ15132 ай бұрын
This is why you decrement the variable first then grant the wish, wishes become 2 then 0.
@kingsley.2 ай бұрын
Then wish for 0 minus 1 wishes.
@chrisvienna112 ай бұрын
@@kingsley. it would be too late for that approach
@TraceguyRune2 ай бұрын
@@kingsley. No.... Why the hell would you decrement wishes twice for a single wish? That would make you a scammer Genie
@berndschneider92772 ай бұрын
Actual overflow in Civilization I: Treasury jumps from 32767 to 0. I can hear myself swearing still today.
@smylesg2 ай бұрын
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.
@rexygama76972 ай бұрын
"I wish the Genie decrement my wish count *after* granting my wish"
@PowerStar0042 ай бұрын
@@rexygama7697 Turns out it's a *signed* integer and now you have -1 wishes.
@Nethuja_GunawardaneSL2 ай бұрын
@@rexygama7697 Looks like the genie can be exploited very easily
@genxjack722 ай бұрын
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Ай бұрын
@@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
@fakegrek2 ай бұрын
Unless you first decrement wishes and then grant them.
@johnlister2 ай бұрын
Rookies! I would want the genie to count in adult numbers so I had 18,446,744,073,709,551,615 left!
@letsplaycz16952 ай бұрын
What would you do with so many wishes?
@craftsmanwoodturner2 ай бұрын
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.
@sebastiengross78492 ай бұрын
@@letsplaycz1695 Wish that you have 0 left.
@smylesg2 ай бұрын
I know, right? It's such an 8-bit joke.
@johnlister2 ай бұрын
@@craftsmanwoodturner But then you’d have to keep count!
@Fabibeni12 ай бұрын
“I wish for -9,223,372,036,854,775,808 wishes!”
@PugganBacklund2 ай бұрын
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
@jmr51252 ай бұрын
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".
@PugganBacklund2 ай бұрын
@@jmr5125 depends on what system you using, but for 2-complement 255 -> -1, for 1 complement 255 -> -0, and for signed bit 255 -> -127
@Makememesandmore2 ай бұрын
I like that he created an 8 minute video to explain a joke and still managed to turn it into a useful lesson
@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
@pizdamatii50012 ай бұрын
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.exhaustus2 ай бұрын
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-kudamono2 ай бұрын
I wish for another Genie that have unlimited number of wishes. 😎😎
@trashAndNoStar2 ай бұрын
Just wish for unlimited Genies then
@AmixLiark2 ай бұрын
I wish for an unlimited range portable genie radar device. I wish for a new genie to come to my house every day.
@catanonimus72 ай бұрын
Ask him to make you a god, or at leas a ring that can grant wishes
@u2bear3772 ай бұрын
@@catanonimus7 Some guy named Jaffar tried that once. Got an obligation to sit in a lamp for who knows how long.
@catanonimus72 ай бұрын
@@u2bear377 hahahah, completely forgot about it😅
@vinayakmarar48912 ай бұрын
I would have wished that, "whatever I say,should become true'.
@Phraxas522 ай бұрын
~Hits golf ball wrong~ "OH, ***k ME!" ... ~ball comes flying back~ "WAIT, NO DON'T!"
@thanhnguyen19832 ай бұрын
It is another version of Midas wish.
@GregorianMG23 күн бұрын
"Grill me now" *Got grilled.
@awesomelink23472 ай бұрын
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
@valentinhilbig2 ай бұрын
This is exactly the outcome I would expect, too.
@mstreich2 ай бұрын
Signed 8-bit technically has as many "values", but are just from -128..127 instead of 0..255.
@Phraxas522 ай бұрын
This is why people explicitly stated that it was unsigned.
@mstreich2 ай бұрын
@@Phraxas52 Yes, but I was just commenting on his statement that signed values have half as many values.
@carultch2 ай бұрын
@@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.
@matheuscabral96182 ай бұрын
we’d have to hope the check is (whishes == 0) and not (whishes
@narfharder2 ай бұрын
@@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
@verkuilb2 ай бұрын
@1:45 Sorry, Ferris-it’s not working. We might as well kill the car. 😂
@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_ .
@Dansiman12 ай бұрын
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_fire85342 ай бұрын
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-xs8wy2 ай бұрын
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
@wtliftr12 ай бұрын
and for your last wish, wish for 0 wishes again, causing another overflow error, and receiving 255 more wishes?
@tychozzyx94392 ай бұрын
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
@rn85672 ай бұрын
Instruction unclear, the genie is Signed and now I owe him a wish
@pbenikovszky12 ай бұрын
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-on1dq2 ай бұрын
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
@JaklizTheEngineer2 ай бұрын
Shouldnt it be underflow?
@DIYDaveOK2 ай бұрын
Absolutely
@matheuscabral96182 ай бұрын
true
@robliversage424923 күн бұрын
As far as I'm aware all genies are 2-bit having a maximum of 3 wishes.
@louisd957142 ай бұрын
I am not a programmer. But being I have a lifetime's work in IT, I figured it out right away
@Solrex_the_Sun_King2 ай бұрын
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.
@Makememesandmore2 ай бұрын
4:58 - 5:48 that'll be fun to turn into algebraic equations
@rasowa29582 ай бұрын
I would start with: "I wish that you count wishes with 64-bit unsigned integer."
@magnemoe12 ай бұрын
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.
@cipherxen22 ай бұрын
First wish: make your wish counter 128-bit unsigned integer
@potatofarmer94882 ай бұрын
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?
@Liliththelizard2 ай бұрын
The fact that YT needed to upgrade from 32bit to 64bit *because* of gangnam style will never cease to amuse me
@NichaelCramer2 ай бұрын
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Ай бұрын
I will wish the genie to calculate last digit of pi.
@AzureKyle2 ай бұрын
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.
@rafaelhines11782 ай бұрын
Going to below the minimum value is called an *underflow*
@AzureKyle2 ай бұрын
@@rafaelhines1178 That is true, but it comes from the same premise, just the opposite.
@rafaelhines11782 ай бұрын
@@AzureKyle im only correcting you because it's a pet peeve of mine. Great comment BTW!
@AzureKyle2 ай бұрын
@@rafaelhines1178 No worries, and thank you.
@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.
@brewedawakening65772 ай бұрын
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?
@Arnikaaa2 ай бұрын
As a woman, I want to understand men 😭 What goes on in their minds ??
@Envy_the_DarksiderАй бұрын
Any video that talks about the 8 bit numbers looping is REQUIRED to talk about Civilization Gandhi XD
@reikooters2 ай бұрын
Technically an underflow rather than an overflow, but same concept
@Grundini912 ай бұрын
Nuclear Ghandi is not an Urban Legend, it's fact. Had it happen during a game of Civ II.
@jmr51252 ай бұрын
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").
@justin4232 ай бұрын
In a similar vein to the Gangam style view count and Y2K the Unix 2038 problem is coming up....
@PvblivsAelivs5 күн бұрын
Now, my first thought was that that had to be an old joke with an 8-bit counter.
@pepanovakno2 ай бұрын
now I understand why the max level of effect in minecraft is 255
@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!
@kimba3812 ай бұрын
Genies, however are not 8 bit devices
@paradiselost9946Ай бұрын
and wishes arent horses.
@uplink-on-yt2 ай бұрын
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. 😆
@jimmicrackhead122 ай бұрын
Ghandi was a problem in civ 2
@reminderIknows2 ай бұрын
as a programmer, i understood this immediately.
@Kalaphant13 күн бұрын
yea
@TraceguyRune2 ай бұрын
"You either die a hero or live along enough to see yourself become the villain" - Ghandi
@paulromsky95272 ай бұрын
I use 32-bit unsigned integers, that would roll back to 4,294,967,296 wishes!
@Dexaan2 ай бұрын
256 is my favorite number because of the Legend of Zelda rupee counter - it maxed at 255
@ArandelaGriffe7 күн бұрын
Born in 80', Play "pong" Atari7800, 8bit Master system, 16bit Megadrive, 32bit Genesis, 64bit N64... Those are the bits of my life XD
@HimanshuYadav-xm9rz2 ай бұрын
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-k6g2 ай бұрын
I can't believe I haven't done much programming and knew some of what you were talking about about
@jonathanhibberd99832 ай бұрын
My favorite programmer joke: Why did the computer programmer confuse Christmas and Halloween? Because Oct31 = Dec25.
@bokogonk2 ай бұрын
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".
@jonathanhibberd99832 ай бұрын
@@bokogonk That's got very "Brennan Lee Mulligan at the start of every Make Some Noise episode he's in" energy. 🤣
@Kalaphant13 күн бұрын
@@bokogonk Can you explain?
@bokogonk13 күн бұрын
@@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"
@Kalaphant13 күн бұрын
@@bokogonk Thanks! That's really cool lol (Reminds me of the green eyed riddle)
@atlas22962 ай бұрын
Just hope the genie programming language uses wraparound overflow errors and doesn’t just spit out “error overflow line 13”
@stevekerp12 ай бұрын
"And THAT'S the answer!"
@mr.d87472 ай бұрын
*If the rules say you can't wish for more wishes, just wish to change the rules.*
@Marciunus162 ай бұрын
You can't bend the genie's rules using a wish.
@mr.d87472 ай бұрын
@@Marciunus16 *Okay, then I wish to be able to bend the genie's rules using a wish.*
@Marciunus162 ай бұрын
@@mr.d8747 against the rules lmao
@bokogonk2 ай бұрын
@@Marciunus16 I wish for more genies
@HackerDragon99992 ай бұрын
Genies probably operate in 2-bit wish counting systems.
@Tyranitar665012 ай бұрын
Reminds me of the Experience Underflow glitch in Pokemon Red and Blue.
@AndriuxDev2 ай бұрын
And that, my friends, is how Pacman 256 was born. *It all started with an integer overflow.*
@boomkittyFX2 ай бұрын
my concern is that they're using an 8 bit integer still, could have at least had a 32 bit or something-
@bobh67282 ай бұрын
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_n68192 ай бұрын
Ask the genie for a pointer and he will take a dump to your core.
@SusanBell-dl5gr2 ай бұрын
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Ай бұрын
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.
@brunogrieco51462 ай бұрын
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.
@That1SupportiveFriend2 ай бұрын
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.
@wesplybon95102 ай бұрын
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.
@bpark100012 ай бұрын
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!
@briant72652 ай бұрын
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Ай бұрын
The Haskell Genie grants your wish, and returns a genie that grants you 2 wishes.
@Rudxain2 ай бұрын
This is known as modular ("wrap-around") arithmetic, in contrast to saturating ("clamping") arithmetic (commonly used by fixed-precision floating-point numbers)
@pierreabbat61572 ай бұрын
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.
@chrisbecke27932 ай бұрын
Now explain 2s complement.
@briant72652 ай бұрын
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)
@StoneColdMagic2 ай бұрын
I tried this on a real genie. He turned blue and died.
@aaronmorris15132 ай бұрын
Genie 2.0 moves the decrement operation before the wish grant operation.
@matheuscabral96182 ай бұрын
so you say “decrease the number of wishes I have by one” when you have 1 wish
@castirondudeАй бұрын
5:52 I like how your microphone glitches out when you mention an 8 bit number overflowing. Must be an 8-bit ADC
@bg6b7bft2 ай бұрын
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.
@felineboy2 ай бұрын
"I wish you were a 64-bit genie"
@carultch2 ай бұрын
Then you'd have more wishes than you could ever use in the entire future of planet Earth.
@BronyNumber40962 ай бұрын
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!"