Exemplo n.º 1
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)
}
Exemplo n.º 2
0
func (g *Game) buy(corp interfaces.Corporation, amount int) {
	corp.RemoveStock(amount)
	g.CurrentPlayer().
		AddShares(corp, amount).
		RemoveCash(corp.StockPrice() * amount)
}