jkomoros / boardgame

An in-progress framework in golang to easily build boardgame Progressive Web Apps
Apache License 2.0
31 stars 4 forks source link

Consider auto.Config needing Delegate #637

Closed jkomoros closed 6 years ago

jkomoros commented 6 years ago

If it had delegate, it could get an example state and then identify the name of the stack, for e.g. DealComponents FallbackName calculation.

identified while looking at #633, related to #636

jkomoros commented 6 years ago

The signature would be moves.NewAutoConfig(d), and return an AutoConfigurer:

func (g *gameDelegate) ConfigureMoves() []boardgame.MoveConfig{
  auto := moves.NewAutoConfigurer(g)
  return moves.Combine(
    moves.Add(
      auto.MustConfig(new(exampleMove)),
    )
  )
}

This would also allow getting rid of the auto package and move it into the main package as currently sketched out in #633.

jkomoros commented 6 years ago
jkomoros commented 6 years ago

Done as of be1109f because there's actualy no way to signal an early error in AddOrderedForPhase anyway.