Example #1
0
// FoundCorporation founds a new corporation
func (g *Game) FoundCorporation(corp interfaces.Corporation) error {
	if g.stateMachine.CurrentStateName() != interfaces.FoundCorpStateName {
		return errors.New(ActionNotAllowed)
	}
	if corp.IsActive() {
		return errors.New(CorporationAlreadyOnBoard)
	}
	g.board.SetOwner(corp, g.newCorpTiles)
	corp.Grow(len(g.newCorpTiles))
	g.newCorpTiles = []interfaces.Tile{}
	g.getFounderStockShare(g.CurrentPlayer(), corp)
	g.stateMachine.ToBuyStock()
	return nil
}