示例#1
0
void Player::updateState(int turn, Bid raw_bid, Bid production_bid) {
  orderFactories(turn); ///<@brief деньги за заказ фабрики списываются сразу
  manufacture();
  buildFactories(turn);
  _current_buy_raw_bid = raw_bid;
  _current_sell_production_bid = production_bid;
  processBids();
  payBills();
  if (_cash < 0) {
    _state = State::BANKRUPT;
  }
  _state = State::THINKING;
}
示例#2
0
//--------- Begin of function FirmFactory::production ---------//
//
void FirmFactory::production()
{
	//----- if stock capacity reached or reserve exhausted -----//

	if( stock_qty == max_stock_qty )
		return;

	err_when( stock_qty > max_stock_qty );

	//------- calculate the productivity of the workers -----------//

	calc_productivity();

	//------- generate revenue for the nation --------//

	float produceQty = (float) 20 * productivity / 100;

	produceQty = MIN( produceQty, max_stock_qty-stock_qty );

	manufacture(produceQty);
}