Пример #1
0
/* ***************************************************************************
 *  Function apply_action
 *  Applies the actions recieved from the controller for player A and B
 * ***************************************************************************/
void ALEState::apply_action(Action player_a_action, Action player_b_action) {
  // Set keys
  reset_keys(m_osystem->event());

  if (uses_paddles)
    apply_action_paddles(m_osystem->event(), player_a_action, player_b_action);
  else
    apply_action_joysticks(m_osystem->event(), player_a_action, player_b_action);
}
/* ***************************************************************************
 *  Function apply_action
 *  Applies the actions recieved from the controller for player A and B
 * ***************************************************************************/
void ALEState::apply_action(Action player_a_action, Action player_b_action) {
  // Convert illegal actions into NOOPs; actions such as reset are always legal
  if (player_a_action < (Action)PLAYER_B_NOOP && !m_settings->isLegal(player_a_action))
    player_a_action = (Action)PLAYER_A_NOOP;
  if (player_b_action < (Action)RESET && !m_settings->isLegal((Action)((int)player_b_action - PLAYER_B_NOOP)))
    player_b_action = (Action)PLAYER_B_NOOP;

  // Set keys
  reset_keys(m_osystem->event());

  if (uses_paddles)
    apply_action_paddles(m_osystem->event(), player_a_action, player_b_action);
  else
    apply_action_joysticks(m_osystem->event(), player_a_action, player_b_action);
}