//send commands to this AI's "Player" according to the action specified void applyAction(int action) { if (action != (int)ACTIONS.DO_NOTHING) { if ((action & (int)ACTIONS.MOVE_LEFT) != 0) { AIPlayer.MovePlayerLeft(); } else { AIPlayer.EndPlayerLeft(); } if ((action & (int)ACTIONS.MOVE_RIGHT) != 0) { AIPlayer.MovePlayerRight(); } else { AIPlayer.EndPlayerRight(); } if ((action & (int)ACTIONS.MOVE_UP) != 0) { AIPlayer.MovePlayerUp(); } else { AIPlayer.EndPlayerUp(); } if ((action & (int)ACTIONS.MOVE_DOWN) != 0) { AIPlayer.MovePlayerDown(); } else { AIPlayer.EndPlayerDown(); } } else { AIPlayer.EndPlayerLeft(); AIPlayer.EndPlayerRight(); AIPlayer.EndPlayerUp(); AIPlayer.EndPlayerDown(); } }