예제 #1
0
bool SimulatorInterface::step() {
  const int agtCount = static_cast<int>(getNumAgents());
  if (_isRunning) {
    if (_scbWriter) _scbWriter->writeFrame(_fsm);
    if (_globalTime >= _maxDuration) {
      _isRunning = false;
    } else {
      for (size_t i = 0; i <= SUB_STEPS; ++i) {
        try {
          // TODO: doStep for FSM is a *bad* name; it should be "evaluate".
          _isRunning = !_fsm->doStep();
          doStep();
          _fsm->doTasks();
        } catch (BFSM::FSMFatalException& e) {
          logger << Logger::ERR_MSG << "Error in updating the finite state ";
          logger << "machine -- stopping!\n";
          logger << "\t" << e.what() << "\n";
          _isRunning = false;
        }
      }
    }
  }
  return _isRunning;
}
예제 #2
0
 // getters
 unsigned int Game::getNumPieces() const {
     return getNumAgents() +getNumResources();
 }