[OT] Retreating from Iraq
BLS
nanali at nospam-wanadoo.fr
Tue Oct 14 07:30:39 PDT 2008
Andrei Alexandrescu schrieb:
> Suppose that a miracle happen and the decision is taken at the highest
> level to retreat all of US military presence from Iraq. That will take a
> while, but sending the orders quickly is a must.
>
> For utmost certainty, all orders are to be sent via phone and down the
> command chain, and only to direct subordinates. Each officer has a
> variable number of subordinates. Initially the president calls his
> immediate subordinates, who call their immediate subordinates, etc. Each
> call can be assumed to take the same amount of time.
>
> Devise an algorithm that ensures every foot soldier gets the news as
> quickly as possible, show it is correct, and show it is fast.
>
>
> Andrei
I would use the Propagator pattern.
Q:
The Propagator pattern belongs to a family of patterns for consistently
updating objects in a dependency network. The propagator patterns are
found in such diverse applications as MAKE, WWW, spreadsheets, GUIs,
reactive control systems, simulation systems, distributed file systems,
distributed databases, workflow systems and multilevel caches.
----
You can find the code on my Blog : http://wdinspire.blogspot.com/
In this case I would prefer the push method instead of the pull method.
States are simple : 1 Stay, 2 Go Home (This behaviour is similar to the
observer pattern)
A detailed doc (pdf) at
http://www.sei.cmu.edu/publications/articles/propagator.html
Bjoern
More information about the Digitalmars-d
mailing list