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?
I think I may have misinterpreted how the soldiers communicate. Could someone please confirm which is correct? (Scenarios are written as Time: Events
Scenario A:
0: Soldier 1 is given command to start
1: Soldier 1 actually hears the command
2: Soldier 1 responds to the command by giving Soldier 2 a command
3: Soldier 2 actually hears the command
4: Soldier 2 responds to the command by giving Soldier 3 a command
Scenario B:
0: Soldier 1 is given command to start, and Soldier 1 hears the command
1: Soldier 1 responds to the command by giving Soldier 2 a command, and Soldier 2 hears the command
2: Soldier 2 responds to the command by giving Soldier 3 a command, and Soldier 3 hears the command
Scenario C:
0: Soldier 1 is given command to start
1: Soldier 1 actually hears the command and then responds to the command by giving Soldier 2 a command
2: Soldier 2 actually hears the command and then responds to the command by giving Soldier 3 a command
It’s not a huge deal, but I thought it was a little confusing.
|
Posted by nikki
on 2004-08-26 11:20:09 |