/* process the latest information from ALE */
void SpachaseSettings::step(const System& system) {

    // update the reward
    // update the reward
    int score = getDecimalScore(0x9C, 0x9B,0x9A, &system);
    // reward cannot get negative in this game. When it does, it means that the score has looped
    // (overflow)
    m_reward = score - m_score;

    m_score = score;
    m_lives = readRam(&system,0x9E);
    // update terminal status
    // If bit 0x80 is on, then game is over
    m_terminal = (m_lives <= 0);
}
Ejemplo n.º 2
0
/* process the latest information from ALE */
void PooyanSettings::step(const System& system) {

    // update the reward
    int score = getDecimalScore(0x8A, 0x89, 0x88, &system);
    int reward = score - m_score;
    m_reward = reward;
    m_score = score;

    // update terminal status
    int lives_byte = readRam(&system, 0x96);
    int some_byte  = readRam(&system, 0x98);
    m_terminal = (lives_byte == 0x0 && some_byte == 0x05);

    m_lives = (lives_byte & 0x7) + 1;
}
Ejemplo n.º 3
0
/* process the latest information from ALE */
void TutankhamSettings::step(const System& system) {

    // update the reward
    int score = getDecimalScore(0x9C, 0x9A, &system);
    int reward = score - m_score;
    m_reward = reward;
    m_score = score;

    // update terminal status
    int lives = readRam(&system, 0x9E);
    // byte 0x81 is set to 0x84 when the game is loaded, but not reset
    int some_byte = readRam(&system, 0x81);

    m_terminal = lives == 0 && some_byte != 0x84;
}
Ejemplo n.º 4
0
/* process the latest information from ALE */
void AsterixSettings::step(const System& system) {

    // update the reward
    reward_t score = getDecimalScore(0xE0, 0xDF, 0xDE, &system); 
    m_reward = score - m_score;
    m_score = score;

    // update terminal status
    int lives = readRam(&system, 0xD3) & 0xF;
    int death_counter = readRam(&system, 0xC7);
    
    // we cannot wait for lives to be set to 0, because the agent has the
    // option of the restarting the game on the very last frame (when lives==1
    // and death_counter == 0x01) by holding 'fire'
    m_terminal = (death_counter == 0x01 && lives == 1);
}
/* process the latest information from ALE */
void SolarisSettings::step(const System& system) {

    // update the reward
    // only 5 digits are displayed but we keep track of 6 digits 
    int score = getDecimalScore(0xDC, 0xDD, 0xDE, &system);
    score *= 10;
    int reward = score - m_score;
    m_reward = reward;
    m_score = score;

    // update terminal status
    int lives_byte = readRam(&system, 0xD9);
    m_terminal = lives_byte == 0;

    m_lives = lives_byte & 0xF;

}
/* process the latest information from ALE */
void FrostbiteSettings::step(const System& system) {

    // update the reward
    int score = getDecimalScore(0xCA, 0xC9, 0xC8, &system);
    int reward = score - m_score;
    m_reward = reward;
    m_score = score;

    // update terminal status
    // MGB: the maximum achievable life is 9. The system will actually let us set the byte to
    // higher values & properly decrement, but we do not gain lives beyond 9.
    int lives_byte = (readRam(&system, 0xCC) & 0xF);
    int flag  = readRam(&system, 0xF1) & 0x80;
    m_terminal = (lives_byte == 0 && flag != 0);

    m_lives = lives_byte + 1;

}
/* process the latest information from ALE */
void MontezumaRevengeSettings::step(const System& system) {

    // update the reward
    int score = getDecimalScore(0x95, 0x94, 0x93, &system); 
    int reward = score - m_score;
    m_reward = reward;
    m_score = score;

    // update terminal status
    int new_lives = readRam(&system, 0xBA);
    int m_lives = new_lives;
    // if( new_lives < 5){
    // 	//std::cout << "new lives" << new_lives << std::endl;
    // 	m_reward = -10;
    // }
    int some_byte = readRam(&system, 0xFE);
    m_terminal = new_lives == 0 && some_byte == 0x60;
}
Ejemplo n.º 8
0
/* process the latest information from ALE */
void SpaceInvadersSettings::step(const System& system) {

    // update the reward
    int score = getDecimalScore(0xE8, 0xE6, &system);
    m_reward = score - m_score;
    m_score = score;

    // update terminal status
    int reset_val = readRam(&system, 0xAA);
    reset_val = (reset_val - (reset_val & 15)) >> 4;
    if (reset_val == 8) {
        // game is not reset yet; not end of game
        m_terminal = false; 
    } else {
        // If bit 0x80 is on, then game is over 
        int some_byte = readRam(&system, 0x98); 
        int lives = readRam(&system, 0xC9);
        m_terminal = (some_byte & 0x80) || lives == 0;
    }
}
/* process the latest information from ALE */
void WizardOfWorSettings::step(const System& system) {

    // update the reward
    reward_t score = getDecimalScore(0x86, 0x88, &system);
    if (score >= 8000) score -= 8000; // MGB score does not go beyond 999
    score *= 100;
    m_reward = score - m_score;
    m_score = score;

    // update terminal status
    int newLives = readRam(&system, 0x8D) & 15;
    int byte1 = readRam(&system, 0xF4);
    
    bool isWaiting = (readRam(&system, 0xD7) & 0x1) == 0;

    m_terminal = newLives == 0 && byte1 == 0xF8;

    // Wizard of Wor decreases the life total when we move into the play field; we only
    // change the life total when we actually are waiting 
    m_lives = isWaiting ? newLives : m_lives; 
}
Ejemplo n.º 10
0
/* process the latest information from ALE */
void QBertSettings::step(const System& system) {
    // update terminal status
    int lives_value = readRam(&system, 0x88);
    // Lives start at 2 (4 lives, 3 displayed) and go down to 0xFE (death)
    // Alternatively we can die and reset within one frame; we catch this case
    m_terminal = (lives_value == 0xFE) ||
      (lives_value == 0x02 && m_last_lives == 0xFF);
    
    m_last_lives = lives_value;

    // update the reward
    // Ignore reward if reset the game via the fire button; otherwise the agent 
    //  gets a big negative reward on its last step 
    if (!m_terminal) {
      int score = getDecimalScore(0xDB, 0xDA, 0xD9, &system);
      int reward = score - m_score;
      m_reward = reward;
      m_score = score;
    }
    else {
      m_reward = 0;
    }
}
/* process the latest information from ALE */
void GalaxianSettings::step(const System& system) {
    // update the reward
    int score = getDecimalScore(0xAE, 0xAD, 0xAC, &system);
    // reward cannot get negative in this game. When it does, it means that the score has looped 
    // (overflow)
    m_reward = score - m_score;
    if(m_reward < 0) {
        // 1000000 is the highest possible score
        const int maximumScore = 1000000;
        m_reward = (maximumScore - m_score) + score; 
    }
    m_score = score;
    
    // update terminal and lives
    // If bit 0x80 is on, then game is over 
    int some_byte = readRam(&system, 0xBF); 
    m_terminal = (some_byte & 0x80);
    if (m_terminal) {
        // Force lives to zero when the game is over since otherwise it would be left as 1
        m_lives = 0;
    } else {
        m_lives = readRam(&system, 0xB9) + 1;  // 0xB9 keeps the number of lives shown below the screen    
    }
}