A card game framework and various games in Typescript. The framework allows for bot development and playing card games in the terminal or in a browser.
MIT License
7
stars
2
forks
source link
Reduce event handling boilerplate and centralize logic in one place #124
Today, users have to copy a number of different files in order to build their games. It would be ideal to define the game as nearly one nested function call using the tree built by #113 (i.e. we are already building the definition of the various states into the tree by this change). Going further, we can compose more of the data into the tree.
When we call handleSingle and company, we can also pass the event validators and merging logic. Upon an incoming event, it would then call that specific handler for that state.
Today, users have to copy a number of different files in order to build their games. It would be ideal to define the game as nearly one nested function call using the tree built by #113 (i.e. we are already building the definition of the various states into the tree by this change). Going further, we can compose more of the data into the tree.
When we call
handleSingle
and company, we can also pass the event validators and merging logic. Upon an incoming event, it would then call that specific handler for that state.There is the question of whether a handler type / processing will be duplicated multiple places.
This should also help verify that only certain events are valid at certain times.