mirror of
https://github.com/EiffelSoftware/eiffel-org.git
synced 2025-12-08 15:52:26 +01:00
Author:halw
Date:2011-02-12T15:24:18.000000Z git-svn-id: https://svn.eiffel.com/eiffel-org/trunk@761 abb3cda0-5349-4a8f-a601-0c33ac3a8c38
This commit is contained in:
@@ -15,5 +15,9 @@ The problem of the dining savages (an obvious allusion to the classic dining phi
|
|||||||
|
|
||||||
=Highlights=
|
=Highlights=
|
||||||
|
|
||||||
The primary shared resource here is the pot, represented by class <code>POT</code>. <code>POT</code> has queries <code>is_empty</code> and <code>is_full</code> that can be used by savages and the cook.
|
The primary shared resource here is the pot, represented by class <code>POT</code>. <code>POT</code> has queries <code>is_empty</code> and <code>is_full</code> that can be used by savages (modeled by class SAVAGE) and the cook (class COOK).
|
||||||
|
|
||||||
|
In the root class, one can adjust the number of savages, the size (in servings) of the pot, and how hungry the savages are. The hunger index indicates how many times a savage will take a serving from the pot and eat it before being sated. So if the pot holds 20 servings and there are 5 savages with hunger index of 4, then the pot will become empty just as the last savage takes his or her last serving. In the same scenario, if the hunger index were 10, then 50 servings total would be required, resulting in the need for the cook to be notified to refill the pot 2 times ... and 10 servings leftover ... presumably for tomorrow's breakfast.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user