~subsetpark/whist

c454910a28f1a500c23e94ae427dc4cb2de7e774 — Zach Smith 6 months ago f636a34
Add sequence diagram
1 files changed, 65 insertions(+), 0 deletions(-)

M whist.lit
M whist.lit => whist.lit +65 -0
@@ 12,6 12,71 @@ Game Server. It provides a working version of the game Bid Whist, as
well as an example implementation of a realistically complex rules
engine.

@s Rules Engine Architecture

Here's a simplified sequence diagram illustrating how a player
interacts with the Tamerlane server and a Tamerlane rules
engine. Simply put, the server will initialize a game based on the
results of an initial state call to the rules engine, and thereafter
it will loop on getting player input, using that input to calculate
the next game state, and exposing player prompts based on that state.

The rules of the game, therefore, are realized in the **next state** step.

--- Sequence Diagram
+---------+             +---------+              +-------------+

| Player  |             | Server  |              | RulesEngine |

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

     |                       |                          |

     | start game            |                          |

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

     |                       |                          |

     |                       | get initial state        |

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

     |                       |                          |

     | player action         |                          |

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

     |                       |                          |

     |                       | current state            |

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

     |                       |                          | ----------------------\

     |                       |                          |-| (whist/next params) |

     |                       |                          | |---------------------|

     |                       |                          |

     |                       |               next state |

     |                       |<-------------------------|

     |                       |                          |

     |      prompt for input |                          |

     |<----------------------|                          |

     |                       |                          |
---

@s whist/next

The most important function that we need to implement when building a
rules engine is `next`. Ultimately, we'll expose an API endpoint that
accepts a POST request and passes the body to `next`. The input to our