All about flooble | fun stuff | Get a free chatterbox | Free JavaScript | Avatars    
perplexus dot info

Home > Algorithms
Firing Line (Posted on 2004-08-25) Difficulty: 3 of 5
There is a group of N soldiers arranged in a straight line, standing side by side. Soldier number 1 is at the extreme left and soldier "N" is at the extreme right. Each soldier has a rifle that can be fired only once, a primitive timer, understands a finite list of commands, and can exist in a finite number of states, like a finite state machine.

Each soldier has the ability to communicate only with the two adjacent soldiers, and has no means of communication with more distant soldiers. The i-th soldier can not see or hear any signals given by the (i+2)th soldier, for example. There are no radios, cell phones, or megaphones.

Your mission as the commander is to devise an algorithm by which all soldiers fire their weapons simultaneously. Soldiers 1 and N are aware of the fact that they are "different" in that they each have only one neighbor. Other than that, however, the soldiers are initially all identical. The algorithm has to work for any value of N>2.

The primitive timers are synchronized and tick off once a second. Once a soldier receives new information, the earliest he can respond in any way is on the next tick of the clock. (I would say he/she, except that they are all identical). A soldier can give a signal to each neighbor simultaneously, based on the information he received one tick earlier. Whenever a soldier's state changes, his neighbors are aware of this one tick later. At time=0, soldier 1 is given the command to start the firing procedure

1. Devise an algorithm that results in all N soldiers firing simultaneously
2. As a function of N, how many clock ticks does this take?

  Submitted by Larry    
Rating: 3.7500 (4 votes)
Solution: (Hide)
Soldier 1 sends 2 signals to the right, a fast signal to travel one soldier each tick, and a slow signal going 1/3 the speed.

When a soldier gets a slow signal he delays 2 ticks before sending the message on. When soldier N receives the fast signal he reflects it back. When the soldier in the middle gets hit from opposite sides by a fast and slow signal he identifies himself "middleguy". At this point he starts the process all over the same as soldier 1 did but in both directions at the same time. If 2 adjacent soldiers find themselves giving each other a fast signal and slow signal at the same time, then they both become "middleguys". Firing occurs when a soldier realizes that he and each of his neighbors are all "middleguys".

Minsky and McCarthy first solved this with a solution requiring 3N steps. The current minimal solution is down to 2N-2 steps, using automata that can take on 6 states (Mazoyer). See Bractals' post on the Jacques Mazoyer algorithm.

See also:
Eric W. Weisstein. "Firing Squad Problem." From MathWorld--A Wolfram Web Resource. http://mathworld.wolfram.com/FiringSquadProblem.html

Comments: ( You must be logged in to post comments.)
  Subject Author Date
Cash ServicesCodyDunning2024-03-12 02:44:35
SolutionThe way to do itMath Man2020-11-27 20:54:10
Here is a freaky idea !Ethen Hunt2004-09-09 09:33:34
Solutionhow about this?Patrick2004-08-29 16:52:43
re(2): More Information - another questionLarry2004-08-28 10:45:29
SolutionJacques Mazoyer's SolutionBractals2004-08-27 23:35:38
Questionre: More Information - another questionnikki2004-08-27 13:57:42
More InformationLarry2004-08-27 10:44:41
SolutionSpoilerBractals2004-08-27 02:13:33
QuestionCommunication Confirmationnikki2004-08-26 11:20:09
re: Assumptionnikki2004-08-26 09:37:15
AssumptionLuke2004-08-25 20:05:54
re: fasternikki2004-08-25 15:18:00
fasterCory Taylor2004-08-25 15:10:18
SolutionI think this is rightnikki2004-08-25 14:01:38
SolutionSolution!dhruv2004-08-25 12:52:14
Please log in:
Login:
Password:
Remember me:
Sign up! | Forgot password


Search:
Search body:
Forums (0)
Newest Problems
Random Problem
FAQ | About This Site
Site Statistics
New Comments (22)
Unsolved Problems
Top Rated Problems
This month's top
Most Commented On

Chatterbox:
Copyright © 2002 - 2024 by Animus Pactum Consulting. All rights reserved. Privacy Information