1
$\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$
  • $\begingroup$ I modified the tags; not sure how I feel about their relevance. Feel free to change. $\endgroup$ – Hugh Jul 5 at 23:05
3
$\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$
  • $\begingroup$ Thank that's really helpful $\endgroup$ – pgp1 Jul 5 at 12:31
  • $\begingroup$ So wanna give me a green tick?? lol $\endgroup$ – Lakshay Sura Jul 5 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$ – Lakshay Sura Jul 5 at 12:33
  • $\begingroup$ Also if it is right, make sure to remove cipher tag $\endgroup$ – Lakshay Sura Jul 5 at 12:39
  • 2
    $\begingroup$ This feels like a bit of a strange answer to mark as a community wiki... $\endgroup$ – Hugh Jul 5 at 23:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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