6.5.0.3

Internal Protocol

protocol

The API protocol for statically-linked, external players consist of four pieces: (1) the start-up phase, (2) the beginning of a turn (step 1), (3) the request to players to choose actions with their cards (steps 2 and 3), and (4) the question to players to pick the next action during the feeding cycle. Otherwise there is no communication between the external player and the dealer.

The diagrams include internal player objects that represent the external players with respect to the dealer. Strictly speaking, these objects are virtual and an implementation could choose a different strategy to implement the communication.

Changed in version 1.3: Mon Apr 18 16:01:30 EDT 2016
for 14 — Strategy

Changed in version 1.3: Sun Apr 10 10:37:20 CEST 2016
(natural) disambiguation of feedNext step

Changed in version 1.2: Thu Apr 7 09:43:13 CEST 2016
typos

Changed in version 1.1: Sat Apr 2 19:58:44 EDT 2016
question concerning steps 2 and 3

Added in version 1.0.

image

Start Up

The main program creates a dealer and as many players as required (between 3 and 8). It then hands handles to these players to the dealer and permits the latter to take over.

 +------+

 | main |

 +------+

    |

    |  p1 =  new(n)          +----------+

    |----------------------> | player 1 |

    |                        +----------+

   ...                           ...

    |  p2 = new(n)                |         +----------+

    |---------------------------- | ------> | player 2 |

    |                             |         +----------+

    |                             |                |

    | nu +--------+               |                |     (A)

    |--> | dealer |               |                |

    |    +--------+               |                |

    |        |                    |                |

    |        | new(p1) +------+   |                |

    |        |-------->| in 1 |   |                |     (B)

    |        |         +------+   |                |

    |        |            |       |                |

    |        | new(p2)    |       |   +------+     |

    |        |----------------------->| in 2 |     |

    |        |            |       |   +------+     |

    |        |            |       |                |

 

(A) nu = new(p1,..,p2)

(B) in : an internal representation of a player

Figure 1: Starting up

Turn: Step 1

The dealer hands each external player the necessary pieces at the beginning of a turn: a species board (if needed) and additional cards to play the turn.

 +--------+   +------+   +------+  +----------+  +----------+

 | dealer |   | in 1 |   | in 2 |  | player 1 |  | player 2 |

 +--------+   +------+   +------+  +----------+  +----------+

     |             |          |          |             |

     | start(w,b,c)|          |          |             |

     |-----------> | start(w,t)          |             |

     |             |-------------------> |             |

     | start(w,b,c)|          |          |             |

     |----------------------> |  start(w,t)            |

     |             |          |----------------------> |

 

w ~ the food at the watering hole

b ~ an optional species board with pop. = 1

c ~ the appropriate number of cards

t ~ current state of self to which the internal player added:

    -- 1 species board [pop. = 1] w/o traits (if required)

    -- 1 trait card/existing species board

    -- plus 3 additional trait cards

Figure 2: Launching a turn

By separating this step from the next one, players can begin to precompute strategies while they wait for the request to choose actions with their cards.

Turn: Steps 2 and 3

The dealer asks the players how they wish to use their cards. With this request the dealer reveals some knowledge about the other players, including the order in which they will take the turn. This design choice will accommodate improved adherence to the actual rules of Evolution at a later time.

 +--------+   +------+   +------+  +----------+  +----------+

 | dealer |   | in 1 |   | in 2 |  | player 1 |  | player 2 |

 +--------+   +------+   +------+  +----------+  +----------+

     |             |         |            |             |

     | choose(s)   |         |            |             |

     |-----------> | choose(c,d)          |             |

     |             |--------------------> |             |

     | choose(s)   |         |            |             |

     |---------------------> | choose(c,d)              |

     |             |         |------------------------> |

     |             |         |            |             |

     |             |         |            |  return(r)  |

     | <================================================|

     |             |         |            |             |

     |             |         |return(r)   |             | (C)

     | <==================================|             |

     |             |         |            |             |

 

(C) No order is assumed here. All players might be queried "in parallel".

 

s ~ the state of all players

c ~ the state of all players that precede this one for the turn

    turn minus their cards and food in bag

d ~ the state of all players that come after this one for the

    turn minus their cards and food in bag

 

r ~ a representation of the following choices:

    -- the food card required (step 2)

    -- the card exchanges for (step 3):

       -- growing the populations of species boards

       -- growing the bodies of species boards

       -- adding new species board (to the right)

       -- replacing traits of existing species boards

Figure 3: Asking for card actions

Turn: Step 4

The dealer executes the choices that the players made and then runs the feeding phase of the turn. For the latter, it will interact with the external players as needed.

 +--------+   +------+   +------+   +----------+  +----------+

 | dealer |   | in 1 |   | in 2 |   | player 1 |  | player 2 |

 +--------+   +------+   +------+   +----------+  +----------+

     |             |        |               |             |

     | step4i(r)   |        |               |             |

     |-----------> |        |               |             |

     | step4i(r)   |        |               |             |

     |--------------------> |               |             |

     |             |        |               |             |

  feeding()        |        |               |             |

 +-- |             |        |               |             |

 |   | feedNext(xs)|        |               |             | (D)

 |   |--------------------> | feedNext(ys)  |             |

 |   |             |        |---------------------------->|

 |   |             |        |               |             |

 |   |             |        |               |  return(fc) |

 |   | <==================================================|

 |   |             |        |               |             |

 |   | feedNext(xs)|        |               |             |

 |   |-----------> | feednext(ys)           |             |

 |   |             |----------------------> |             |

 |   |             |        |               |             |

 |   |             |        |    return(fc) |             |

 |   | <====================================|             |

 |   |             |        |               |             |

... ...           ...      ...             ...           ...

 |   |             |        |               |             |

 +-> |             |        |               |             |

     |             |        |               |             |

 

 

(D) The dealer will call only if there is more than one feeding choice.

 

    It will automatically feed

    -- a single species with a non-full fat-food trait card

       (to the max possible)

    -- a single vegetarian

    -- a single carnivore that can attack only one species

       from a different player (no self-attack is allowed).

 

    NOTE: for the Silly player this API choice makes no difference.

 

xs ~ the dealer's current knowledge of the watering hole and

     the players in attackable order [all playes starting from

     current, in turn order], minus their cards and food in bag

ys ~ xs + the player's current state (bag, cards, species)

 

fc ~ food choice (what to eat next)

Figure 4: The feeding step