5 — Incremental refinement, a minimal start
Due Sunday, 14 February, midnight
Task 1 Design a data representation for the species of the Evolution game.
Develop a function (method) that determines whether one species is attackable by a carnivore, given the two species and the two neighbors of the "defender" (if any).
Delivery Create a sub-directory called attack and place all necessary files/modules for the data representation and the method into this sub-directory.
Task 2 Develop a test harness for the method that accepts a single JSON expression of its inputs from STDIN and writes its results to STDOUT.
The input consists of a single Situation.
true, if the first species is attackable by the second one;
false, if the first species can defend itself against an attack by the second one;
nothing, if the input is a Situation that your method considers ill shaped.
A Situation is [Species, Species, OptSpecies, OptSpecies].
[["food",Nat],
["body",Nat],
["population",Nat+],
["traits",LOT]]
either false
or a Species.
A Trait is one of: "carnivore", "ambush", "burrowing", "climbing", "cooperation", "fat-tissue", "fertile", "foraging", "hard-shell", "herding", "horns", "long-neck", "pack-hunting", "scavenger", "symbiosis", or "warning-call".
A Nat is a JSON number interpretable as a natural number between 0 and 7 (inclusive).
./xattack < some-json-input > some-json-output |
the player component is written in the same language as the rest of the system;
it is statically linked into the overall system; and
the dealer and the player obey the rules of the game.
Remember that an interface has to include a method for creating instances of the component, method signatures (possibly including behavioral contracts), sequencing constraints, and perhaps even "security" considerations (who can read/modify what).
Delivery Write up a structured English language document mixed with code fragments and possibly diagrams. Write as if you were to ship the document to Foomanistan and expect an implementation back.
Create the document as a plain text file and name it player-interface.txt. If you need supplementary diagrams (as pictures), use the png format and name these files player-interfaceN.png for N a natural number.