Exemplo n.º 1
0
// Trades two stock shares from a defunct corporation for a
// share of the acquiring one
func (g *Game) trade(corp interfaces.Corporation, amount int) {
	acquirer := g.mergeCorps["acquirer"][0]
	amountSharesAcquiringCorp := amount / 2
	corp.AddStock(amount)
	acquirer.RemoveStock(amountSharesAcquiringCorp)
	g.CurrentPlayer().
		RemoveShares(corp, amount).
		AddShares(acquirer, amountSharesAcquiringCorp)
}
Exemplo n.º 2
0
// Sells owned shares of a defunct corporation, returning them to the
// corporation's stock
func (g *Game) sell(pl interfaces.Player, corp interfaces.Corporation, amount int) {
	corp.AddStock(amount)
	pl.RemoveShares(corp, amount).
		AddCash(corp.StockPrice() * amount)
}