0
$\begingroup$

There are four soldier squads planning to attack a town from the north, south, east, and west at the same time.

They are in their positions; now they just need to know when to attack. One of the squads sends a courier went to tell the other squads when to attack. The problem is, he might die. So all the squads need to know exactly when to attack together so no squad will attack without the other. But then they need to know that all the other squads actually got this message, and the man didn't died, and so on.

How can they attack?

$\endgroup$
1
  • $\begingroup$ I modified the tags; not sure how I feel about their relevance. Feel free to change. $\endgroup$
    – user46002
    Jul 5, 2020 at 23:05

1 Answer 1

4
$\begingroup$

This is known as the Two Generals' Problem.

Tom Scott made a video on this topic in 2019. He suggests solving this problem by making use of an idempotency key.

Otherwise, it is impossible because the generals would be led to an infinite regress of recieving and transmitting acknowledgement.

$\endgroup$
5
  • $\begingroup$ So wanna give me a green tick?? lol $\endgroup$ Jul 5, 2020 at 12:32
  • 1
    $\begingroup$ Idempotency actually refers to the sending of request multiple times but receiving it only once. Be sure that you cannot guarantee that plan of attack will always be successful. $\endgroup$ Jul 5, 2020 at 12:33
  • $\begingroup$ Also if it is right, make sure to remove cipher tag $\endgroup$ Jul 5, 2020 at 12:39
  • 2
    $\begingroup$ This feels like a bit of a strange answer to mark as a community wiki... $\endgroup$
    – user46002
    Jul 5, 2020 at 23:03
  • $\begingroup$ Didn't know much newcomer here. $\endgroup$ Jul 6, 2020 at 3:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.