3 releases
0.0.7 | Sep 1, 2024 |
---|---|
0.0.6 | Sep 19, 2023 |
0.0.5 | Jan 29, 2022 |
#945 in Science
Used in 2 crates
135KB
3K
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 _};
#
#
#
#
#
#
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 = RandomPolicy::build(n_acts);
// Runs evaluation
let env_config = env_config.render(true);
let _ = DefaultEvaluator::new(&env_config, 0, 5)?.evaluate(&mut policy);
Ok(())
}
Dependencies
~24–45MB
~781K SLoC