4 releases

0.0.8 May 17, 2025
0.0.7 Sep 1, 2024
0.0.6 Sep 19, 2023
0.0.5 Jan 29, 2022

#1822 in Machine learning

Download history 4/week @ 2025-08-17 4/week @ 2025-08-24

234 downloads per month
Used in border-derive

GPL-2.0-or-later

285KB
5K SLoC

A thin wrapper of atari-env for Border.

The code under [atari_env] is adapted from the atari-env crate (rev = 0ef0422f953d79e96b32ad14284c9600bd34f335), because the crate registered in crates.io does not implement atari_env::AtariEnv::lives() method, which is required for episodic life environments.

This environment applies some preprocessing to observation as in atari_wrapper.py.

You need to place Atari Rom directories under the directory specified by environment variable ATARI_ROM_DIR. An easy way to do this is to use AutoROM Python package.

pip install autorom
mkdir $HOME/atari_rom
AutoROM --install-dir $HOME/atari_rom
export ATARI_ROM_DIR=$HOME/atari_rom

Here is an example of running Pong environment with a random policy.

use anyhow::Result;
use border_atari_env::{
    BorderAtariAct, BorderAtariActRawFilter, BorderAtariEnv, BorderAtariEnvConfig,
    BorderAtariObs, BorderAtariObsRawFilter,
};
use border_core::{Env as _, Policy, DefaultEvaluator, Evaluator as _, NullReplayBuffer, Agent};

#
#
#
#
#
#
#
fn main() -> Result<()> {
#
    // Creates Pong environment
    let env_config = env_config("pong".to_string());

    // Creates a random policy
    let n_acts = 4;
    let mut policy = Box::new(RandomPolicy::build(n_acts)) as _;

    // Runs evaluation
    let env_config = env_config.render(true);
    let _ = DefaultEvaluator::new(&env_config, 42, 5)?
        .evaluate(&mut policy);

    Ok(())
}

Dependencies

~24–42MB
~804K SLoC