johnameyer / cards-ts

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

Introduce game factory builder method #123

Closed johnameyer closed 3 days ago

johnameyer commented 4 months ago

Today, users define a factory class (no constructor) which ties together the multitude of generic parameters. It would be great (cut down on numbers of references flying around) to expose a single method to build these in a completely generic manner.

buildFactory({
  providersBuilder: () => buildProviders(),
  setup: GameSetup(),
  intermediaryHandler: (intermediary) => new IntermediaryHandler(),
  botHandler: () => new BotHandler()
})