The Two Generals’ Problem

61 185
938
 
Comments
Tom Scott
Tom Scott - 2 months ago
Yes, I had help with the graphics for this series. There's no way I'd have animated that myself! On that note, thanks to Dashlane for sponsoring and helping me hire an animator: their free trial link is https://www.dashlane.com/tomscott
The Superginge
The Superginge - 5 days ago
As glad as I am that you're getting sponsored, I feel I should tell people that Firefox is starting to offer this password security option for free, though before anyone gets angry at me, I don't know what level of security it is, comparatively, I just want to make people aware of options!
Matti Lüdke
Matti Lüdke - 17 days ago
Why not send a person from each army to the middle of the valley. Then both discuss a time and go back to their army. That way they will know if the message was received by the other army. As the Danger of the route lies in the middle of the valley they will get back safely.
صالح
صالح - 18 days ago
Hey there is a way to solve the 2 genrals problem and it's a horne or war drums because they are loud enugh to hear
Dark Thoughts
Dark Thoughts - Month ago
Now you know the issues protocol standards committees have to 'foresee' when designing a communication protocol.
cringemoji
cringemoji - Month ago
uhhh what happens if the free trial runs out? where do your passwords go lmao
quithread01
quithread01 - 7 hours ago
What if two messengers meet in the middle and then head back.
Джонатан д
Джонатан д - 15 hours ago
If you're talking about computers and not this exact "two generals" situation, then no, they aren't analogous. I can solve the two generals. That was pointless.
Irishcrossing
Irishcrossing - Day ago
me a history nerd: ah, to seige the castle, there are plenty of ways to communicate in this strange but ultimately solvable situation.
computer science: no you can't do any of those.
oh
Oscar Guerrero
Oscar Guerrero - Day ago
This is a microservices mesh problem. Your idempotency key would not work. It would require policy on the client and not all retry solutions have the path you explained. The solution is multiple internal retry layers and full error contracts that are transparent and granular for all micro services.
Ryan Wilder
Ryan Wilder - Day ago
"Now, with computers you're not usually dealing with such high stakes. If you are in computer science and working on a problem that involves potential loss of life, I really hope you aren't watching a series called 'The Basics'." I'm literally taking lunch at my desk watching this video before I get back to development of a major electronic health record. :|
Ray Shi
Ray Shi - 2 days ago
Why not send the whole army across?
WichitaGuy56
WichitaGuy56 - 2 days ago
How boring.
Michael McCarty
Michael McCarty - 2 days ago
I remember imagining this paradox when I was a kid. It was one of the many philosophical questions I asked without realizing someone else already thought of it. Zeno’s Paradox is another.
TixsOP
TixsOP - Day ago
oh you're so big brain smart I bet you get all the girls
Taran Singh
Taran Singh - 2 days ago
I dont get whats so difficult. General A should just facetime General B
Noah Ord
Noah Ord - 3 days ago
If both generals send down two messengers and have them meet in the middle and then have two of the messengers go on to the opposite castle while the other messenger returns to the general that sent it with the messenger sent by the other general it might work
British Buffoons
British Buffoons - 3 days ago
Same, I can write a comment and it will clone it.
British Buffoons
British Buffoons - 3 days ago
Same, I can write a comment and it will clone it.
N/A Gaming
N/A Gaming - 3 days ago
The guy who goes to deliver the message just has to come back to base camp and say they delivered it:/
Morgan Patch
Morgan Patch - 2 days ago
That still doesn't solve the problem. The messenger travels from Army A to Army B with a message saying "We will attack at 8", and then returns to Army A with a message that says "B agrees to attack at 8". But then what if the messenger is killed while en route from B to A? Army A doesn't know whether Army B got the message or not; they don't know when the messenger died. So either Army A has to trust that the message got delivered and risk dying if it didn't, or Army A isn't willing to trust that and doesn't attack and now Army B attacks at 8 and they die.
Alex Smith
Alex Smith - 4 days ago
I have my credit card company text me whenever there is a charge. This way I know within a few seconds that a transaction has happened, and can see if I get charged when I shouldn't
Elessar Telcontar
Elessar Telcontar - 4 days ago
They could build a radio tower :3
Austin Lindsay
Austin Lindsay - 4 days ago
I guess the castle is so tall you can't have general b shoot up a flaming arrow to signal they recieved the message? Or they lack bows/fire? Maybe i missed part of the rules.
Jack Rocker
Jack Rocker - 4 days ago
quantum computing using entanglement while computing a simple algorithm using time of day variables, with an open step to represent the message. instantaneous messaging with error correction.
Axl Raveling
Axl Raveling - 4 days ago
I solved the problem..... just send the the Messenger you recieved return
What's My Life
What's My Life - 2 days ago
@Morgan Patch Well that's why we don't apply magical computer science to real world scenarios, because realistically the armies would use signal flags or something of the sort rather than sending messengers through the valley. Magical Computer Science is too strict for real world scenarios.
Morgan Patch
Morgan Patch - 2 days ago
That still doesn't solve the problem. The messenger travels from Army A to Army B with a message saying "We will attack at 8", and then returns to Army A with a message that says "B agrees to attack at 8". But then what if the messenger is killed while en route from B to A? Army A doesn't know whether Army B got the message or not; they don't know when the messenger died. So either Army A has to trust that the message got delivered and risk dying if it didn't, or Army A isn't willing to trust that and doesn't attack and now Army B attacks at 8 and they die.
Omenvreer
Omenvreer - 5 days ago
interesting

interesting

interesting

interesting

interesting

interesting

interesting

interesting

interesting
Adam Schnepp
Adam Schnepp - 6 days ago
Wouldn't only a third confirmation be enough? That way both sides are aware of the time and both sides have recieved a confirmation from the other side?
Joshua Blaylock
Joshua Blaylock - 7 days ago
Excellent!
Isoruku Yamamoto
Isoruku Yamamoto - 8 days ago
I mean this is also a practical solution to the actual two generals problem.
There is no reason whatsoever to keep repeating after party B has been informed and party A has gotten a confirmation.
Detailed invite + specific confirmation means you should always proceed.
Only if the initial message or the respons message does not come through you cannot proceed, because you haven't established a two-way communication then, which is vital in this kind of problem.
Daniel Garcia
Daniel Garcia - 4 days ago
After A got a confirmation, how does B know that the confirmation got through
kumfroik
kumfroik - 8 days ago
But, if you get the message, that your answer to the answer of the letter you wrote has been received, isn't it than clear, that both generals know when to attack?
Matthew Morris
Matthew Morris - 9 days ago
"This problem is unsolvable". No. One general agrees to raise a flag, as agreed in the message, or lights a fire, or fires a cannone. There are endless ways to resolve this analogy.
Daniel Garcia
Daniel Garcia - 4 days ago
Got it, we just have to hook up flags to every computer and server in the world
Marvin Heyboer
Marvin Heyboer - 10 days ago
Funny. My service program does this. I can't charge the same card for anything that might seem close to the same charge in the same 24 hours. It's a fail safe. Frustrating when the second charge is accurate, but I just need to wait a day to charge for the second payment. Better safe than sorry. People get pissed when you charge them twice by mistake!
sld1776
sld1776 - 10 days ago
If there's no solution, it's a pardox, not a problem.
Daniel Garcia
Daniel Garcia - 4 days ago
Not really, loads of things have no solutions but aren’t paradoxes, what is the intersection point of two parallel lines, there is no solution but it isn’t a paradox. If something has no solution but for some strange reason it must, then its a paradox. Like going back in time and killing your grandfather, it has no solution.
Ben Norris
Ben Norris - 10 days ago
except its not pronounced like omnipotence
Koray Gun
Koray Gun - 10 days ago
Why complexity just use the phone .
XDarkPhoenixX
XDarkPhoenixX - 10 days ago
Common sense also solves this problem. If you think you have paid, check your account, if money is missing, call the store and check on your order. Not hard. People trust websites and apps far too much nowadays.
Laurent Cardinal
Laurent Cardinal - 11 days ago
"If you are in computer science and working on a problem that involves potential loss of life, I really hope you aren't watching a series called 'The Basics'." It's these little jokes (along with the dumbed-down analogies and similies) that make me love this series as opposed to any other basic computer science series
blu 006
blu 006 - 11 days ago
"If you're in computer science and working on a problem that could cause a potential loss of life, I really hope you aren't watching a series titled 'the basics.'"

Oh. If it's any comfort, I'm watching because it's my Lunch break and I love your videos.
Mike Stevens
Mike Stevens - 11 days ago
Or you could tell the guys to come back
RANDOMNES It's random because it only has 1 S not 2
Get them to meet in the middle
Ibraheem Abu-rezeq
Ibraheem Abu-rezeq - 12 days ago
Build a huge fire signal. Gottem
Marvin H.
Marvin H. - 12 days ago
Just send 2 guys to deliver the message but they need to have a little distance between themselves and they need to see eachother. if the one in the front get's attacked in the valley, the other one runs back and tells the general that the message could not be delivered. but this can't be applied on networks afaik.
Abinash Sarma
Abinash Sarma - 12 days ago
Even your ads are informative. :D
Rage of the Turnip
Rage of the Turnip - 12 days ago
I've you're going to work with mathematics and theory, you should put a little effort into producing less crap metaphors. - This is why computer scientists are known for having no imagination.
Why wouldn't the "messenger" just come back and say "yes message received"; and then move back and forth... I'm not arguing your logic... Just your ability to create imaginative metaphors.
Sidowse Dowsett
Sidowse Dowsett - 13 days ago
No its not, as long as the guy taking the message makes it back, you're good to go...
Karanagi
Karanagi - 14 days ago
Easy.
1. General A promotes themselves and every last soldier they command into a terrifying mob of messegners.
2. Every messegner from army A heads to army B to inform them to attack after tea. With every member of both armies being either informed or dead/captured...
3. Both armies always attack at the same time, fulfilling the win condition.
Zhi Han Lee
Zhi Han Lee - 14 days ago
Also why some people might be a little more cynical about cashless payment
Farhan Sanjaya
Farhan Sanjaya - 14 days ago
Thats why in indonesia i use gojek :)
Master Pack
Master Pack - 15 days ago
this happened to me once. the shop rang me to check. disaster averted.
Deena
Deena - 15 days ago
There is a solution if anyone is interested 😊
Kawaiivee
Kawaiivee - 16 days ago
so the solution is to send many soldiers to their deaths hoping one eventually gets through? definitely computer networking theory about packets and stuff instead of military strategy c:
BigJay7410
BigJay7410 - 16 days ago
Answer to the Generals' Problem. General A goes himself with 6 bodyguards.
MrOvergryph
MrOvergryph - 17 days ago
2:12 congratulations you've solved the problem. both sides received an acknowledgement so it doesn't matter if their extra acknowledgements arrive. They've both already acknowledged the plan to attack at the defined time.
Daniel Garcia
Daniel Garcia - 4 days ago
Lets say A sends one to B, then B sends an acknowledgement but wont attack unless they know that A got the message, so A sends one back, but how does A know that the acknowledgement they send got through, they would need B to send another acknowledgement
dustin klingbyle
dustin klingbyle - 17 days ago
Huh? Just send a message telling them the formation to stand in. If they see them standing in position, they are ready
void735
void735 - 17 days ago
Cant the army A wander around untill there within line of sight of army B and hope they Will join them in battle?
Krishan Aspect
Krishan Aspect - 17 days ago
Tom is the 4 star general of YouTube
Dustfinger4268
Dustfinger4268 - 18 days ago
After you've sent and received 1 confirmation each, what's the point of any more? In order for them to send a confirmation, they have to have recieved at least one letter. That would prove that they have a letter. Even if you go into the "vit how do you know that they have the confirmation letter? You need a second confirmation to be sure," you don't need to confirm the confirmation to infinity. Just the original letter. And one each does that
Dustfinger4268
Dustfinger4268 - 4 days ago
@Daniel Garcia Then after the second acknowledgment, they would know that they each received at least one. And I don't see why you would need to confirm past that
Daniel Garcia
Daniel Garcia - 4 days ago
Yes both sides know that the other has heard the plan, but the only way to be sure that they will follow the plan is to send an acknowledgement back, but how does one side know that the other received the acknowledgement? They would have to ask them to send another acknowledgement, it never ends
sm_o_ rk
sm_o_ rk - 18 days ago
Send army a’s messenger to tell the other army that they attack at 8. Then bring a messenger from army b back with the messenger from army a, and at the halfway point, b messenger heads back to b army, and a messenger continues to a army, and both army’s attack at 8
Nathan
Nathan - 18 days ago
Thanks - I was attacking a castle and this was very helpfu
Charlie Angkor
Charlie Angkor - 18 days ago
This is why I live in Cambodia and buy my food personally in a street market with cash. There is a theory that civilizations collapse because of increasing complexity.
sideswipe147
sideswipe147 - 19 days ago
actually all you need is the message, an acknowledgement and an acknowledgement of the acknowledgement.
red>blue @8
blue>red @8 acknowledge
red>blue we acknowledged you received @8
blue>red we acknowledge you received our @8 acknowledgement
message 5 can be whatver and message 6 can be whatever because each time the reply message changes is a WAY of acknowledging that the previous message was recieved. SO red and blue wouldn't be sending message 5 or 6 unless ALL 4 of the previous messages had gottes through and been acknowledged.
so noone attacks until it is certain that the 4 messages got through all you need is those 4 once you have those 4 both sides can proceed. or worst case you may need 6 messages but that doesn't matter because once you have changed the iteration the CHANGE is a redundant acknowledgement of the message receipt.
sideswipe147
sideswipe147 - 19 days ago
seems to me that this could cause problems if for whatever reason you wanted to be able toplace several identical orders one at a time or in rapid succession.
why you would want to do this I'm not certain but still.
Gardstyle35
Gardstyle35 - 19 days ago
A) Message 8PM
B) Message OK
A) Message got u
B) Message got ur got u message
A) Message got ur got u message

if this worked, both are 100% sure that they have the necessary information.
67L48
67L48 - 19 days ago
I spent the entire time trying to figure out whether the problem was owned by the two generals (Two Generals' Problem) or if the problem was about two generals (Two Generals Problem). I'm not sure where I landed. I think I like the Two Generals Problem better, but could be sympathetic to Two Generals' Problem. One thing that is clear, though, is that I have my own problems.
Bane Williams
Bane Williams - 19 days ago
When the advertisement is 25% of the video.
Filthyscoutmain
Filthyscoutmain - 20 days ago
*just send two messengers to meet up in the middle shaking my smhmh my head*
Next videos