├── .gitignore
├── .travis.yml
├── ChangeLog
├── Copyright.txt
├── License.txt
├── Makefile
├── README-SDL.txt
├── README-ale.md
├── README.md
├── atari_py
├── __init__.py
├── ale_c_wrapper.cpp
├── ale_c_wrapper.h
├── ale_interface
│ ├── CMakeLists.txt
│ ├── Makefile
│ ├── common.rules
│ ├── makefile.mac
│ ├── makefile.unix
│ ├── setup.sh
│ ├── src
│ │ ├── ale_interface.cpp
│ │ ├── ale_interface.hpp
│ │ ├── common
│ │ │ ├── Array.hxx
│ │ │ ├── ColourPalette.cpp
│ │ │ ├── ColourPalette.hpp
│ │ │ ├── Constants.cpp
│ │ │ ├── Constants.h
│ │ │ ├── Defaults.cpp
│ │ │ ├── Defaults.hpp
│ │ │ ├── Log.cpp
│ │ │ ├── Log.hpp
│ │ │ ├── Palettes.hpp
│ │ │ ├── ScreenExporter.cpp
│ │ │ ├── ScreenExporter.hpp
│ │ │ ├── SoundExporter.cpp
│ │ │ ├── SoundExporter.hpp
│ │ │ ├── SoundNull.cxx
│ │ │ ├── SoundNull.hxx
│ │ │ ├── SoundSDL.cxx
│ │ │ ├── SoundSDL.hxx
│ │ │ ├── Version.hxx
│ │ │ ├── VideoModeList.hxx
│ │ │ ├── display_screen.cpp
│ │ │ ├── display_screen.h
│ │ │ ├── misc_tools.h
│ │ │ ├── module.mk
│ │ │ ├── stella.png
│ │ │ └── stella.xpm
│ │ ├── controllers
│ │ │ ├── ale_controller.cpp
│ │ │ ├── ale_controller.hpp
│ │ │ ├── fifo_controller.cpp
│ │ │ ├── fifo_controller.hpp
│ │ │ ├── module.mk
│ │ │ ├── rlglue_controller.cpp
│ │ │ └── rlglue_controller.hpp
│ │ ├── emucore
│ │ │ ├── AtariVox.cxx
│ │ │ ├── AtariVox.hxx
│ │ │ ├── Booster.cxx
│ │ │ ├── Booster.hxx
│ │ │ ├── Cart.cxx
│ │ │ ├── Cart.hxx
│ │ │ ├── Cart0840.cxx
│ │ │ ├── Cart0840.hxx
│ │ │ ├── Cart2K.cxx
│ │ │ ├── Cart2K.hxx
│ │ │ ├── Cart3E.cxx
│ │ │ ├── Cart3E.hxx
│ │ │ ├── Cart3F.cxx
│ │ │ ├── Cart3F.hxx
│ │ │ ├── Cart4A50.cxx
│ │ │ ├── Cart4A50.hxx
│ │ │ ├── Cart4K.cxx
│ │ │ ├── Cart4K.hxx
│ │ │ ├── CartAR.cxx
│ │ │ ├── CartAR.hxx
│ │ │ ├── CartCV.cxx
│ │ │ ├── CartCV.hxx
│ │ │ ├── CartDPC.cxx
│ │ │ ├── CartDPC.hxx
│ │ │ ├── CartE0.cxx
│ │ │ ├── CartE0.hxx
│ │ │ ├── CartE7.cxx
│ │ │ ├── CartE7.hxx
│ │ │ ├── CartF4.cxx
│ │ │ ├── CartF4.hxx
│ │ │ ├── CartF4SC.cxx
│ │ │ ├── CartF4SC.hxx
│ │ │ ├── CartF6.cxx
│ │ │ ├── CartF6.hxx
│ │ │ ├── CartF6SC.cxx
│ │ │ ├── CartF6SC.hxx
│ │ │ ├── CartF8.cxx
│ │ │ ├── CartF8.hxx
│ │ │ ├── CartF8SC.cxx
│ │ │ ├── CartF8SC.hxx
│ │ │ ├── CartFASC.cxx
│ │ │ ├── CartFASC.hxx
│ │ │ ├── CartFE.cxx
│ │ │ ├── CartFE.hxx
│ │ │ ├── CartMB.cxx
│ │ │ ├── CartMB.hxx
│ │ │ ├── CartMC.cxx
│ │ │ ├── CartMC.hxx
│ │ │ ├── CartUA.cxx
│ │ │ ├── CartUA.hxx
│ │ │ ├── Console.cxx
│ │ │ ├── Console.hxx
│ │ │ ├── Control.cxx
│ │ │ ├── Control.hxx
│ │ │ ├── DefProps.hxx
│ │ │ ├── Deserializer.cxx
│ │ │ ├── Deserializer.hxx
│ │ │ ├── Driving.cxx
│ │ │ ├── Driving.hxx
│ │ │ ├── Event.cxx
│ │ │ ├── Event.hxx
│ │ │ ├── FSNode.cxx
│ │ │ ├── FSNode.hxx
│ │ │ ├── Joystick.cxx
│ │ │ ├── Joystick.hxx
│ │ │ ├── Keyboard.cxx
│ │ │ ├── Keyboard.hxx
│ │ │ ├── M6532.cxx
│ │ │ ├── M6532.hxx
│ │ │ ├── MD5.cxx
│ │ │ ├── MD5.hxx
│ │ │ ├── MediaSrc.cxx
│ │ │ ├── MediaSrc.hxx
│ │ │ ├── OSystem.cxx
│ │ │ ├── OSystem.hxx
│ │ │ ├── Paddles.cxx
│ │ │ ├── Paddles.hxx
│ │ │ ├── Props.cxx
│ │ │ ├── Props.hxx
│ │ │ ├── PropsSet.cxx
│ │ │ ├── PropsSet.hxx
│ │ │ ├── Random.cxx
│ │ │ ├── Random.hxx
│ │ │ ├── Serializer.cxx
│ │ │ ├── Serializer.hxx
│ │ │ ├── Settings.cxx
│ │ │ ├── Settings.hxx
│ │ │ ├── Sound.hxx
│ │ │ ├── SpeakJet.cxx
│ │ │ ├── SpeakJet.hxx
│ │ │ ├── Switches.cxx
│ │ │ ├── Switches.hxx
│ │ │ ├── TIA.cxx
│ │ │ ├── TIA.hxx
│ │ │ ├── TIASnd.cxx
│ │ │ ├── TIASnd.hxx
│ │ │ ├── m6502
│ │ │ │ ├── Copyright.txt
│ │ │ │ ├── License.txt
│ │ │ │ ├── module.mk
│ │ │ │ └── src
│ │ │ │ │ ├── Device.cxx
│ │ │ │ │ ├── Device.hxx
│ │ │ │ │ ├── M6502.cxx
│ │ │ │ │ ├── M6502.hxx
│ │ │ │ │ ├── M6502.m4
│ │ │ │ │ ├── M6502Hi.cxx
│ │ │ │ │ ├── M6502Hi.hxx
│ │ │ │ │ ├── M6502Hi.ins
│ │ │ │ │ ├── M6502Hi.m4
│ │ │ │ │ ├── M6502Low.cxx
│ │ │ │ │ ├── M6502Low.hxx
│ │ │ │ │ ├── M6502Low.ins
│ │ │ │ │ ├── M6502Low.m4
│ │ │ │ │ ├── NullDev.cxx
│ │ │ │ │ ├── NullDev.hxx
│ │ │ │ │ ├── System.cxx
│ │ │ │ │ ├── System.hxx
│ │ │ │ │ └── bspf
│ │ │ │ │ ├── Copyright.txt
│ │ │ │ │ ├── License.txt
│ │ │ │ │ └── src
│ │ │ │ │ └── bspf.hxx
│ │ │ ├── module.mk
│ │ │ ├── rsynth
│ │ │ │ ├── COPYING
│ │ │ │ ├── Elements.def
│ │ │ │ ├── PORTING
│ │ │ │ ├── config.h
│ │ │ │ ├── darray.c
│ │ │ │ ├── darray.h
│ │ │ │ ├── elements.c
│ │ │ │ ├── holmes.c
│ │ │ │ ├── kmap
│ │ │ │ ├── module.mk
│ │ │ │ ├── opsynth.c
│ │ │ │ ├── phfeat.h
│ │ │ │ ├── phones.c
│ │ │ │ ├── phones.def
│ │ │ │ ├── phones.h
│ │ │ │ ├── phtoelm.c
│ │ │ │ ├── phtoelm.def
│ │ │ │ ├── phtoelm.h
│ │ │ │ ├── rsynth.h
│ │ │ │ ├── trie.c
│ │ │ │ ├── trie.h
│ │ │ │ └── useconfig.h
│ │ │ ├── stella.pro
│ │ │ ├── unzip.c
│ │ │ └── unzip.h
│ │ ├── environment
│ │ │ ├── ale_ram.hpp
│ │ │ ├── ale_screen.hpp
│ │ │ ├── ale_state.cpp
│ │ │ ├── ale_state.hpp
│ │ │ ├── module.mk
│ │ │ ├── phosphor_blend.cpp
│ │ │ ├── phosphor_blend.hpp
│ │ │ ├── stella_environment.cpp
│ │ │ └── stella_environment.hpp
│ │ ├── external
│ │ │ ├── TinyMT
│ │ │ │ ├── LICENSE.txt
│ │ │ │ ├── tinymt32.c
│ │ │ │ └── tinymt32.h
│ │ │ └── module.mk
│ │ ├── games
│ │ │ ├── RomSettings.cpp
│ │ │ ├── RomSettings.hpp
│ │ │ ├── RomUtils.cpp
│ │ │ ├── RomUtils.hpp
│ │ │ ├── Roms.cpp
│ │ │ ├── Roms.hpp
│ │ │ ├── module.mk
│ │ │ └── supported
│ │ │ │ ├── AirRaid.cpp
│ │ │ │ ├── AirRaid.hpp
│ │ │ │ ├── Alien.cpp
│ │ │ │ ├── Alien.hpp
│ │ │ │ ├── Amidar.cpp
│ │ │ │ ├── Amidar.hpp
│ │ │ │ ├── Assault.cpp
│ │ │ │ ├── Assault.hpp
│ │ │ │ ├── Asterix.cpp
│ │ │ │ ├── Asterix.hpp
│ │ │ │ ├── Asteroids.cpp
│ │ │ │ ├── Asteroids.hpp
│ │ │ │ ├── Atlantis.cpp
│ │ │ │ ├── Atlantis.hpp
│ │ │ │ ├── BankHeist.cpp
│ │ │ │ ├── BankHeist.hpp
│ │ │ │ ├── BattleZone.cpp
│ │ │ │ ├── BattleZone.hpp
│ │ │ │ ├── BeamRider.cpp
│ │ │ │ ├── BeamRider.hpp
│ │ │ │ ├── Berzerk.cpp
│ │ │ │ ├── Berzerk.hpp
│ │ │ │ ├── Bowling.cpp
│ │ │ │ ├── Bowling.hpp
│ │ │ │ ├── Boxing.cpp
│ │ │ │ ├── Boxing.hpp
│ │ │ │ ├── Breakout.cpp
│ │ │ │ ├── Breakout.hpp
│ │ │ │ ├── Carnival.cpp
│ │ │ │ ├── Carnival.hpp
│ │ │ │ ├── Centipede.cpp
│ │ │ │ ├── Centipede.hpp
│ │ │ │ ├── ChopperCommand.cpp
│ │ │ │ ├── ChopperCommand.hpp
│ │ │ │ ├── CrazyClimber.cpp
│ │ │ │ ├── CrazyClimber.hpp
│ │ │ │ ├── Defender.cpp
│ │ │ │ ├── Defender.hpp
│ │ │ │ ├── DemonAttack.cpp
│ │ │ │ ├── DemonAttack.hpp
│ │ │ │ ├── DoubleDunk.cpp
│ │ │ │ ├── DoubleDunk.hpp
│ │ │ │ ├── ElevatorAction.cpp
│ │ │ │ ├── ElevatorAction.hpp
│ │ │ │ ├── Enduro.cpp
│ │ │ │ ├── Enduro.hpp
│ │ │ │ ├── FishingDerby.cpp
│ │ │ │ ├── FishingDerby.hpp
│ │ │ │ ├── Freeway.cpp
│ │ │ │ ├── Freeway.hpp
│ │ │ │ ├── Frostbite.cpp
│ │ │ │ ├── Frostbite.hpp
│ │ │ │ ├── Gopher.cpp
│ │ │ │ ├── Gopher.hpp
│ │ │ │ ├── Gravitar.cpp
│ │ │ │ ├── Gravitar.hpp
│ │ │ │ ├── Hero.cpp
│ │ │ │ ├── Hero.hpp
│ │ │ │ ├── IceHockey.cpp
│ │ │ │ ├── IceHockey.hpp
│ │ │ │ ├── JamesBond.cpp
│ │ │ │ ├── JamesBond.hpp
│ │ │ │ ├── JourneyEscape.cpp
│ │ │ │ ├── JourneyEscape.hpp
│ │ │ │ ├── Kangaroo.cpp
│ │ │ │ ├── Kangaroo.hpp
│ │ │ │ ├── Krull.cpp
│ │ │ │ ├── Krull.hpp
│ │ │ │ ├── KungFuMaster.cpp
│ │ │ │ ├── KungFuMaster.hpp
│ │ │ │ ├── MontezumaRevenge.cpp
│ │ │ │ ├── MontezumaRevenge.hpp
│ │ │ │ ├── MsPacman.cpp
│ │ │ │ ├── MsPacman.hpp
│ │ │ │ ├── NameThisGame.cpp
│ │ │ │ ├── NameThisGame.hpp
│ │ │ │ ├── Phoenix.cpp
│ │ │ │ ├── Phoenix.hpp
│ │ │ │ ├── Pitfall.cpp
│ │ │ │ ├── Pitfall.hpp
│ │ │ │ ├── Pong.cpp
│ │ │ │ ├── Pong.hpp
│ │ │ │ ├── Pooyan.cpp
│ │ │ │ ├── Pooyan.hpp
│ │ │ │ ├── PrivateEye.cpp
│ │ │ │ ├── PrivateEye.hpp
│ │ │ │ ├── QBert.cpp
│ │ │ │ ├── QBert.hpp
│ │ │ │ ├── RiverRaid.cpp
│ │ │ │ ├── RiverRaid.hpp
│ │ │ │ ├── RoadRunner.cpp
│ │ │ │ ├── RoadRunner.hpp
│ │ │ │ ├── RoboTank.cpp
│ │ │ │ ├── RoboTank.hpp
│ │ │ │ ├── Seaquest.cpp
│ │ │ │ ├── Seaquest.hpp
│ │ │ │ ├── Skiing.cpp
│ │ │ │ ├── Skiing.hpp
│ │ │ │ ├── Solaris.cpp
│ │ │ │ ├── Solaris.hpp
│ │ │ │ ├── SpaceInvaders.cpp
│ │ │ │ ├── SpaceInvaders.hpp
│ │ │ │ ├── StarGunner.cpp
│ │ │ │ ├── StarGunner.hpp
│ │ │ │ ├── Tennis.cpp
│ │ │ │ ├── Tennis.hpp
│ │ │ │ ├── TimePilot.cpp
│ │ │ │ ├── TimePilot.hpp
│ │ │ │ ├── Tutankham.cpp
│ │ │ │ ├── Tutankham.hpp
│ │ │ │ ├── UpNDown.cpp
│ │ │ │ ├── UpNDown.hpp
│ │ │ │ ├── Venture.cpp
│ │ │ │ ├── Venture.hpp
│ │ │ │ ├── VideoPinball.cpp
│ │ │ │ ├── VideoPinball.hpp
│ │ │ │ ├── WizardOfWor.cpp
│ │ │ │ ├── WizardOfWor.hpp
│ │ │ │ ├── YarsRevenge.cpp
│ │ │ │ ├── YarsRevenge.hpp
│ │ │ │ ├── Zaxxon.cpp
│ │ │ │ └── Zaxxon.hpp
│ │ ├── main.cpp
│ │ ├── module.mk
│ │ └── os_dependent
│ │ │ ├── FSNodePOSIX.cxx
│ │ │ ├── FSNodeWin32.cxx
│ │ │ ├── OSystemUNIX.cxx
│ │ │ ├── OSystemUNIX.hxx
│ │ │ ├── OSystemWin32.cxx
│ │ │ ├── OSystemWin32.hxx
│ │ │ ├── SettingsUNIX.cxx
│ │ │ ├── SettingsUNIX.hxx
│ │ │ ├── SettingsWin32.cxx
│ │ │ ├── SettingsWin32.hxx
│ │ │ └── module.mk
│ └── stellarc
├── ale_python_interface.py
├── atari_ntsc_rgb_palette.h
├── atari_roms
│ ├── air_raid.bin
│ ├── alien.bin
│ ├── amidar.bin
│ ├── assault.bin
│ ├── asterix.bin
│ ├── asteroids.bin
│ ├── atlantis.bin
│ ├── bank_heist.bin
│ ├── battle_zone.bin
│ ├── beam_rider.bin
│ ├── berzerk.bin
│ ├── bowling.bin
│ ├── boxing.bin
│ ├── breakout.bin
│ ├── carnival.bin
│ ├── centipede.bin
│ ├── chopper_command.bin
│ ├── crazy_climber.bin
│ ├── defender.bin
│ ├── demon_attack.bin
│ ├── double_dunk.bin
│ ├── elevator_action.bin
│ ├── enduro.bin
│ ├── fishing_derby.bin
│ ├── freeway.bin
│ ├── frostbite.bin
│ ├── gopher.bin
│ ├── gravitar.bin
│ ├── ice_hockey.bin
│ ├── jamesbond.bin
│ ├── journey_escape.bin
│ ├── kangaroo.bin
│ ├── krull.bin
│ ├── kung_fu_master.bin
│ ├── montezuma_revenge.bin
│ ├── ms_pacman.bin
│ ├── name_this_game.bin
│ ├── phoenix.bin
│ ├── pitfall.bin
│ ├── pong.bin
│ ├── pooyan.bin
│ ├── private_eye.bin
│ ├── qbert.bin
│ ├── riverraid.bin
│ ├── road_runner.bin
│ ├── robotank.bin
│ ├── seaquest.bin
│ ├── skiing.bin
│ ├── solaris.bin
│ ├── space_invaders.bin
│ ├── star_gunner.bin
│ ├── tennis.bin
│ ├── time_pilot.bin
│ ├── tutankham.bin
│ ├── up_n_down.bin
│ ├── venture.bin
│ ├── video_pinball.bin
│ ├── wizard_of_wor.bin
│ ├── yars_revenge.bin
│ └── zaxxon.bin
├── package_data.txt
└── tests
│ └── test_smoke.py
├── doc
├── examples
│ ├── Makefile
│ ├── Makefile.fifo
│ ├── Makefile.recording
│ ├── Makefile.rlglue
│ ├── Makefile.sharedlibrary
│ ├── RLGlueAgent.c
│ ├── RLGlueExperiment.c
│ ├── fifoInterfaceExample.cpp
│ ├── python_example.py
│ ├── sharedLibraryInterfaceExample.cpp
│ └── videoRecordingExample.cpp
├── java-agent
│ ├── code
│ │ ├── build.xml
│ │ ├── manifest.mf
│ │ ├── nbproject
│ │ │ ├── build-impl.xml
│ │ │ ├── configs
│ │ │ │ ├── Human.properties
│ │ │ │ └── RL.properties
│ │ │ ├── genfiles.properties
│ │ │ ├── project.properties
│ │ │ └── project.xml
│ │ └── run_agent.perl
│ └── manual
│ │ ├── Makefile
│ │ ├── java-agent.pdf
│ │ └── java-agent.tex
├── manual
│ ├── Makefile
│ ├── figures
│ │ └── ale.gif
│ ├── manual.pdf
│ └── manual.tex
└── scripts
│ ├── videoRecordingExampleJoinMacOSX.sh
│ └── videoRecordingExampleJoinUnix.sh
├── setup.py
└── tox.ini
/.gitignore:
--------------------------------------------------------------------------------
1 | build
2 | *.egg
3 | *.egg-info
4 | dist
5 | *.pyc
6 | .tox
7 |
--------------------------------------------------------------------------------
/.travis.yml:
--------------------------------------------------------------------------------
1 | dist: trusty
2 | sudo: required
3 | cache:
4 | apt: true
5 | language: python
6 | addons:
7 | apt:
8 | packages:
9 | - python-dev
10 | python:
11 | - "2.7"
12 | - "3.5"
13 | install: pip install tox-travis
14 | script: tox
15 |
16 | notifications:
17 | slack:
18 | secure: h/Mxm8K+avH/2W0818zCHmLloRPMFN4NJL01+VShvAkH80/acfjeq/+mMdWXXPL/oOB6kSHDk+GDhwR6+s03ZcPMn5INTFvFYqUc6UWmT+NXtOPxGTN0xda6MdYUkWQUKaMyjFrweZQOMOASFBIzPOq4XeVbM5aB8s4EJhnfAcYZhp/idwKbToVihN4KZgxlvZIFc8iEp1o9uSl5qrsaeYYYXRkb6mauacAwOo4/Chu+cOnoLUOnvhBFE3rV3doDNrbnoalO8XiExtgx5CIAYWrlMni7r2Q+LlzgwdyTH19ZtybPxJTZIIWSBQ2UtcoYdIEDcc36GcUwz1VUGg32mLJJnY2xw80CWR4ixFPpLwwP5Y99WTn8v094B4nmFTWOwNWXp3EkqtTN9XcJoRBqXB5ArucIPqrx57dOCljSKx22gL6WaF2p3stSAxIGFektGyGnisaELrFZG1C63aHoUPicj3gUlijmAoUmYaDRf6P1wnpXqBpKDAWWhAMSatvx1ekmEJgR7OQklQnnfjx9kENDUygNUWS4IQwN2qYieuzHFL3of7/30mTM43+Vt/vWN8GI7j01BXu6FNGGloHxjH1pt3bLP/+uj5BJsT2HWF+Z8XR4VE6cyVuKsQAFgCXwOkoDHALbcwsspONDIt/9ixkesgh1oFt4CzU3UuU5wYs=
19 | on_success: change
20 |
--------------------------------------------------------------------------------
/ChangeLog:
--------------------------------------------------------------------------------
1 | June 22nd, 2015. ALE 0.5.0.
2 | * Added action_repeat_stochasticity.
3 | * Added sound playback, visualization.
4 | * Added screen/sound recording ability.
5 | * CMake now available.
6 | * Incorporated Benjamin Goodrich's Python interface.
7 | * Some game fixes.
8 | * Added examples for shared library, Python, fifo, RL-Glue interfaces.
9 | * Incorporated Java agent into main repository.
10 | * Removed internal controller, now superseded by shared library interface.
11 | * Better ALEInterface.
12 | * Many other changes.
13 |
14 | February 15th, 2015. ALE 0.5dev.
15 | * Removed the following command-line flags: 'output_file', 'system_reset_steps', 'use_environment_distribution', 'backward_compatible_save', internal agent flags
16 | * The flag 'use_starting_actions' was removed and internally its value is always 'true'.
17 | * The flag 'disable_color_averaging' was renamed to 'color_averaging' and FALSE is its default value.
18 |
19 | April 28th, 2014. ALE 0.4.4.
20 | * Fixed a memory issue in ALEScreen.
21 |
22 | April 26th, 2014. Bug fix (Mayank Daswani).
23 | * Fixed issues with frame numbers not being correctly updated.
24 | * Fixed a bug where total reward was not properly reported under frame skipping.
25 |
26 | January 7th, 2013. ALE 0.4.3.
27 | * Fixed a bug with ALEState's m_frame_number.
28 |
29 | June 12th, 2013. ALE 0.4.2.
30 | * Modified StellaEnvironment save/load interface to provide additional flexibility.
31 | * Series of bug fixes from Matthew Hausknecht and community.
32 |
33 | May 24th, 2013. Bug fix to ALE 0.4.1.
34 | * Fixed RL-Glue syntax from OBSERVATION to OBSERVATIONS. Thanks to Angus MacIsaac for picking this bug up.
35 |
36 | May 22nd, 2013. ALE 0.4.1.
37 | * Added frame skipping support directly in StellaEnvironment.
38 | * Reverted default number of episodes to 10.
39 |
40 | April 22nd, 2013. ALE 0.4.0.
41 | * RL-Glue support
42 | * Shared library interface
43 | * Simpler direct environment interfacing
44 | * Improved environment handling
45 | * Improved environment customization
46 | * Better documentation
47 |
48 | October 3rd, 2012. Moving to GITHub.
49 |
50 | August 7th, 2012. ALE 0.3.1.
51 | * Fixed frames per episode cap for FIFO agents, added functionality to
52 | limit the total number of frames per run for FIFO agents.
53 |
54 | July 22nd, 2012. ALE 0.3.
55 | * Initial ALE release.
56 |
57 |
--------------------------------------------------------------------------------
/Copyright.txt:
--------------------------------------------------------------------------------
1 | ===========================================================================
2 |
3 | SSSS tt lll lll
4 | SS SS tt ll ll
5 | SS tttttt eeee ll ll aaaa
6 | SSSS tt ee ee ll ll aa
7 | SS tt eeeeee ll ll aaaaa -- "An Atari 2600 VCS Emulator"
8 | SS SS tt ee ll ll aa aa
9 | SSSS ttt eeeee llll llll aaaaa
10 |
11 | ===========================================================================
12 | License Information and Copyright Notice
13 | ===========================================================================
14 |
15 | Copyright (C) 1995-2012 Bradford W. Mott, Stephen Anthony and the
16 | Stella Team
17 |
18 | ===========================================================================
19 | The Arcade Learning Environment
20 | ===========================================================================
21 |
22 | Copyright (C) 2009-2012 Yavar Naddaf, Marc G. Bellemare, Joel Veness and the
23 | Artificial Intelligence Laboratory at the University of Alberta
24 |
25 |
26 | This program is free software; you can redistribute it and/or modify it
27 | under the terms of the GNU General Public License as published by the Free
28 | Software Foundation; either version 2 of the License, or any later version.
29 |
30 | You should have received a copy of the GNU General Public License version 2
31 | along with this program (License.txt); if not, write to the Free Software
32 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
33 |
34 | This program is distributed in the hope that it will be useful, but WITHOUT
35 | ANY WARRANTY. IN NO EVENT SHALL THE AUTHORS OR DISTRIBUTORS BE LIABLE TO
36 | ANY PARTY FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL
37 | DAMAGES ARISING OUT OF THE USE OF THIS SOFTWARE, ITS DOCUMENTATION, OR ANY
38 | DERIVATIVES THEREOF, EVEN IF THE AUTHORS HAVE BEEN ADVISED OF THE
39 | POSSIBILITY OF SUCH DAMAGE.
40 |
41 | THE AUTHORS AND DISTRIBUTORS SPECIFICALLY DISCLAIM ANY WARRANTIES,
42 | INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY,
43 | FITNESS FOR A PARTICULAR PURPOSE, AND NON-INFRINGEMENT. THIS SOFTWARE IS
44 | PROVIDED ON AN "AS IS" BASIS, AND THE AUTHORS AND DISTRIBUTORS HAVE NO
45 | OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR
46 | MODIFICATIONS.
47 |
--------------------------------------------------------------------------------
/Makefile:
--------------------------------------------------------------------------------
1 | .PHONY: build clean
2 |
3 | build:
4 | make -C atari_py/ale_interface build
5 |
6 | clean:
7 | rm -rf dist atari_py.egg-info
8 | make -C atari_py/ale_interface clean
9 |
10 | package_data:
11 | ( echo "ale_interface/build/*.dll" && echo "ale_interface/build/ale" && cd atari_py && git ls-files |grep -v \\.py$ ) > atari_py/package_data.txt
12 |
13 | upload:
14 | make clean
15 | rm -rf dist
16 | python setup.py sdist
17 | twine upload dist/*
18 |
--------------------------------------------------------------------------------
/README-SDL.txt:
--------------------------------------------------------------------------------
1 | Please distribute this file with the SDL runtime environment:
2 |
3 | The Simple DirectMedia Layer (SDL for short) is a cross-platfrom library
4 | designed to make it easy to write multi-media software, such as games and
5 | emulators.
6 |
7 | The Simple DirectMedia Layer library source code is available from:
8 | http://www.libsdl.org/
9 |
10 | This library is distributed under the terms of the GNU LGPL license:
11 | http://www.gnu.org/copyleft/lesser.html
12 |
--------------------------------------------------------------------------------
/README-ale.md:
--------------------------------------------------------------------------------
1 | (Contents from [https://github.com/bbitmaster/ale_python_interface](https://github.com/bbitmaster/ale_python_interface))
2 |
3 |
4 |
5 | # Arcade-Learning-Environment
6 |
7 | The Arcade Learning Environment (ALE) -- a platform for AI research.
8 |
9 | For more details and installation instructions, see the [website](http://www.arcadelearningenvironment.org) and [manual](doc/manual/manual.pdf). To ask questions and discuss, please join the [ALE-users group](https://groups.google.com/forum/#!forum/arcade-learning-environment).
10 |
11 | ## Citing ALE
12 |
13 | If ALE helps in your research, please cite the following:
14 |
15 | @article{bellemare13arcade,
16 | author = {{Bellemare}, M.~G. and {Naddaf}, Y. and {Veness}, J. and {Bowling}, M.},
17 | title = {The Arcade Learning Environment: An Evaluation Platform for General Agents},
18 | journal = {Journal of Artificial Intelligence Research},
19 | year = "2013",
20 | month = "jun",
21 | volume = "47",
22 | pages = "253--279",
23 | }
24 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # atari_py
2 |
3 | [](https://travis-ci.org/openai/atari-py)
4 |
5 | A Windows-MSYS2-MinGW compatible version of [https://github.com/openai/ale_python_interface](https://github.com/openai/ale_python_interface).
6 |
7 | This has been tested on Windows 7 64-bit. It will likely work on Windows XP or later.
8 |
9 | ## Installation
10 |
11 | 1) Install MSYS2 and follow post-install instructions: [https://msys2.github.io/](https://msys2.github.io/)
12 |
13 | 2) Install MSYS2 packages (via MSYS terminal):
14 |
15 | ```pacman -S base-devel mingw-w64-x86_64-gcc mingw-w64-x86_64-cmake```
16 |
17 | 3) Append to current Windows User PATH: ";C:\msys64\mingw64\bin;C:\msys64\usr\bin"
18 |
19 | i.e. Start->right-click Computer->Properties->Advanced System Settings->Environment Variables->edit User variables PATH
20 |
21 | 4) Install Xming: [https://sourceforge.net/projects/xming/])(https://sourceforge.net/projects/xming/)
22 |
23 | Then add a new windows PATH variable (same method as #3): Name=DISPLAY, Value=:0
24 |
25 | Or just remember to set it in your cmd.exe environment before running python:
26 |
27 | ```set DISPLAY=:0```
28 |
29 | 5) Install atari-py and OpenAI Gym
30 |
31 | ```git clone https://github.com/rybskej/atari-py```
32 |
33 | ```cd atari-py && make && python setup.py install && pip install "gym[atari]"```
34 |
35 | You can also just build the C++ code via `make`, and then add
36 | this repo to your `PYTHONPATH` before running python:
37 |
38 | ```set PYTHONPATH="C:\path\to\atari-py:$PYTHONPATH"```
39 |
40 | 6) Test install (OpenAI Gym and then atari_py)
41 | ```
42 | C:\> python
43 | ...
44 | >>> import gym
45 | >>>
46 | >>> env = gym.make('CartPole-v0')
47 | [2016-12-22 01:26:25,161] Making new env: CartPole-v0
48 | >>> env.reset()
49 | >>> env.render()
50 | >>>
51 | >>> env = gym.make('Pong-v0')
52 | [2016-12-22 01:26:31,161] Making new env: Pong-v0
53 | >>> env.reset()
54 | >>> env.render()
55 | ```
56 |
57 | ### Common issues
58 |
59 |
--------------------------------------------------------------------------------
/atari_py/__init__.py:
--------------------------------------------------------------------------------
1 | from .ale_python_interface import *
2 | import os
3 |
4 | def _game_dir():
5 | return os.path.join(os.path.abspath(os.path.dirname(__file__)), "atari_roms")
6 |
7 | def get_game_path(game_name):
8 | return os.path.join(_game_dir(), game_name) + ".bin"
9 |
10 | def list_games():
11 | files = os.listdir(_game_dir())
12 | return [os.path.basename(f).split(".")[0] for f in files]
13 |
--------------------------------------------------------------------------------
/atari_py/ale_c_wrapper.cpp:
--------------------------------------------------------------------------------
1 | //all code is currently in the .h file
2 | #include "ale_c_wrapper.h"
3 |
4 |
--------------------------------------------------------------------------------
/atari_py/ale_interface/Makefile:
--------------------------------------------------------------------------------
1 | .PHONY: build clean
2 |
3 | build:
4 | mkdir -p build && cd build && cmake -G "MSYS Makefiles" .. && make -j4
5 |
6 | clean:
7 | rm -rf build
8 |
--------------------------------------------------------------------------------
/atari_py/ale_interface/common.rules:
--------------------------------------------------------------------------------
1 | # Common build rules, used by the sub modules and their module.mk files
2 |
3 | # Copy the list of objects to a new variable. The name of the new variable
4 | # contains the module name, a trick we use so we can keep multiple different
5 | # module object lists, one for each module.
6 | MODULE_OBJS-$(MODULE) := $(MODULE_OBJS)
7 |
8 | MODULE_LIB-$(MODULE) := $(MODULE)/lib$(notdir $(MODULE)).a
9 |
10 | # If not building as a plugin, add the object files to the main OBJS list
11 | #OBJS += $(MODULE_LIB-$(MODULE))
12 | OBJS += $(MODULE_OBJS)
13 |
14 | # Convenience library target
15 | #$(MODULE_LIB-$(MODULE)): $(MODULE_OBJS)
16 | # -$(RM) $@
17 | # $(AR) $@ $+
18 | # $(RANLIB) $@
19 |
20 | # Pseudo target for comfort, allows for "make common", "make gui" etc.
21 | #$(MODULE): $(MODULE_LIB-$(MODULE))
22 |
23 |
24 | # Clean target, removes all object files. This looks a bit hackish, as we have to
25 | # copy the content of MODULE_OBJS to another unique variable (the next module.mk
26 | # will overwrite it after all). The same for the libMODULE.a library file.
27 | clean: clean-$(MODULE)
28 | clean-$(MODULE): clean-% :
29 | -$(RM) $(MODULE_OBJS-$*) $(MODULE_LIB-$*) $(PLUGIN-$*)
30 |
31 | .PHONY: clean-$(MODULE) $(MODULE)
32 |
--------------------------------------------------------------------------------
/atari_py/ale_interface/setup.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 | set -e
3 | mkdir -p build && cd build && cmake .. && make -j4
4 |
--------------------------------------------------------------------------------
/atari_py/ale_interface/src/common/Constants.cpp:
--------------------------------------------------------------------------------
1 | /* *****************************************************************************
2 | * A.L.E (Atari 2600 Learning Environment)
3 | * Copyright (c) 2009-2013 by Yavar Naddaf
4 | * Released under GNU General Public License www.gnu.org/licenses/gpl-3.0.txt
5 | *
6 | * Based on: Stella -- "An Atari 2600 VCS Emulator"
7 | * Copyright (c) 1995-2007 by Bradford W. Mott and the Stella team
8 | *
9 | * *****************************************************************************
10 | * Constants.cpp
11 | *
12 | * Defines a set of constants used by various parts of the player agent code
13 | *
14 | **************************************************************************** */
15 |
16 | #include "Constants.h"
17 |
18 | std::string action_to_string(Action a) {
19 | static std::string tmp_action_to_string[] = {
20 | "PLAYER_A_NOOP"
21 | ,"PLAYER_A_FIRE"
22 | ,"PLAYER_A_UP"
23 | ,"PLAYER_A_RIGHT"
24 | ,"PLAYER_A_LEFT"
25 | ,"PLAYER_A_DOWN"
26 | ,"PLAYER_A_UPRIGHT"
27 | ,"PLAYER_A_UPLEFT"
28 | ,"PLAYER_A_DOWNRIGHT"
29 | ,"PLAYER_A_DOWNLEFT"
30 | ,"PLAYER_A_UPFIRE"
31 | ,"PLAYER_A_RIGHTFIRE"
32 | ,"PLAYER_A_LEFTFIRE"
33 | ,"PLAYER_A_DOWNFIRE"
34 | ,"PLAYER_A_UPRIGHTFIRE"
35 | ,"PLAYER_A_UPLEFTFIRE"
36 | ,"PLAYER_A_DOWNRIGHTFIRE"
37 | ,"PLAYER_A_DOWNLEFTFIRE"
38 | ,"PLAYER_B_NOOP"
39 | ,"PLAYER_B_FIRE"
40 | ,"PLAYER_B_UP"
41 | ,"PLAYER_B_RIGHT"
42 | ,"PLAYER_B_LEFT"
43 | ,"PLAYER_B_DOWN"
44 | ,"PLAYER_B_UPRIGHT"
45 | ,"PLAYER_B_UPLEFT"
46 | ,"PLAYER_B_DOWNRIGHT"
47 | ,"PLAYER_B_DOWNLEFT"
48 | ,"PLAYER_B_UPFIRE"
49 | ,"PLAYER_B_RIGHTFIRE"
50 | ,"PLAYER_B_LEFTFIRE"
51 | ,"PLAYER_B_DOWNFIRE"
52 | ,"PLAYER_B_UPRIGHTFIRE"
53 | ,"PLAYER_B_UPLEFTFIRE"
54 | ,"PLAYER_B_DOWNRIGHTFIRE"
55 | ,"PLAYER_B_DOWNLEFTFIRE"
56 | ,"__invalid__" // 36
57 | ,"__invalid__" // 37
58 | ,"__invalid__" // 38
59 | ,"__invalid__" // 39
60 | ,"RESET" // 40
61 | ,"UNDEFINED" // 41
62 | ,"RANDOM" // 42
63 | };
64 | assert (a >= 0 && a <= 42);
65 | return tmp_action_to_string[a];
66 | }
67 |
--------------------------------------------------------------------------------
/atari_py/ale_interface/src/common/Defaults.cpp:
--------------------------------------------------------------------------------
1 | /* *****************************************************************************
2 | * A.L.E (Arcade Learning Environment)
3 | * Copyright (c) 2009-2013 by Yavar Naddaf, Joel Veness, Marc G. Bellemare and
4 | * the Reinforcement Learning and Artificial Intelligence Laboratory
5 | * Released under the GNU General Public License; see License.txt for details.
6 | *
7 | * Based on: Stella -- "An Atari 2600 VCS Emulator"
8 | * Copyright (c) 1995-2007 by Bradford W. Mott and the Stella team
9 | *
10 | * *****************************************************************************
11 | * Defaults.cpp
12 | *
13 | * Defines methods for setting default parameters.
14 | *
15 | **************************************************************************** */
16 | #include "Defaults.hpp"
17 |
18 | void setDefaultSettings(Settings &settings) {
19 | // Controller settings
20 | settings.setInt("max_num_frames", 0);
21 | settings.setInt("max_num_frames_per_episode", 0);
22 |
23 | // FIFO controller settings
24 | settings.setBool("run_length_encoding", true);
25 |
26 | // Environment customization settings
27 | settings.setBool("restricted_action_set", false);
28 | settings.setString("random_seed", "time");
29 | settings.setBool("color_averaging", false);
30 | settings.setBool("send_rgb", false);
31 | settings.setInt("frame_skip", 1);
32 | settings.setFloat("repeat_action_probability", 0.25);
33 |
34 | // Display Settings
35 | settings.setBool("display_screen", false);
36 |
37 | // Record settings
38 | settings.setString("record_sound_filename", "");
39 | }
40 |
--------------------------------------------------------------------------------
/atari_py/ale_interface/src/common/Defaults.hpp:
--------------------------------------------------------------------------------
1 | /* *****************************************************************************
2 | * A.L.E (Arcade Learning Environment)
3 | * Copyright (c) 2009-2013 by Yavar Naddaf, Joel Veness, Marc G. Bellemare and
4 | * the Reinforcement Learning and Artificial Intelligence Laboratory
5 | * Released under the GNU General Public License; see License.txt for details.
6 | *
7 | * Based on: Stella -- "An Atari 2600 VCS Emulator"
8 | * Copyright (c) 1995-2007 by Bradford W. Mott and the Stella team
9 | *
10 | * *****************************************************************************
11 | * Defaults.hpp
12 | *
13 | * Defines methods for setting default parameters.
14 | *
15 | **************************************************************************** */
16 |
17 | #ifndef __DEFAULTS_HPP__
18 | #define __DEFAULTS_HPP__
19 |
20 | #include "../emucore/Settings.hxx"
21 |
22 | /** Sets all of the ALE-specific default settings */
23 | void setDefaultSettings(Settings &settings);
24 |
25 | #endif // __DEFAULTS_HPP__
26 |
--------------------------------------------------------------------------------
/atari_py/ale_interface/src/common/Log.cpp:
--------------------------------------------------------------------------------
1 | #include "Log.hpp"
2 | #include
3 | using namespace ale;
4 |
5 | Logger::mode Logger::current_mode = Warning;
6 |
7 | void Logger::setMode(Logger::mode m){
8 | current_mode = m;
9 | }
10 |
11 | ale::Logger::mode ale::operator<<(ale::Logger::mode log, std::ostream & (*manip)(std::ostream &)) {
12 | if(log >= Logger::current_mode)
13 | manip(std::cerr);
14 | return log;
15 | }
16 |
--------------------------------------------------------------------------------
/atari_py/ale_interface/src/common/Log.hpp:
--------------------------------------------------------------------------------
1 | #ifndef __LOG_HPP__
2 | #define __LOG_HPP__
3 | #include
4 | namespace ale
5 | {
6 | class Logger
7 | {
8 | public:
9 | enum mode{
10 | Info = 0,
11 | Warning = 1,
12 | Error = 2
13 | };
14 | /** @brief Allow to change the level of verbosity
15 | * @param m Info will print all the messages, Warning only the important ones
16 | * and Error the critical ones
17 | */
18 | static void setMode(mode m);
19 | private:
20 | static mode current_mode;
21 | friend mode operator<<(mode,std::ostream&(*manip)(std::ostream &));
22 | template
23 | friend mode operator<<(mode, const T&);
24 | };
25 |
26 |
27 | Logger::mode operator<<(Logger::mode log, std::ostream & (*manip)(std::ostream &));
28 |
29 | template
30 | Logger::mode operator << (Logger::mode log, const T& val){
31 | if(log>=Logger::current_mode)
32 | std::cerr << val;
33 | return log;
34 | }
35 |
36 |
37 | }
38 | #endif
39 |
--------------------------------------------------------------------------------
/atari_py/ale_interface/src/common/ScreenExporter.hpp:
--------------------------------------------------------------------------------
1 | /* *****************************************************************************
2 | * A.L.E (Arcade Learning Environment)
3 | * Copyright (c) 2009-2013 by Yavar Naddaf, Joel Veness, Marc G. Bellemare and
4 | * the Reinforcement Learning and Artificial Intelligence Laboratory
5 | * Released under the GNU General Public License; see License.txt for details.
6 | *
7 | * Based on: Stella -- "An Atari 2600 VCS Emulator"
8 | * Copyright (c) 1995-2007 by Bradford W. Mott and the Stella team
9 | *
10 | * *****************************************************************************
11 | * ScreenExporter.hpp
12 | *
13 | * A class for exporting Atari 2600 frames as PNGs.
14 | *
15 | **************************************************************************** */
16 |
17 | #ifndef __SCREEN_EXPORTER_HPP__
18 | #define __SCREEN_EXPORTER_HPP__
19 |
20 | #include
21 | #include "display_screen.h"
22 | #include "../environment/ale_screen.hpp"
23 |
24 | class ScreenExporter {
25 |
26 | public:
27 |
28 | /** Creates a new ScreenExporter which can be used to save screens using save(filename). */
29 | ScreenExporter(ColourPalette &palette);
30 |
31 | /** Creates a new ScreenExporter which will save frames successively in the directory provided.
32 | Frames are sequentially named with 6 digits, starting at 000000. */
33 | ScreenExporter(ColourPalette &palette, const std::string &path);
34 |
35 | /** Save the given screen to the given filename. No paths are created. */
36 | void save(const ALEScreen &screen, const std::string &filename) const;
37 |
38 | /** Save the given screen according to our own internal numbering. */
39 | void saveNext(const ALEScreen &screen);
40 |
41 | private:
42 |
43 | ColourPalette &m_palette;
44 |
45 | /** The next frame number. */
46 | int m_frame_number;
47 |
48 | /** The width of the frame number when constructing filenames (set to 6). */
49 | int m_frame_field_width;
50 |
51 | /** The directory where we save successive frames. */
52 | std::string m_path;
53 | };
54 |
55 | #endif // __SCREEN_EXPORTER_HPP__
56 |
57 |
58 |
59 |
--------------------------------------------------------------------------------
/atari_py/ale_interface/src/common/SoundExporter.hpp:
--------------------------------------------------------------------------------
1 | /* *****************************************************************************
2 | * A.L.E (Arcade Learning Environment)
3 | * Copyright (c) 2009-2013 by Yavar Naddaf, Joel Veness, Marc G. Bellemare,
4 | * Matthew Hausknecht and the Reinforcement Learning and Artificial Intelligence
5 | * Laboratory
6 | * Released under the GNU General Public License; see License.txt for details.
7 | *
8 | * Based on: Stella -- "An Atari 2600 VCS Emulator"
9 | * Copyright (c) 1995-2007 by Bradford W. Mott and the Stella team
10 | *
11 | * *****************************************************************************
12 | * SoundExporter.hpp
13 | *
14 | * A class for writing Atari 2600 sound to a WAV file.
15 | *
16 | * Parts of this code were taken from
17 | *
18 | * http://stackoverflow.com/questions/22226872/two-problems-when-writing-to-wav-c
19 | *
20 | **************************************************************************** */
21 |
22 | #ifndef __SOUND_EXPORTER_HPP__
23 | #define __SOUND_EXPORTER_HPP__
24 |
25 | #include
26 | #include
27 | #include "../emucore/m6502/src/bspf/src/bspf.hxx"
28 |
29 | namespace ale {
30 | namespace sound {
31 |
32 | template
33 | void write(std::ofstream& stream, const T& t) {
34 | stream.write((const char*)&t, sizeof(T));
35 | }
36 |
37 | class SoundExporter {
38 |
39 | public:
40 |
41 | static const int SamplesPerFrame = 512;
42 |
43 | typedef uInt8 SampleType;
44 |
45 | /** Create a new sound exporter which, on program termination, will write out a wav file. */
46 | SoundExporter(const std::string &filename, int channels);
47 | ~SoundExporter();
48 |
49 | /** Adds a buffer of samples. */
50 | void addSamples(SampleType *s, int len);
51 |
52 | private:
53 |
54 | /** Writes the data to disk. */
55 | void writeWAVData();
56 |
57 | /** The file to save our audio to. */
58 | std::string m_filename;
59 |
60 | /** Number of channels. */
61 | int m_channels;
62 |
63 | /** The sound data. */
64 | std::vector m_data;
65 |
66 | /** Keep track of how many samples have been written since the last write to disk */
67 | size_t m_samples_since_write;
68 | };
69 |
70 | } // namespace ale::sound
71 | } // namespace ale
72 |
73 | #endif // __SOUND_EXPORTER_HPP__
74 |
--------------------------------------------------------------------------------
/atari_py/ale_interface/src/common/SoundNull.cxx:
--------------------------------------------------------------------------------
1 | //============================================================================
2 | //
3 | // SSSS tt lll lll
4 | // SS SS tt ll ll
5 | // SS tttttt eeee ll ll aaaa
6 | // SSSS tt ee ee ll ll aa
7 | // SS tt eeeeee ll ll aaaaa -- "An Atari 2600 VCS Emulator"
8 | // SS SS tt ee ll ll aa aa
9 | // SSSS ttt eeeee llll llll aaaaa
10 | //
11 | // Copyright (c) 1995-2007 by Bradford W. Mott and the Stella team
12 | //
13 | // See the file "license" for information on usage and redistribution of
14 | // this file, and for a DISCLAIMER OF ALL WARRANTIES.
15 | //
16 | // $Id: SoundNull.cxx,v 1.6 2007/01/01 18:04:40 stephena Exp $
17 | //============================================================================
18 |
19 | #include "Serializer.hxx"
20 | #include "Deserializer.hxx"
21 |
22 | #include "bspf.hxx"
23 |
24 | #include "OSystem.hxx"
25 | #include "Settings.hxx"
26 | #include "SoundNull.hxx"
27 |
28 | // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
29 | SoundNull::SoundNull(OSystem* osystem)
30 | : Sound(osystem)
31 | {
32 | // Show some info
33 | if(myOSystem->settings().getBool("showinfo"))
34 | std::cerr << "Sound disabled." << std::endl << std::endl;
35 | }
36 |
37 | // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
38 | SoundNull::~SoundNull()
39 | {
40 | }
41 |
42 | // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
43 | bool SoundNull::load(Deserializer& in)
44 | {
45 | std::string soundDevice = "TIASound";
46 | if(in.getString() != soundDevice)
47 | return false;
48 |
49 | uInt8 reg;
50 | reg = (uInt8) in.getInt();
51 | reg = (uInt8) in.getInt();
52 | reg = (uInt8) in.getInt();
53 | reg = (uInt8) in.getInt();
54 | reg = (uInt8) in.getInt();
55 | reg = (uInt8) in.getInt();
56 |
57 | // myLastRegisterSetCycle
58 | in.getInt();
59 |
60 | return true;
61 | }
62 |
63 | // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
64 | bool SoundNull::save(Serializer& out)
65 | {
66 | out.putString("TIASound");
67 |
68 | uInt8 reg = 0;
69 | out.putInt(reg);
70 | out.putInt(reg);
71 | out.putInt(reg);
72 | out.putInt(reg);
73 | out.putInt(reg);
74 | out.putInt(reg);
75 |
76 | // myLastRegisterSetCycle
77 | out.putInt(0);
78 |
79 | return true;
80 | }
81 |
--------------------------------------------------------------------------------
/atari_py/ale_interface/src/common/Version.hxx:
--------------------------------------------------------------------------------
1 | //============================================================================
2 | //
3 | // SSSS tt lll lll
4 | // SS SS tt ll ll
5 | // SS tttttt eeee ll ll aaaa
6 | // SSSS tt ee ee ll ll aa
7 | // SS tt eeeeee ll ll aaaaa -- "An Atari 2600 VCS Emulator"
8 | // SS SS tt ee ll ll aa aa
9 | // SSSS ttt eeeee llll llll aaaaa
10 | //
11 | // Copyright (c) 1995-2007 by Bradford W. Mott and the Stella team
12 | //
13 | // See the file "license" for information on usage and redistribution of
14 | // this file, and for a DISCLAIMER OF ALL WARRANTIES.
15 | //
16 | // $Id: Version.hxx,v 1.29 2007/08/27 13:58:41 stephena Exp $
17 | //============================================================================
18 |
19 | #ifndef VERSION_HXX
20 | #define VERSION_HXX
21 |
22 | #define STELLA_BASE_VERSION "2.4.2"
23 |
24 | #ifdef NIGHTLY_BUILD
25 | #define STELLA_VERSION STELLA_BASE_VERSION "pre-" NIGHTLY_BUILD
26 | #else
27 | #define STELLA_VERSION STELLA_BASE_VERSION
28 | #endif
29 |
30 | #endif
31 |
--------------------------------------------------------------------------------
/atari_py/ale_interface/src/common/display_screen.h:
--------------------------------------------------------------------------------
1 | /* *****************************************************************************
2 | * A.L.E (Arcade Learning Environment)
3 | * Copyright (c) 2009-2013 by Yavar Naddaf, Joel Veness, Marc G. Bellemare,
4 | * Matthew Hausknecht, and the Reinforcement Learning and Artificial Intelligence
5 | * Laboratory
6 | * Released under the GNU General Public License; see License.txt for details.
7 | *
8 | * Based on: Stella -- "An Atari 2600 VCS Emulator"
9 | * Copyright (c) 1995-2007 by Bradford W. Mott and the Stella team
10 | *
11 | * *****************************************************************************
12 | * diplay_screen.cpp
13 | *
14 | * Supports displaying the screen via SDL.
15 | **************************************************************************** */
16 |
17 | #ifndef DISPLAY_SCREEN_H
18 | #define DISPLAY_SCREEN_H
19 |
20 | #include
21 | #include
22 |
23 | #include "Constants.h"
24 | #include "ColourPalette.hpp"
25 | #include "../emucore/MediaSrc.hxx"
26 |
27 | #ifdef __USE_SDL
28 | #include "SDL.h"
29 |
30 | class DisplayScreen {
31 | public:
32 | DisplayScreen(MediaSource* mediaSource, Sound* sound, ColourPalette &palette);
33 | virtual ~DisplayScreen();
34 |
35 | // Displays the current frame buffer from the mediasource.
36 | void display_screen();
37 |
38 | // Has the user engaged manual control mode?
39 | bool manual_control_engaged() { return manual_control_active; }
40 |
41 | // Captures the keypress of a user in manual control mode.
42 | Action getUserAction();
43 |
44 | protected:
45 | // Checks for SDL events.
46 | void poll();
47 |
48 | // Handle the SDL_Event.
49 | void handleSDLEvent(const SDL_Event& event);
50 |
51 | protected:
52 | // Dimensions of the SDL window (4:3 aspect ratio)
53 | static const int window_height = 321;
54 | static const int window_width = 428;
55 | // Maintains the paused/unpaused state of the game
56 | bool manual_control_active;
57 | MediaSource* media_source;
58 | Sound* my_sound;
59 | ColourPalette &colour_palette;
60 | int screen_height, screen_width;
61 | SDL_Surface *screen, *image;
62 | float yratio, xratio;
63 | Uint32 delay_msec;
64 | // Used to calibrate delay between frames
65 | Uint32 last_frame_time;
66 | };
67 | #else
68 | /** A dummy class that simply ignores display events. */
69 | class DisplayScreen {
70 | public:
71 | DisplayScreen(MediaSource* mediaSource, Sound* sound, ColourPalette &palette) {}
72 | void display_screen() {}
73 | bool manual_control_engaged() { return false; }
74 | Action getUserAction() { return UNDEFINED; }
75 | };
76 | #endif // __USE_SDL
77 |
78 | #endif // DISPLAY_SCREEN
79 |
--------------------------------------------------------------------------------
/atari_py/ale_interface/src/common/misc_tools.h:
--------------------------------------------------------------------------------
1 | /* *****************************************************************************
2 | * A.L.E (Arcade Learning Environment)
3 | * Copyright (c) 2009-2013 by Yavar Naddaf, Joel Veness, Marc G. Bellemare and
4 | * the Reinforcement Learning and Artificial Intelligence Laboratory
5 | * Released under the GNU General Public License; see License.txt for details.
6 | *
7 | * Based on: Stella -- "An Atari 2600 VCS Emulator"
8 | * Copyright (c) 1995-2007 by Bradford W. Mott and the Stella team
9 | *
10 | * *****************************************************************************
11 | * misc_tools.h
12 | *
13 | * A set of miscellaneous tools used in various places.
14 | **************************************************************************** */
15 | #ifndef __MISC_TOOLS_H__
16 | #define __MISC_TOOLS_H__
17 |
18 | #include "Constants.h"
19 |
20 | #if (defined(WIN32) || defined(__MINGW32__))
21 | #include
22 | #endif
23 |
24 | /* *****************************************************************************
25 | Inline C++ integer exponentiation routines
26 | Version 1.01
27 | Copyright (C) 1999-2004 John C. Bowman
28 | **************************************************************************** */
29 | inline int pow(int x, int p) {
30 | if(p == 0) return 1;
31 | if(x == 0 && p > 0) return 0;
32 | if(p < 0) {assert(x == 1 || x == -1); return (-p % 2) ? x : 1;}
33 |
34 | int r = 1;
35 | for(;;) {
36 | if(p & 1) r *= x;
37 | if((p >>= 1) == 0) return r;
38 | x *= x;
39 | }
40 | }
41 |
42 | /* *****************************************************************************
43 | Makes x fit within the [uper, lower] bounds
44 | **************************************************************************** */
45 | inline void bound(int& x, int lower_bound, int upper_bound) {
46 | if (x > upper_bound) {
47 | x = upper_bound;
48 | }
49 | if (x < lower_bound) {
50 | x = lower_bound;
51 | }
52 | }
53 |
54 | /* *****************************************************************************
55 | Return time in milliseconds.
56 | **************************************************************************** */
57 | #if (defined(WIN32) || defined(__MINGW32__))
58 |
59 | #include
60 | inline long timeMillis() {
61 | return GetTickCount();
62 | }
63 |
64 | #else
65 |
66 | inline long timeMillis() {
67 |
68 | struct timeval ts;
69 | gettimeofday(&ts, NULL);
70 | return ts.tv_sec * 1000 + ts.tv_usec/1000;
71 | }
72 |
73 | #endif
74 |
75 | #endif // __MISC_TOOLS_H__
76 |
--------------------------------------------------------------------------------
/atari_py/ale_interface/src/common/module.mk:
--------------------------------------------------------------------------------
1 | MODULE := src/common
2 |
3 | MODULE_OBJS := \
4 | src/common/SoundNull.o \
5 | src/common/SoundSDL.o \
6 | src/common/SoundExporter.o\
7 | src/common/display_screen.o \
8 | src/common/ColourPalette.o \
9 | src/common/ScreenExporter.o \
10 | src/common/Constants.o \
11 | src/common/Defaults.o \
12 | src/common/Log.o
13 |
14 | MODULE_DIRS += \
15 | src/common
16 |
17 | # Include common rules
18 | include $(srcdir)/common.rules
19 |
--------------------------------------------------------------------------------
/atari_py/ale_interface/src/common/stella.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/rybskej/atari-py/7c432d43402d46ebb174e319091dde4a687da882/atari_py/ale_interface/src/common/stella.png
--------------------------------------------------------------------------------
/atari_py/ale_interface/src/common/stella.xpm:
--------------------------------------------------------------------------------
1 | /* XPM */
2 | static const char * stella_icon[] = {
3 | "32 32 3 1",
4 | " c None",
5 | ". c #000000",
6 | "+ c #FFFFFF",
7 | " ",
8 | " ",
9 | " ",
10 | " ",
11 | " .............. ",
12 | " .............. ",
13 | " ..++..++..++.. ",
14 | " ..++..++..++.. ",
15 | " ..++..++..++.. ",
16 | " ..++..++..++.. ",
17 | " ..++..++..++.. ",
18 | " ..++..++..++.. ",
19 | " ..++..++..++.. ",
20 | " ..++..++..++.. ",
21 | " ....++..++..++.... ",
22 | " ....++..++..++.... ",
23 | " ....++++..++..++++.... ",
24 | " ....++++..++..++++.... ",
25 | " ..++++....++....++++.. ",
26 | " ..++++....++....++++.. ",
27 | " ......++......++......++...... ",
28 | " ......++......++......++...... ",
29 | " ..++++++.. ..++.. ..++++++.. ",
30 | " ..++++++.. ..++.. ..++++++.. ",
31 | " ..++++.... ..++.. ....++++.. ",
32 | " ..++++.... ..++.. ....++++.. ",
33 | " ........ ...... ........ ",
34 | " ........ ...... ........ ",
35 | " ",
36 | " ",
37 | " ",
38 | " "};
39 |
--------------------------------------------------------------------------------
/atari_py/ale_interface/src/controllers/ale_controller.cpp:
--------------------------------------------------------------------------------
1 | /* *****************************************************************************
2 | * A.L.E (Arcade Learning Environment)
3 | * Copyright (c) 2009-2013 by Yavar Naddaf, Joel Veness, Marc G. Bellemare and
4 | * the Reinforcement Learning and Artificial Intelligence Laboratory
5 | * Released under the GNU General Public License; see License.txt for details.
6 | *
7 | * Based on: Stella -- "An Atari 2600 VCS Emulator"
8 | * Copyright (c) 1995-2007 by Bradford W. Mott and the Stella team
9 | *
10 | * *****************************************************************************
11 | * controller.hpp
12 | *
13 | * Superclass defining a variety of controllers -- main loops interfacing with
14 | * an agent in a particular way. This superclass handles work common to all
15 | * controllers, e.g. loading ROM settings and constructing the environment
16 | * wrapper.
17 | **************************************************************************** */
18 |
19 | #include "ale_controller.hpp"
20 | #include "../games/Roms.hpp"
21 |
22 | #include "../common/display_screen.h"
23 | #include "../common/Log.hpp"
24 |
25 | ALEController::ALEController(OSystem* osystem):
26 | m_osystem(osystem),
27 | m_settings(buildRomRLWrapper(m_osystem->settings().getString("rom_file"))),
28 | m_environment(m_osystem, m_settings.get()) {
29 |
30 | if (m_settings.get() == NULL) {
31 | ale::Logger::Warning << "Unsupported ROM file: " << std::endl;
32 | exit(1);
33 | }
34 | else {
35 | m_environment.reset();
36 | }
37 | }
38 |
39 | void ALEController::display() {
40 | // Display the screen if applicable
41 | DisplayScreen* display = m_osystem->p_display_screen;
42 | if (display) {
43 | display->display_screen();
44 | while (display->manual_control_engaged()) {
45 | Action user_action = display->getUserAction();
46 | applyActions(user_action, PLAYER_B_NOOP);
47 | display->display_screen();
48 | }
49 | }
50 | }
51 |
52 | reward_t ALEController::applyActions(Action player_a, Action player_b) {
53 | reward_t sum_rewards = 0;
54 | // Perform different operations based on the first player's action
55 | switch (player_a) {
56 | case LOAD_STATE: // Load system state
57 | // Note - this does not reset the game screen; so that the subsequent screen
58 | // is incorrect (in fact, two screens, due to colour averaging)
59 | m_environment.load();
60 | break;
61 | case SAVE_STATE: // Save system state
62 | m_environment.save();
63 | break;
64 | case SYSTEM_RESET:
65 | m_environment.reset();
66 | break;
67 | default:
68 | // Pass action to emulator!
69 | sum_rewards = m_environment.act(player_a, player_b);
70 | break;
71 | }
72 | return sum_rewards;
73 | }
74 |
75 |
--------------------------------------------------------------------------------
/atari_py/ale_interface/src/controllers/ale_controller.hpp:
--------------------------------------------------------------------------------
1 | /* *****************************************************************************
2 | * A.L.E (Arcade Learning Environment)
3 | * Copyright (c) 2009-2013 by Yavar Naddaf, Joel Veness, Marc G. Bellemare and
4 | * the Reinforcement Learning and Artificial Intelligence Laboratory
5 | * Released under the GNU General Public License; see License.txt for details.
6 | *
7 | * Based on: Stella -- "An Atari 2600 VCS Emulator"
8 | * Copyright (c) 1995-2007 by Bradford W. Mott and the Stella team
9 | *
10 | * *****************************************************************************
11 | * ale_controller.hpp
12 | *
13 | * Superclass defining a variety of controllers -- main loops interfacing with
14 | * an agent in a particular way. This superclass handles work common to all
15 | * controllers, e.g. loading ROM settings and constructing the environment
16 | * wrapper.
17 | **************************************************************************** */
18 | #ifndef __ALE_CONTROLLER_HPP__
19 | #define __ALE_CONTROLLER_HPP__
20 |
21 | #include "../emucore/OSystem.hxx"
22 | #include "../emucore/m6502/src/System.hxx"
23 | #include "../environment/stella_environment.hpp"
24 |
25 | class ALEController {
26 | public:
27 | ALEController(OSystem * osystem);
28 | virtual ~ALEController() {}
29 |
30 | /** Main loop. Returns once ALE terminates. */
31 | virtual void run() = 0;
32 |
33 | protected:
34 | friend class ALEInterface;
35 |
36 | /** Applies the given action to the environment (e.g. by emulating or resetting) */
37 | reward_t applyActions(Action a, Action b);
38 | /** Support for SDL display... available to all controllers. Simply call it from run(). */
39 | void display();
40 |
41 | protected:
42 | OSystem* m_osystem;
43 | std::auto_ptr m_settings;
44 | StellaEnvironment m_environment;
45 | };
46 |
47 |
48 | #endif // __ALE_CONTROLLER_HPP__
49 |
--------------------------------------------------------------------------------
/atari_py/ale_interface/src/controllers/fifo_controller.hpp:
--------------------------------------------------------------------------------
1 | /* *****************************************************************************
2 | * A.L.E (Arcade Learning Environment)
3 | * Copyright (c) 2009-2013 by Yavar Naddaf, Joel Veness, Marc G. Bellemare and
4 | * the Reinforcement Learning and Artificial Intelligence Laboratory
5 | * Released under the GNU General Public License; see License.txt for details.
6 | *
7 | * Based on: Stella -- "An Atari 2600 VCS Emulator"
8 | * Copyright (c) 1995-2007 by Bradford W. Mott and the Stella team
9 | *
10 | * *****************************************************************************
11 | * fifo_controller.hpp
12 | *
13 | * The FIFOController class implements an Agent/ALE interface via stdin/stdout
14 | * or named pipes.
15 | **************************************************************************** */
16 |
17 | #ifndef __FIFO_CONTROLLER_HPP__
18 | #define __FIFO_CONTROLLER_HPP__
19 |
20 | #include "ale_controller.hpp"
21 |
22 | class FIFOController : public ALEController {
23 | public:
24 | FIFOController(OSystem* osystem, bool named_pipes = false);
25 | virtual ~FIFOController();
26 |
27 | virtual void run();
28 |
29 | private:
30 | void handshake(); // Perform handshaking
31 | void openNamedPipes();
32 |
33 | bool isDone();
34 | void sendData();
35 | void readAction(Action& action_a, Action& action_b);
36 |
37 | void sendScreen();
38 | int stringScreenRLE(const ALEScreen& screen, char * buffer);
39 | int stringScreenFull(const ALEScreen& screen, char * buffer);
40 | void sendRAM();
41 | void sendRL();
42 |
43 | private:
44 | bool m_named_pipes; // Whether to use named pipes
45 |
46 | int m_max_num_frames; // Maximum number of total frames before we stop
47 | bool m_run_length_encoding; // Whether to encode the data in a run-length fashion
48 |
49 | bool m_send_screen; // Agent requested screen data
50 | bool m_send_ram; // Agent requested RAM data
51 | bool m_send_rl; // Agent requested RL data
52 |
53 | FILE* m_fout;
54 | FILE* m_fin;
55 |
56 | reward_t latest_reward; // Most recent reward
57 | };
58 |
59 | #endif // __FIFO_CONTROLLER_HPP__
60 |
--------------------------------------------------------------------------------
/atari_py/ale_interface/src/controllers/module.mk:
--------------------------------------------------------------------------------
1 | MODULE := src/controllers
2 |
3 | MODULE_OBJS := \
4 | src/controllers/ale_controller.o \
5 | src/controllers/fifo_controller.o \
6 | src/controllers/rlglue_controller.o \
7 |
8 | MODULE_DIRS += \
9 | src/controllers
10 |
11 | # Include common rules
12 | include $(srcdir)/common.rules
13 |
--------------------------------------------------------------------------------
/atari_py/ale_interface/src/emucore/Booster.hxx:
--------------------------------------------------------------------------------
1 | //============================================================================
2 | //
3 | // SSSS tt lll lll
4 | // SS SS tt ll ll
5 | // SS tttttt eeee ll ll aaaa
6 | // SSSS tt ee ee ll ll aa
7 | // SS tt eeeeee ll ll aaaaa -- "An Atari 2600 VCS Emulator"
8 | // SS SS tt ee ll ll aa aa
9 | // SSSS ttt eeeee llll llll aaaaa
10 | //
11 | // Copyright (c) 1995-2007 by Bradford W. Mott and the Stella team
12 | //
13 | // See the file "license" for information on usage and redistribution of
14 | // this file, and for a DISCLAIMER OF ALL WARRANTIES.
15 | //
16 | // $Id: Booster.hxx,v 1.7 2007/01/01 18:04:45 stephena Exp $
17 | //============================================================================
18 |
19 | #ifndef BOOSTERGRIP_HXX
20 | #define BOOSTERGRIP_HXX
21 |
22 | #include "m6502/src/bspf/src/bspf.hxx"
23 | #include "Control.hxx"
24 |
25 | /**
26 | The standard Atari 2600 joystick controller fitted with the
27 | CBS Booster grip. The Booster grip has two more fire buttons
28 | on it (a booster and a trigger).
29 |
30 | @author Bradford W. Mott
31 | @version $Id: Booster.hxx,v 1.7 2007/01/01 18:04:45 stephena Exp $
32 | */
33 | class BoosterGrip : public Controller
34 | {
35 | public:
36 | /**
37 | Create a new booster grip joystick plugged into the specified jack
38 |
39 | @param jack The jack the controller is plugged into
40 | @param event The event object to use for events
41 | */
42 | BoosterGrip(Jack jack, const Event& event);
43 |
44 | /**
45 | Destructor
46 | */
47 | virtual ~BoosterGrip();
48 |
49 | public:
50 | /**
51 | Read the value of the specified digital pin for this controller.
52 |
53 | @param pin The pin of the controller jack to read
54 | @return The state of the pin
55 | */
56 | virtual bool read(DigitalPin pin);
57 |
58 | /**
59 | Read the resistance at the specified analog pin for this controller.
60 | The returned value is the resistance measured in ohms.
61 |
62 | @param pin The pin of the controller jack to read
63 | @return The resistance at the specified pin
64 | */
65 | virtual Int32 read(AnalogPin pin);
66 |
67 | /**
68 | Write the given value to the specified digital pin for this
69 | controller. Writing is only allowed to the pins associated
70 | with the PIA. Therefore you cannot write to pin six.
71 |
72 | @param pin The pin of the controller jack to write to
73 | @param value The value to write to the pin
74 | */
75 | virtual void write(DigitalPin pin, bool value);
76 | };
77 | #endif
78 |
79 |
--------------------------------------------------------------------------------
/atari_py/ale_interface/src/emucore/Control.cxx:
--------------------------------------------------------------------------------
1 | //============================================================================
2 | //
3 | // SSSS tt lll lll
4 | // SS SS tt ll ll
5 | // SS tttttt eeee ll ll aaaa
6 | // SSSS tt ee ee ll ll aa
7 | // SS tt eeeeee ll ll aaaaa -- "An Atari 2600 VCS Emulator"
8 | // SS SS tt ee ll ll aa aa
9 | // SSSS ttt eeeee llll llll aaaaa
10 | //
11 | // Copyright (c) 1995-2007 by Bradford W. Mott and the Stella team
12 | //
13 | // See the file "license" for information on usage and redistribution of
14 | // this file, and for a DISCLAIMER OF ALL WARRANTIES.
15 | //
16 | // $Id: Control.cxx,v 1.6 2007/01/05 17:54:09 stephena Exp $
17 | //============================================================================
18 |
19 | #include
20 | #include "Control.hxx"
21 |
22 | // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
23 | Controller::Controller(Jack jack, const Event& event, Type type)
24 | : myJack(jack),
25 | myEvent(event),
26 | myType(type)
27 | {
28 | }
29 |
30 | // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
31 | Controller::~Controller()
32 | {
33 | }
34 |
35 | // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
36 | const Controller::Type Controller::type()
37 | {
38 | return myType;
39 | }
40 |
41 | // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
42 | const Int32 Controller::maximumResistance = 0x7FFFFFFF;
43 |
44 | // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
45 | const Int32 Controller::minimumResistance = 0x00000000;
46 |
47 | // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
48 | Controller::Controller(const Controller& c)
49 | : myJack(c.myJack),
50 | myEvent(c.myEvent),
51 | myType(c.myType)
52 | {
53 | assert(false);
54 | }
55 |
56 | // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
57 | Controller& Controller::operator = (const Controller&)
58 | {
59 | assert(false);
60 | return *this;
61 | }
62 |
--------------------------------------------------------------------------------
/atari_py/ale_interface/src/emucore/Deserializer.cxx:
--------------------------------------------------------------------------------
1 | //============================================================================
2 | //
3 | // SSSS tt lll lll
4 | // SS SS tt ll ll
5 | // SS tttttt eeee ll ll aaaa
6 | // SSSS tt ee ee ll ll aa
7 | // SS tt eeeeee ll ll aaaaa -- "An Atari 2600 VCS Emulator"
8 | // SS SS tt ee ll ll aa aa
9 | // SSSS ttt eeeee llll llll aaaaa
10 | //
11 | // Copyright (c) 1995-2007 by Bradford W. Mott and the Stella team
12 | //
13 | // See the file "license" for information on usage and redistribution of
14 | // this file, and for a DISCLAIMER OF ALL WARRANTIES.
15 | //
16 | // $Id: Deserializer.cxx,v 1.12 2007/01/01 18:04:47 stephena Exp $
17 | //============================================================================
18 |
19 | #include "Deserializer.hxx"
20 | #include
21 | using namespace std;
22 |
23 | // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
24 | Deserializer::Deserializer(const string stream_str):
25 | myStream(stream_str) {
26 |
27 | }
28 |
29 |
30 |
31 |
32 | // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
33 | void Deserializer::close(void)
34 | {
35 | myStream.clear();
36 | }
37 |
38 |
39 |
40 | // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
41 | int Deserializer::getInt(void)
42 | {
43 | if(myStream.eof())
44 | throw "Deserializer: end of file";
45 |
46 | int val = 0;
47 | unsigned char buf[4];
48 | myStream.read((char*)buf, 4);
49 | for(int i = 0; i < 4; ++i)
50 | val += (int)(buf[i]) << (i<<3);
51 |
52 | return val;
53 | }
54 |
55 | // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
56 | string Deserializer::getString(void)
57 | {
58 | int len = getInt();
59 | string str;
60 | str.resize((string::size_type)len);
61 | myStream.read(&str[0], (streamsize)len);
62 |
63 | if(myStream.bad())
64 | throw "Deserializer: file read failed";
65 |
66 | return str;
67 | }
68 |
69 | // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
70 | bool Deserializer::getBool(void)
71 | {
72 | bool result = false;
73 |
74 | int b = getInt();
75 | if(b == (int)TruePattern)
76 | result = true;
77 | else if(b == (int)FalsePattern)
78 | result = false;
79 | else
80 | throw "Deserializer: data corruption";
81 |
82 | return result;
83 | }
84 |
--------------------------------------------------------------------------------
/atari_py/ale_interface/src/emucore/Deserializer.hxx:
--------------------------------------------------------------------------------
1 | //============================================================================
2 | //
3 | // SSSS tt lll lll
4 | // SS SS tt ll ll
5 | // SS tttttt eeee ll ll aaaa
6 | // SSSS tt ee ee ll ll aa
7 | // SS tt eeeeee ll ll aaaaa -- "An Atari 2600 VCS Emulator"
8 | // SS SS tt ee ll ll aa aa
9 | // SSSS ttt eeeee llll llll aaaaa
10 | //
11 | // Copyright (c) 1995-2007 by Bradford W. Mott and the Stella team
12 | //
13 | // See the file "license" for information on usage and redistribution of
14 | // this file, and for a DISCLAIMER OF ALL WARRANTIES.
15 | //
16 | // $Id: Deserializer.hxx,v 1.11 2007/01/01 18:04:47 stephena Exp $
17 | //============================================================================
18 |
19 | #ifndef DESERIALIZER_HXX
20 | #define DESERIALIZER_HXX
21 |
22 | #include
23 | #include "m6502/src/bspf/src/bspf.hxx"
24 |
25 | /**
26 | This class implements a Deserializer device, whereby data is
27 | deserialized from an input binary file in a system-independent
28 | way.
29 |
30 | All ints should be cast to their appropriate data type upon method
31 | return.
32 |
33 | @author Stephen Anthony
34 | @version $Id: Deserializer.hxx,v 1.11 2007/01/01 18:04:47 stephena Exp $
35 |
36 | Revised for ALE on Sep 20, 2009
37 | The new version uses a stringstream (not a file stream)
38 |
39 | TODO: don't copy the whole streams.
40 | */
41 | class Deserializer {
42 | public:
43 | /**
44 | Creates a new Deserializer device.
45 | */
46 | Deserializer(const std::string stream_str);
47 |
48 | void close(void);
49 |
50 | /**
51 | Reads an int value from the current input stream.
52 |
53 | @result The int value which has been read from the stream.
54 | */
55 | int getInt(void);
56 |
57 | /**
58 | Reads a string from the current input stream.
59 |
60 | @result The string which has been read from the stream.
61 | */
62 | std::string getString(void);
63 |
64 | /**
65 | Reads a boolean value from the current input stream.
66 |
67 | @result The boolean value which has been read from the stream.
68 | */
69 | bool getBool(void);
70 |
71 | bool isOpen(void) {return true;}
72 | private:
73 | // The stream to get the deserialized data from.
74 | std::stringstream myStream;
75 |
76 | enum {
77 | TruePattern = 0xfab1fab2,
78 | FalsePattern = 0xbad1bad2
79 | };
80 | };
81 |
82 | #endif
83 |
--------------------------------------------------------------------------------
/atari_py/ale_interface/src/emucore/Driving.hxx:
--------------------------------------------------------------------------------
1 | //============================================================================
2 | //
3 | // SSSS tt lll lll
4 | // SS SS tt ll ll
5 | // SS tttttt eeee ll ll aaaa
6 | // SSSS tt ee ee ll ll aa
7 | // SS tt eeeeee ll ll aaaaa -- "An Atari 2600 VCS Emulator"
8 | // SS SS tt ee ll ll aa aa
9 | // SSSS ttt eeeee llll llll aaaaa
10 | //
11 | // Copyright (c) 1995-2007 by Bradford W. Mott and the Stella team
12 | //
13 | // See the file "license" for information on usage and redistribution of
14 | // this file, and for a DISCLAIMER OF ALL WARRANTIES.
15 | //
16 | // $Id: Driving.hxx,v 1.6 2007/01/01 18:04:47 stephena Exp $
17 | //============================================================================
18 |
19 | #ifndef DRIVING_HXX
20 | #define DRIVING_HXX
21 |
22 | class Driving;
23 | class System;
24 |
25 | #include "m6502/src/bspf/src/bspf.hxx"
26 | #include "Control.hxx"
27 |
28 | /**
29 | The standard Atari 2600 Indy 500 driving controller.
30 |
31 | @author Bradford W. Mott
32 | @version $Id: Driving.hxx,v 1.6 2007/01/01 18:04:47 stephena Exp $
33 | */
34 | class Driving : public Controller
35 | {
36 | public:
37 | /**
38 | Create a new Indy 500 driving controller plugged into
39 | the specified jack
40 |
41 | @param jack The jack the controller is plugged into
42 | @param event The event object to use for events
43 | */
44 | Driving(Jack jack, const Event& event);
45 |
46 | /**
47 | Destructor
48 | */
49 | virtual ~Driving();
50 |
51 | public:
52 | /**
53 | Read the value of the specified digital pin for this controller.
54 |
55 | @param pin The pin of the controller jack to read
56 | @return The state of the pin
57 | */
58 | virtual bool read(DigitalPin pin);
59 |
60 | /**
61 | Read the resistance at the specified analog pin for this controller.
62 | The returned value is the resistance measured in ohms.
63 |
64 | @param pin The pin of the controller jack to read
65 | @return The resistance at the specified pin
66 | */
67 | virtual Int32 read(AnalogPin pin);
68 |
69 | /**
70 | Write the given value to the specified digital pin for this
71 | controller. Writing is only allowed to the pins associated
72 | with the PIA. Therefore you cannot write to pin six.
73 |
74 | @param pin The pin of the controller jack to write to
75 | @param value The value to write to the pin
76 | */
77 | virtual void write(DigitalPin pin, bool value);
78 |
79 | private:
80 | // Counter to iterate through the gray codes
81 | uInt32 myCounter;
82 | };
83 | #endif
84 |
85 |
--------------------------------------------------------------------------------
/atari_py/ale_interface/src/emucore/Event.cxx:
--------------------------------------------------------------------------------
1 | //============================================================================
2 | //
3 | // SSSS tt lll lll
4 | // SS SS tt ll ll
5 | // SS tttttt eeee ll ll aaaa
6 | // SSSS tt ee ee ll ll aa
7 | // SS tt eeeeee ll ll aaaaa -- "An Atari 2600 VCS Emulator"
8 | // SS SS tt ee ll ll aa aa
9 | // SSSS ttt eeeee llll llll aaaaa
10 | //
11 | // Copyright (c) 1995-2007 by Bradford W. Mott and the Stella team
12 | //
13 | // See the file "license" for information on usage and redistribution of
14 | // this file, and for a DISCLAIMER OF ALL WARRANTIES.
15 | //
16 | // $Id: Event.cxx,v 1.11 2007/01/01 18:04:47 stephena Exp $
17 | //============================================================================
18 |
19 | #include "Event.hxx"
20 |
21 | // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
22 | Event::Event()
23 | : myNumberOfTypes(Event::LastType)
24 | {
25 | // Set all of the events to 0 / false to start with,
26 | // including analog paddle events. Doing it this way
27 | // is a bit of a hack ...
28 | clear();
29 |
30 | myValues[PaddleZeroResistance] =
31 | myValues[PaddleOneResistance] =
32 | myValues[PaddleTwoResistance] =
33 | myValues[PaddleThreeResistance] = 0;
34 | }
35 |
36 | // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
37 | Event::~Event()
38 | {
39 | }
40 |
41 | // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
42 | Int32 Event::get(Type type) const
43 | {
44 | return myValues[type];
45 | }
46 |
47 | // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
48 | void Event::set(Type type, Int32 value)
49 | {
50 | myValues[type] = value;
51 | }
52 |
53 | // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
54 | void Event::clear()
55 | {
56 | for(int i = 0; i < myNumberOfTypes; ++i)
57 | {
58 | if(i != PaddleZeroResistance && i != PaddleOneResistance &&
59 | i != PaddleTwoResistance && i != PaddleThreeResistance)
60 | myValues[i] = 0;
61 | }
62 | }
63 |
--------------------------------------------------------------------------------
/atari_py/ale_interface/src/emucore/Joystick.cxx:
--------------------------------------------------------------------------------
1 | //============================================================================
2 | //
3 | // SSSS tt lll lll
4 | // SS SS tt ll ll
5 | // SS tttttt eeee ll ll aaaa
6 | // SSSS tt ee ee ll ll aa
7 | // SS tt eeeeee ll ll aaaaa -- "An Atari 2600 VCS Emulator"
8 | // SS SS tt ee ll ll aa aa
9 | // SSSS ttt eeeee llll llll aaaaa
10 | //
11 | // Copyright (c) 1995-2007 by Bradford W. Mott and the Stella team
12 | //
13 | // See the file "license" for information on usage and redistribution of
14 | // this file, and for a DISCLAIMER OF ALL WARRANTIES.
15 | //
16 | // $Id: Joystick.cxx,v 1.7 2007/01/05 17:54:23 stephena Exp $
17 | //============================================================================
18 |
19 | #include
20 | #include "Event.hxx"
21 | #include "Joystick.hxx"
22 |
23 | // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
24 | Joystick::Joystick(Jack jack, const Event& event)
25 | : Controller(jack, event, Controller::Joystick)
26 | {
27 | }
28 |
29 | // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
30 | Joystick::~Joystick()
31 | {
32 | }
33 |
34 | // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
35 | bool Joystick::read(DigitalPin pin)
36 | {
37 | switch(pin)
38 | {
39 | case One:
40 | return (myJack == Left) ? (myEvent.get(Event::JoystickZeroUp) == 0) :
41 | (myEvent.get(Event::JoystickOneUp) == 0);
42 |
43 | case Two:
44 | return (myJack == Left) ? (myEvent.get(Event::JoystickZeroDown) == 0) :
45 | (myEvent.get(Event::JoystickOneDown) == 0);
46 |
47 | case Three:
48 | return (myJack == Left) ? (myEvent.get(Event::JoystickZeroLeft) == 0) :
49 | (myEvent.get(Event::JoystickOneLeft) == 0);
50 |
51 | case Four:
52 | return (myJack == Left) ? (myEvent.get(Event::JoystickZeroRight) == 0) :
53 | (myEvent.get(Event::JoystickOneRight) == 0);
54 |
55 | case Six:
56 | return (myJack == Left) ? (myEvent.get(Event::JoystickZeroFire) == 0) :
57 | (myEvent.get(Event::JoystickOneFire) == 0);
58 |
59 | default:
60 | return true;
61 | }
62 | }
63 |
64 | // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
65 | Int32 Joystick::read(AnalogPin)
66 | {
67 | // Analog pins are not connect in joystick so we have infinite resistance
68 | return maximumResistance;
69 | }
70 |
71 | // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
72 | void Joystick::write(DigitalPin, bool)
73 | {
74 | // Writing doesn't do anything to the joystick...
75 | }
76 |
--------------------------------------------------------------------------------
/atari_py/ale_interface/src/emucore/Joystick.hxx:
--------------------------------------------------------------------------------
1 | //============================================================================
2 | //
3 | // SSSS tt lll lll
4 | // SS SS tt ll ll
5 | // SS tttttt eeee ll ll aaaa
6 | // SSSS tt ee ee ll ll aa
7 | // SS tt eeeeee ll ll aaaaa -- "An Atari 2600 VCS Emulator"
8 | // SS SS tt ee ll ll aa aa
9 | // SSSS ttt eeeee llll llll aaaaa
10 | //
11 | // Copyright (c) 1995-2007 by Bradford W. Mott and the Stella team
12 | //
13 | // See the file "license" for information on usage and redistribution of
14 | // this file, and for a DISCLAIMER OF ALL WARRANTIES.
15 | //
16 | // $Id: Joystick.hxx,v 1.6 2007/01/01 18:04:48 stephena Exp $
17 | //============================================================================
18 |
19 | #ifndef JOYSTICK_HXX
20 | #define JOYSTICK_HXX
21 |
22 | #include "m6502/src/bspf/src/bspf.hxx"
23 | #include "Control.hxx"
24 |
25 | /**
26 | The standard Atari 2600 joystick controller.
27 |
28 | @author Bradford W. Mott
29 | @version $Id: Joystick.hxx,v 1.6 2007/01/01 18:04:48 stephena Exp $
30 | */
31 | class Joystick : public Controller
32 | {
33 | public:
34 | /**
35 | Create a new joystick controller plugged into the specified jack
36 |
37 | @param jack The jack the controller is plugged into
38 | @param event The event object to use for events
39 | */
40 | Joystick(Jack jack, const Event& event);
41 |
42 | /**
43 | Destructor
44 | */
45 | virtual ~Joystick();
46 |
47 | public:
48 | /**
49 | Read the value of the specified digital pin for this controller.
50 |
51 | @param pin The pin of the controller jack to read
52 | @return The state of the pin
53 | */
54 | virtual bool read(DigitalPin pin);
55 |
56 | /**
57 | Read the resistance at the specified analog pin for this controller.
58 | The returned value is the resistance measured in ohms.
59 |
60 | @param pin The pin of the controller jack to read
61 | @return The resistance at the specified pin
62 | */
63 | virtual Int32 read(AnalogPin pin);
64 |
65 | /**
66 | Write the given value to the specified digital pin for this
67 | controller. Writing is only allowed to the pins associated
68 | with the PIA. Therefore you cannot write to pin six.
69 |
70 | @param pin The pin of the controller jack to write to
71 | @param value The value to write to the pin
72 | */
73 | virtual void write(DigitalPin pin, bool value);
74 | };
75 |
76 | #endif
77 |
--------------------------------------------------------------------------------
/atari_py/ale_interface/src/emucore/Keyboard.hxx:
--------------------------------------------------------------------------------
1 | //============================================================================
2 | //
3 | // SSSS tt lll lll
4 | // SS SS tt ll ll
5 | // SS tttttt eeee ll ll aaaa
6 | // SSSS tt ee ee ll ll aa
7 | // SS tt eeeeee ll ll aaaaa -- "An Atari 2600 VCS Emulator"
8 | // SS SS tt ee ll ll aa aa
9 | // SSSS ttt eeeee llll llll aaaaa
10 | //
11 | // Copyright (c) 1995-2007 by Bradford W. Mott and the Stella team
12 | //
13 | // See the file "license" for information on usage and redistribution of
14 | // this file, and for a DISCLAIMER OF ALL WARRANTIES.
15 | //
16 | // $Id: Keyboard.hxx,v 1.6 2007/01/01 18:04:48 stephena Exp $
17 | //============================================================================
18 |
19 | #ifndef KEYBOARD_HXX
20 | #define KEYBOARD_HXX
21 |
22 | #include "m6502/src/bspf/src/bspf.hxx"
23 | #include "Control.hxx"
24 |
25 | /**
26 | The standard Atari 2600 keyboard controller
27 |
28 | @author Bradford W. Mott
29 | @version $Id: Keyboard.hxx,v 1.6 2007/01/01 18:04:48 stephena Exp $
30 | */
31 | class Keyboard : public Controller
32 | {
33 | public:
34 | /**
35 | Create a new keyboard controller plugged into the specified jack
36 |
37 | @param jack The jack the controller is plugged into
38 | @param event The event object to use for events
39 | */
40 | Keyboard(Jack jack, const Event& event);
41 |
42 | /**
43 | Destructor
44 | */
45 | virtual ~Keyboard();
46 |
47 | public:
48 | /**
49 | Read the value of the specified digital pin for this controller.
50 |
51 | @param pin The pin of the controller jack to read
52 | @return The state of the pin
53 | */
54 | virtual bool read(DigitalPin pin);
55 |
56 | /**
57 | Read the resistance at the specified analog pin for this controller.
58 | The returned value is the resistance measured in ohms.
59 |
60 | @param pin The pin of the controller jack to read
61 | @return The resistance at the specified pin
62 | */
63 | virtual Int32 read(AnalogPin pin);
64 |
65 | /**
66 | Write the given value to the specified digital pin for this
67 | controller. Writing is only allowed to the pins associated
68 | with the PIA. Therefore you cannot write to pin six.
69 |
70 | @param pin The pin of the controller jack to write to
71 | @param value The value to write to the pin
72 | */
73 | virtual void write(DigitalPin pin, bool value);
74 |
75 | private:
76 | // State of the output pins
77 | uInt8 myPinState;
78 | };
79 |
80 | #endif
81 |
--------------------------------------------------------------------------------
/atari_py/ale_interface/src/emucore/MD5.hxx:
--------------------------------------------------------------------------------
1 | //============================================================================
2 | //
3 | // SSSS tt lll lll
4 | // SS SS tt ll ll
5 | // SS tttttt eeee ll ll aaaa
6 | // SSSS tt ee ee ll ll aa
7 | // SS tt eeeeee ll ll aaaaa -- "An Atari 2600 VCS Emulator"
8 | // SS SS tt ee ll ll aa aa
9 | // SSSS ttt eeeee llll llll aaaaa
10 | //
11 | // Copyright (c) 1995-2007 by Bradford W. Mott and the Stella team
12 | //
13 | // See the file "license" for information on usage and redistribution of
14 | // this file, and for a DISCLAIMER OF ALL WARRANTIES.
15 | //
16 | // $Id: MD5.hxx,v 1.5 2007/01/01 18:04:48 stephena Exp $
17 | //============================================================================
18 |
19 | #ifndef MD5_HXX
20 | #define MD5_HXX
21 |
22 | #include "m6502/src/bspf/src/bspf.hxx"
23 |
24 | /**
25 | Get the MD5 Message-Digest of the specified message with the
26 | given length. The digest consists of 32 hexadecimal digits.
27 |
28 | @param buffer The message to compute the digest of
29 | @param length The length of the message
30 | @return The message-digest
31 | */
32 | std::string MD5(const uInt8* buffer, uInt32 length);
33 |
34 | #endif
35 |
--------------------------------------------------------------------------------
/atari_py/ale_interface/src/emucore/MediaSrc.cxx:
--------------------------------------------------------------------------------
1 | //============================================================================
2 | //
3 | // SSSS tt lll lll
4 | // SS SS tt ll ll
5 | // SS tttttt eeee ll ll aaaa
6 | // SSSS tt ee ee ll ll aa
7 | // SS tt eeeeee ll ll aaaaa -- "An Atari 2600 VCS Emulator"
8 | // SS SS tt ee ll ll aa aa
9 | // SSSS ttt eeeee llll llll aaaaa
10 | //
11 | // Copyright (c) 1995-2007 by Bradford W. Mott and the Stella team
12 | //
13 | // See the file "license" for information on usage and redistribution of
14 | // this file, and for a DISCLAIMER OF ALL WARRANTIES.
15 | //
16 | // $Id: MediaSrc.cxx,v 1.4 2007/01/01 18:04:49 stephena Exp $
17 | //============================================================================
18 |
19 | #include
20 | #include "MediaSrc.hxx"
21 |
22 | // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
23 | MediaSource::MediaSource()
24 | {
25 | }
26 |
27 | // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
28 | MediaSource::~MediaSource()
29 | {
30 | }
31 |
32 | // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
33 | MediaSource::MediaSource(const MediaSource&)
34 | {
35 | }
36 |
37 | // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
38 | MediaSource& MediaSource::operator = (const MediaSource&)
39 | {
40 | assert(false);
41 |
42 | return *this;
43 | }
44 |
45 |
--------------------------------------------------------------------------------
/atari_py/ale_interface/src/emucore/Paddles.hxx:
--------------------------------------------------------------------------------
1 | //============================================================================
2 | //
3 | // SSSS tt lll lll
4 | // SS SS tt ll ll
5 | // SS tttttt eeee ll ll aaaa
6 | // SSSS tt ee ee ll ll aa
7 | // SS tt eeeeee ll ll aaaaa -- "An Atari 2600 VCS Emulator"
8 | // SS SS tt ee ll ll aa aa
9 | // SSSS ttt eeeee llll llll aaaaa
10 | //
11 | // Copyright (c) 1995-2007 by Bradford W. Mott and the Stella team
12 | //
13 | // See the file "license" for information on usage and redistribution of
14 | // this file, and for a DISCLAIMER OF ALL WARRANTIES.
15 | //
16 | // $Id: Paddles.hxx,v 1.7 2007/01/01 18:04:49 stephena Exp $
17 | //============================================================================
18 |
19 | #ifndef PADDLES_HXX
20 | #define PADDLES_HXX
21 |
22 | #include "m6502/src/bspf/src/bspf.hxx"
23 | #include "Control.hxx"
24 |
25 | /**
26 | The standard Atari 2600 pair of paddle controllers.
27 |
28 | @author Bradford W. Mott
29 | @version $Id: Paddles.hxx,v 1.7 2007/01/01 18:04:49 stephena Exp $
30 | */
31 | class Paddles : public Controller
32 | {
33 | public:
34 | /**
35 | Create a new pair of paddle controllers plugged into the specified jack
36 |
37 | @param jack The jack the controller is plugged into
38 | @param event The event object to use for events
39 | @param swap Whether to swap the paddles plugged into this jack
40 | */
41 | Paddles(Jack jack, const Event& event, bool swap);
42 |
43 | /**
44 | Destructor
45 | */
46 | virtual ~Paddles();
47 |
48 | public:
49 | /**
50 | Read the value of the specified digital pin for this controller.
51 |
52 | @param pin The pin of the controller jack to read
53 | @return The state of the pin
54 | */
55 | virtual bool read(DigitalPin pin);
56 |
57 | /**
58 | Read the resistance at the specified analog pin for this controller.
59 | The returned value is the resistance measured in ohms.
60 |
61 | @param pin The pin of the controller jack to read
62 | @return The resistance at the specified pin
63 | */
64 | virtual Int32 read(AnalogPin pin);
65 |
66 | /**
67 | Write the given value to the specified digital pin for this
68 | controller. Writing is only allowed to the pins associated
69 | with the PIA. Therefore you cannot write to pin six.
70 |
71 | @param pin The pin of the controller jack to write to
72 | @param value The value to write to the pin
73 | */
74 | virtual void write(DigitalPin pin, bool value);
75 |
76 | private:
77 | // Used to implement paddle swapping efficiently, and eliminate
78 | // testing at runtime
79 | Event::Type myPinEvents[4][2];
80 | };
81 |
82 | #endif
83 |
--------------------------------------------------------------------------------
/atari_py/ale_interface/src/emucore/Random.cxx:
--------------------------------------------------------------------------------
1 | //============================================================================
2 | //
3 | // SSSS tt lll lll
4 | // SS SS tt ll ll
5 | // SS tttttt eeee ll ll aaaa
6 | // SSSS tt ee ee ll ll aa
7 | // SS tt eeeeee ll ll aaaaa -- "An Atari 2600 VCS Emulator"
8 | // SS SS tt ee ll ll aa aa
9 | // SSSS ttt eeeee llll llll aaaaa
10 | //
11 | // Copyright (c) 1995-2007 by Bradford W. Mott and the Stella team
12 | //
13 | // See the file "license" for information on usage and redistribution of
14 | // this file, and for a DISCLAIMER OF ALL WARRANTIES.
15 | //
16 | // $Id: Random.cxx,v 1.4 2007/01/01 18:04:49 stephena Exp $
17 | //============================================================================
18 |
19 | #include
20 | #include "Random.hxx"
21 |
22 | // TODO(mgb): bring this include in once we switch to C++11.
23 | // #include
24 | #include "TinyMT/tinymt32.h"
25 |
26 | // The random number generator is defined here to avoid having to expose tinymt32.h.
27 | namespace RandomStatic {
28 |
29 | typedef tinymt32_t randgen_t;
30 | // Random number generator
31 | randgen_t rndGenerator;
32 | }
33 |
34 |
35 | // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
36 | void Random::seed(uInt32 value)
37 | {
38 | ourSeed = value;
39 | ourSeeded = true;
40 | // TODO(mgb): this is the C++11 variant.
41 | // rndGenerator.seed(ourSeed);
42 |
43 | tinymt32_init(&RandomStatic::rndGenerator, ourSeed);
44 | }
45 |
46 | // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
47 | Random::Random()
48 | {
49 | // If we haven't been seeded then seed ourself
50 | if(!ourSeeded)
51 | seed((uInt32) time(NULL));
52 | }
53 |
54 | // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
55 | uInt32 Random::next()
56 | {
57 | // TODO(mgb): C++11
58 | // return rndGenerator();
59 | return static_cast(tinymt32_generate_uint32(&RandomStatic::rndGenerator));
60 | }
61 |
62 | // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
63 | double Random::nextDouble()
64 | {
65 | // TODO(mgb): C++11
66 | // return rndGenerator() / double(rndGenerator.max() + 1.0);
67 | return tinymt32_generate_32double(&RandomStatic::rndGenerator);
68 | }
69 |
70 | // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
71 | uInt32 Random::ourSeed = 0;
72 |
73 | // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
74 | bool Random::ourSeeded = false;
75 |
76 |
77 |
--------------------------------------------------------------------------------
/atari_py/ale_interface/src/emucore/Random.hxx:
--------------------------------------------------------------------------------
1 | //============================================================================
2 | //
3 | // SSSS tt lll lll
4 | // SS SS tt ll ll
5 | // SS tttttt eeee ll ll aaaa
6 | // SSSS tt ee ee ll ll aa
7 | // SS tt eeeeee ll ll aaaaa -- "An Atari 2600 VCS Emulator"
8 | // SS SS tt ee ll ll aa aa
9 | // SSSS ttt eeeee llll llll aaaaa
10 | //
11 | // Copyright (c) 1995-2007 by Bradford W. Mott and the Stella team
12 | //
13 | // See the file "license" for information on usage and redistribution of
14 | // this file, and for a DISCLAIMER OF ALL WARRANTIES.
15 | //
16 | // $Id: Random.hxx,v 1.4 2007/01/01 18:04:49 stephena Exp $
17 | //============================================================================
18 |
19 | #ifndef RANDOM_HXX
20 | #define RANDOM_HXX
21 |
22 | #include "m6502/src/bspf/src/bspf.hxx"
23 |
24 | /**
25 | This is a quick-and-dirty random number generator. It is based on
26 | information in Chapter 7 of "Numerical Recipes in C". It's a simple
27 | linear congruential generator.
28 |
29 | @author Bradford W. Mott
30 | @version $Id: Random.hxx,v 1.4 2007/01/01 18:04:49 stephena Exp $
31 | */
32 | class Random
33 | {
34 | public:
35 |
36 | /**
37 | Class method which allows you to set the seed that'll be used
38 | for created new instances of this class
39 |
40 | @param value The value to seed the random number generator with
41 | */
42 | static void seed(uInt32 value);
43 |
44 | /**
45 | Create a new random number generator
46 | */
47 | Random();
48 |
49 | /**
50 | Answer the next random number from the random number generator
51 |
52 | @return A random number
53 | */
54 | uInt32 next();
55 |
56 | /**
57 | Answer the next random number between 0 and 1 from the random number generator
58 |
59 | @return A random number between 0 and 1
60 | */
61 | double nextDouble();
62 |
63 | private:
64 |
65 | // Seed to use for creating new random number generators
66 | static uInt32 ourSeed;
67 |
68 | // Indicates if seed has been set or not
69 | static bool ourSeeded;
70 | };
71 | #endif
72 |
73 |
--------------------------------------------------------------------------------
/atari_py/ale_interface/src/emucore/Serializer.cxx:
--------------------------------------------------------------------------------
1 | //============================================================================
2 | //
3 | // SSSS tt lll lll
4 | // SS SS tt ll ll
5 | // SS tttttt eeee ll ll aaaa
6 | // SSSS tt ee ee ll ll aa
7 | // SS tt eeeeee ll ll aaaaa -- "An Atari 2600 VCS Emulator"
8 | // SS SS tt ee ll ll aa aa
9 | // SSSS ttt eeeee llll llll aaaaa
10 | //
11 | // Copyright (c) 1995-2007 by Bradford W. Mott and the Stella team
12 | //
13 | // See the file "license" for information on usage and redistribution of
14 | // this file, and for a DISCLAIMER OF ALL WARRANTIES.
15 | //
16 | // $Id: Serializer.cxx,v 1.11 2007/01/01 18:04:49 stephena Exp $
17 | //============================================================================
18 |
19 | #include "Serializer.hxx"
20 | using namespace std;
21 |
22 |
23 | // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
24 | Serializer::Serializer(void) {
25 | myStream.clear();
26 |
27 | }
28 |
29 | // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
30 | Serializer::~Serializer(void)
31 | {
32 | close();
33 | }
34 |
35 |
36 | // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
37 | void Serializer::close(void)
38 | {
39 | myStream.clear();
40 | }
41 |
42 |
43 | // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
44 | void Serializer::putInt(int value)
45 | {
46 | unsigned char buf[4];
47 | for(int i = 0; i < 4; ++i)
48 | buf[i] = (value >> (i<<3)) & 0xff;
49 |
50 | myStream.write((char*)buf, 4);
51 | if(myStream.bad())
52 | throw "Serializer: file write failed";
53 | }
54 |
55 | // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
56 | void Serializer::putString(const string& str)
57 | {
58 | int len = str.length();
59 | putInt(len);
60 | myStream.write(str.data(), (streamsize)len);
61 |
62 | if(myStream.bad())
63 | throw "Serializer: file write failed";
64 | }
65 |
66 | // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
67 | void Serializer::putBool(bool b)
68 | {
69 | putInt(b ? TruePattern: FalsePattern);
70 | }
71 |
72 |
--------------------------------------------------------------------------------
/atari_py/ale_interface/src/emucore/Switches.hxx:
--------------------------------------------------------------------------------
1 | //============================================================================
2 | //
3 | // SSSS tt lll lll
4 | // SS SS tt ll ll
5 | // SS tttttt eeee ll ll aaaa
6 | // SSSS tt ee ee ll ll aa
7 | // SS tt eeeeee ll ll aaaaa -- "An Atari 2600 VCS Emulator"
8 | // SS SS tt ee ll ll aa aa
9 | // SSSS ttt eeeee llll llll aaaaa
10 | //
11 | // Copyright (c) 1995-2007 by Bradford W. Mott and the Stella team
12 | //
13 | // See the file "license" for information on usage and redistribution of
14 | // this file, and for a DISCLAIMER OF ALL WARRANTIES.
15 | //
16 | // $Id: Switches.hxx,v 1.4 2007/01/01 18:04:50 stephena Exp $
17 | //============================================================================
18 |
19 | #ifndef SWITCHES_HXX
20 | #define SWITCHES_HXX
21 |
22 | class Event;
23 | class Properties;
24 | class Switches;
25 |
26 | #include "m6502/src/bspf/src/bspf.hxx"
27 |
28 | /**
29 | This class represents the console switches of the game console.
30 |
31 | @author Bradford W. Mott
32 | @version $Id: Switches.hxx,v 1.4 2007/01/01 18:04:50 stephena Exp $
33 | */
34 | class Switches
35 | {
36 | public:
37 | /**
38 | Create a new set of switches using the specified events and
39 | properties
40 |
41 | @param event The event object to use for events
42 | */
43 | Switches(const Event& event, const Properties& properties);
44 |
45 | /**
46 | Destructor
47 | */
48 | virtual ~Switches();
49 |
50 | public:
51 | /**
52 | Get the value of the console switches
53 |
54 | @return The 8 bits which represent the state of the console switches
55 | */
56 | uInt8 read();
57 |
58 | private:
59 | // Reference to the event object to use
60 | const Event& myEvent;
61 |
62 | // State of the console switches
63 | uInt8 mySwitches;
64 | };
65 | #endif
66 |
67 |
--------------------------------------------------------------------------------
/atari_py/ale_interface/src/emucore/m6502/Copyright.txt:
--------------------------------------------------------------------------------
1 | ===============================================================================
2 |
3 | MM MM 6666 555555 0000 2222
4 | MMMM MMMM 66 66 55 00 00 22 22
5 | MM MMM MM 66 55 00 00 22
6 | MM M MM 66666 55555 00 00 22222 -- "A 6502 Microprocessor Emulator"
7 | MM MM 66 66 55 00 00 22
8 | MM MM 66 66 55 55 00 00 22
9 | MM MM 6666 5555 0000 222222
10 |
11 | ===============================================================================
12 | License Information and Copyright Notice
13 | ===============================================================================
14 |
15 | Copyright (C) 1995-2002 Bradford W. Mott
16 |
17 | This program is free software; you can redistribute it and/or modify it under
18 | the terms of the GNU General Public License as published by the Free Software
19 | Foundation; either version 2 of the License, or any later version.
20 |
21 | You should have received a copy of the GNU General Public License version 2
22 | along with this program (License.txt); if not, write to the Free Software
23 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
24 |
25 | This program is distributed in the hope that it will be useful, but WITHOUT
26 | ANY WARRANTY. IN NO EVENT SHALL THE AUTHORS OR DISTRIBUTORS BE LIABLE TO ANY
27 | PARTY FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
28 | ARISING OUT OF THE USE OF THIS SOFTWARE, ITS DOCUMENTATION, OR ANY DERIVATIVES
29 | THEREOF, EVEN IF THE AUTHORS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH
30 | DAMAGE.
31 |
32 | THE AUTHORS AND DISTRIBUTORS SPECIFICALLY DISCLAIM ANY WARRANTIES, INCLUDING,
33 | BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
34 | PARTICULAR PURPOSE, AND NON-INFRINGEMENT. THIS SOFTWARE IS PROVIDED ON AN
35 | "AS IS" BASIS, AND THE AUTHORS AND DISTRIBUTORS HAVE NO OBLIGATION TO PROVIDE
36 | MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
37 |
38 |
--------------------------------------------------------------------------------
/atari_py/ale_interface/src/emucore/m6502/module.mk:
--------------------------------------------------------------------------------
1 | MODULE := src/emucore/m6502
2 |
3 | MODULE_OBJS := \
4 | src/emucore/m6502/src/Device.o \
5 | src/emucore/m6502/src/M6502.o \
6 | src/emucore/m6502/src/M6502Low.o \
7 | src/emucore/m6502/src/M6502Hi.o \
8 | src/emucore/m6502/src/NullDev.o \
9 | src/emucore/m6502/src/System.o
10 |
11 | MODULE_DIRS += \
12 | src/emucore/m6502/src
13 |
14 | # Include common rules
15 | include $(srcdir)/common.rules
16 |
--------------------------------------------------------------------------------
/atari_py/ale_interface/src/emucore/m6502/src/Device.cxx:
--------------------------------------------------------------------------------
1 | //============================================================================
2 | //
3 | // MM MM 6666 555555 0000 2222
4 | // MMMM MMMM 66 66 55 00 00 22 22
5 | // MM MMM MM 66 55 00 00 22
6 | // MM M MM 66666 55555 00 00 22222 -- "A 6502 Microprocessor Emulator"
7 | // MM MM 66 66 55 00 00 22
8 | // MM MM 66 66 55 55 00 00 22
9 | // MM MM 6666 5555 0000 222222
10 | //
11 | // Copyright (c) 1995-2007 by Bradford W. Mott and the Stella team
12 | //
13 | // See the file "license" for information on usage and redistribution of
14 | // this file, and for a DISCLAIMER OF ALL WARRANTIES.
15 | //
16 | // $Id: Device.cxx,v 1.4 2007/01/01 18:04:50 stephena Exp $
17 | //============================================================================
18 |
19 | #include "Device.hxx"
20 |
21 | // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
22 | Device::Device()
23 | : mySystem(0)
24 | {
25 | }
26 |
27 | // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
28 | Device::~Device()
29 | {
30 | }
31 |
32 | // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
33 | void Device::systemCyclesReset()
34 | {
35 | // By default I do nothing when my system resets its cycle counter
36 | }
37 |
38 |
--------------------------------------------------------------------------------
/atari_py/ale_interface/src/emucore/m6502/src/NullDev.cxx:
--------------------------------------------------------------------------------
1 | //============================================================================
2 | //
3 | // MM MM 6666 555555 0000 2222
4 | // MMMM MMMM 66 66 55 00 00 22 22
5 | // MM MMM MM 66 55 00 00 22
6 | // MM M MM 66666 55555 00 00 22222 -- "A 6502 Microprocessor Emulator"
7 | // MM MM 66 66 55 00 00 22
8 | // MM MM 66 66 55 55 00 00 22
9 | // MM MM 6666 5555 0000 222222
10 | //
11 | // Copyright (c) 1995-2007 by Bradford W. Mott and the Stella team
12 | //
13 | // See the file "license" for information on usage and redistribution of
14 | // this file, and for a DISCLAIMER OF ALL WARRANTIES.
15 | //
16 | // $Id: NullDev.cxx,v 1.5 2007/01/01 18:04:51 stephena Exp $
17 | //============================================================================
18 |
19 | #include "NullDev.hxx"
20 | #include "Serializer.hxx"
21 | #include "Deserializer.hxx"
22 | using namespace std;
23 |
24 | // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
25 | NullDevice::NullDevice()
26 | {
27 | }
28 |
29 | // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
30 | NullDevice::~NullDevice()
31 | {
32 | }
33 |
34 | // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
35 | const char* NullDevice::name() const
36 | {
37 | return "NULL";
38 | }
39 |
40 | // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
41 | void NullDevice::reset()
42 | {
43 | }
44 |
45 | // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
46 | void NullDevice::install(System& system)
47 | {
48 | mySystem = &system;
49 | }
50 |
51 | // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
52 | uInt8 NullDevice::peek(uInt16 address)
53 | {
54 | cerr << hex << "NullDevice: peek(" << address << ")" << endl;
55 | return 0;
56 | }
57 |
58 | // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
59 | void NullDevice::poke(uInt16 address, uInt8 value)
60 | {
61 | cerr << hex << "NullDevice: poke(" << address << "," << value << ")" << endl;
62 | }
63 |
64 | // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
65 | bool NullDevice::save(Serializer& out)
66 | {
67 | return true;
68 | }
69 |
70 | // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
71 | bool NullDevice::load(Deserializer& in)
72 | {
73 | return true;
74 | }
75 |
--------------------------------------------------------------------------------
/atari_py/ale_interface/src/emucore/m6502/src/bspf/Copyright.txt:
--------------------------------------------------------------------------------
1 | ===============================================================================
2 |
3 | BBBBB SSSS PPPPP FFFFFF
4 | BB BB SS SS PP PP FF
5 | BB BB SS PP PP FF
6 | BBBBB SSSS PPPPP FFFF -- "Brad's Simple Portability Framework"
7 | BB BB SS PP FF
8 | BB BB SS SS PP FF
9 | BBBBB SSSS PP FF
10 |
11 | ===============================================================================
12 | License Information and Copyright Notice
13 | ===============================================================================
14 |
15 | Copyright (C) 1995-2002 Bradford W. Mott
16 |
17 | This program is free software; you can redistribute it and/or modify it under
18 | the terms of the GNU General Public License as published by the Free Software
19 | Foundation; either version 2 of the License, or any later version.
20 |
21 | You should have received a copy of the GNU General Public License version 2
22 | along with this program (License.txt); if not, write to the Free Software
23 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
24 |
25 | This program is distributed in the hope that it will be useful, but WITHOUT
26 | ANY WARRANTY. IN NO EVENT SHALL THE AUTHORS OR DISTRIBUTORS BE LIABLE TO ANY
27 | PARTY FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
28 | ARISING OUT OF THE USE OF THIS SOFTWARE, ITS DOCUMENTATION, OR ANY DERIVATIVES
29 | THEREOF, EVEN IF THE AUTHORS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH
30 | DAMAGE.
31 |
32 | THE AUTHORS AND DISTRIBUTORS SPECIFICALLY DISCLAIM ANY WARRANTIES, INCLUDING,
33 | BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
34 | PARTICULAR PURPOSE, AND NON-INFRINGEMENT. THIS SOFTWARE IS PROVIDED ON AN
35 | "AS IS" BASIS, AND THE AUTHORS AND DISTRIBUTORS HAVE NO OBLIGATION TO PROVIDE
36 | MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
37 |
38 |
--------------------------------------------------------------------------------
/atari_py/ale_interface/src/emucore/module.mk:
--------------------------------------------------------------------------------
1 | MODULE := src/emucore
2 |
3 | MODULE_OBJS := \
4 | src/emucore/AtariVox.o \
5 | src/emucore/Booster.o \
6 | src/emucore/Cart2K.o \
7 | src/emucore/Cart3F.o \
8 | src/emucore/Cart3E.o \
9 | src/emucore/Cart4A50.o \
10 | src/emucore/Cart4K.o \
11 | src/emucore/CartAR.o \
12 | src/emucore/CartCV.o \
13 | src/emucore/Cart.o \
14 | src/emucore/CartDPC.o \
15 | src/emucore/CartE0.o \
16 | src/emucore/CartE7.o \
17 | src/emucore/CartF4.o \
18 | src/emucore/CartF4SC.o \
19 | src/emucore/CartF6.o \
20 | src/emucore/CartF6SC.o \
21 | src/emucore/CartF8.o \
22 | src/emucore/CartF8SC.o \
23 | src/emucore/CartFASC.o \
24 | src/emucore/CartFE.o \
25 | src/emucore/CartMB.o \
26 | src/emucore/CartMC.o \
27 | src/emucore/CartUA.o \
28 | src/emucore/Cart0840.o \
29 | src/emucore/Console.o \
30 | src/emucore/Control.o \
31 | src/emucore/Deserializer.o \
32 | src/emucore/Driving.o \
33 | src/emucore/Event.o \
34 | src/emucore/FSNode.o \
35 | src/emucore/Joystick.o \
36 | src/emucore/Keyboard.o \
37 | src/emucore/M6532.o \
38 | src/emucore/MD5.o \
39 | src/emucore/MediaSrc.o \
40 | src/emucore/OSystem.o \
41 | src/emucore/Paddles.o \
42 | src/emucore/Props.o \
43 | src/emucore/PropsSet.o \
44 | src/emucore/Random.o \
45 | src/emucore/Serializer.o \
46 | src/emucore/Settings.o \
47 | src/emucore/SpeakJet.o \
48 | src/emucore/Switches.o \
49 | src/emucore/TIA.o \
50 | src/emucore/TIASnd.o \
51 | src/emucore/unzip.o \
52 |
53 | MODULE_DIRS += \
54 | src/emucore
55 |
56 | # Include common rules
57 | include $(srcdir)/common.rules
58 |
--------------------------------------------------------------------------------
/atari_py/ale_interface/src/emucore/rsynth/PORTING:
--------------------------------------------------------------------------------
1 | Hopefully most of unix/compiler variant issues should be handled by configure
2 | process. Thus porting issues should reduce (for UNIX-ish machines at least)
3 | to writing the audio driver.
4 |
5 | The interface to the driver is defined in hplay.h.
6 | There are three routines:
7 |
8 | extern int audio_init PROTO((int argc, char *argv[]));
9 |
10 | Do what ever is necessary to initialize audio.
11 | You can process any command line arguments to influence the
12 | behaviour. Use getargs() function to make this easy.
13 | Where it make sense copy options from other drivers e.g. -r for
14 | sample rate.
15 |
16 | This routine should also define the global variable samp_rate
17 | to define sample rate to the core synth.
18 |
19 | Sample rates in 8 - 12kHz range work best due to as yet unresolved
20 | problems with some of the digital filters.
21 |
22 | extern void audio_play PROTO((int n, short *data));
23 |
24 | Send a block of 'n' 16 bit signed linear samples to the
25 | audio device. If your device requires uLaw samples (US telephone standard)
26 | then l2u.h defines routines which may help (example is Sun driver).
27 |
28 | extern void audio_term PROTO((void));
29 | Close down audio device, probably waiting for buffer(s) to empty.
30 |
31 | To test your driver (which should be called xxxxplay.c where xxxx describes
32 | the system/hardware), link it to hplay.c, and "make".
33 |
34 | The brave/experienced might like to obtain and install GNU autoconf-2.0 (or
35 | latter?) and the GNU m4 it needs (m4-1.3 or latter), and try and get the new
36 | driver auto configured.
37 |
38 | When you have written your driver please contact me (nick@ing-simmons.net)
39 | if you are willing to let others use it. Please let me know the output of
40 | config.guess script to assist in merging into autoconf.
41 |
42 | ------------------------------------------------------------------------
43 |
44 | Perfomance issues.
45 |
46 | For best speed in DSP is done in "float",
47 | but with strict IEEE-754 compliance turned off where possible.
48 | This is fastest because in general for modern RISC processors
49 | (e.g. SPARCs or at least some of them ...)
50 |
51 | - There is no integer multiply hardware
52 | - There IS floating point multiply hardware
53 | - Floating point multiply hardware cannot handle "double" in one pass.
54 | - Some of IEEE-754 options (e.g. denormals) are handled via software traps.
55 |
56 | Modern x86 (Athlon/P4 do okay with float as well.)
57 |
58 | The computations in opsynth.c should dominate the cpu requirements
59 | of the other levels.
60 |
61 |
62 |
--------------------------------------------------------------------------------
/atari_py/ale_interface/src/emucore/rsynth/elements.c:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (c) 1994,2001-2003 Nick Ing-Simmons. All rights reserved.
3 |
4 | This library is free software; you can redistribute it and/or
5 | modify it under the terms of the GNU Library General Public
6 | License as published by the Free Software Foundation; either
7 | version 2 of the License, or (at your option) any later version.
8 |
9 | This library is distributed in the hope that it will be useful,
10 | but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 | Library General Public License for more details.
13 |
14 | You should have received a copy of the GNU Library General Public
15 | License along with this library; if not, write to the Free
16 | Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
17 | MA 02111-1307, USA
18 |
19 | */
20 | #include
21 | /* $Id: elements.c,v 1.1 2006/06/11 07:13:24 urchlay Exp $
22 | */
23 | char *elements_id = "$Id: elements.c,v 1.1 2006/06/11 07:13:24 urchlay Exp $";
24 | #include
25 | #include
26 | #include "rsynth.h"
27 | #include "phfeat.h"
28 |
29 |
30 | Elm_t Elements[] = {
31 | #include "Elements.def"
32 | };
33 |
34 | unsigned num_Elements = (sizeof(Elements) / sizeof(Elm_t));
35 |
36 | char *Ep_name[nEparm] = {
37 | "fn", "f1", "f2", "f3",
38 | "b1", "b2", "b3", "pn",
39 | "a2", "a3", "a4",
40 | "a5", "a6", "ab", "av",
41 | "avc", "asp", "af"
42 | };
43 |
44 | speaker_t *
45 | rsynth_speaker(float F0Hz, float gain, Elm_t * e)
46 | {
47 | static speaker_t pars;
48 | // memset(&pars,-1,sizeof(pars));
49 | pars.F0Hz = F0Hz;
50 |
51 | /* Quasi fixed parameters */
52 | pars.Gain0 = gain;
53 | pars.F4hz = 3900;
54 | pars.B4hz = 400;
55 | pars.F5hz = 4700;
56 | pars.B5hz = 150;
57 | pars.F6hz = 4900;
58 | pars.B6hz = 150;
59 |
60 | pars.B4phz = 500;
61 | pars.B5phz = 600;
62 | pars.B6phz = 800;
63 |
64 | pars.BNhz = 500;
65 |
66 | /* Set the _fixed_ nasal pole to nasal zero frequency of the 0th element
67 | (which should NOT be a nasal!) as a typical example of the zero
68 | we wish to cancel
69 |
70 | */
71 | pars.FNPhz = (long) e->p[fn].stdy;
72 | return &pars;
73 | }
74 |
--------------------------------------------------------------------------------
/atari_py/ale_interface/src/emucore/rsynth/kmap:
--------------------------------------------------------------------------------
1 | # Klatt symbol mappings to CMU's and our SAMPA via dlookup of example word(s) shown.
2 | #
3 |
4 | # Vowels
5 | AA bob AA1 [A]
6 | AX about AX [@]
7 | EXR bear A [e@R]
8 | IY beet IY [i]
9 | UW boot UW [u]
10 | AE bat AE [{]
11 | AXR bar AA [A]
12 | EY bait EY [eI]
13 | OW boat OW [@U]
14 | UXR poor UA [U@R]
15 | AH but AH [V]
16 | AY bite AY [aI]
17 | IH bit IH [I]
18 | OXR boar AO [OR]
19 | YU beauty Y UW1 [ju]
20 | AO bought AO [O]
21 | EH bet EH [e]
22 | IX impunity IH [I]
23 | OY boy AO IY [Oi]
24 | AW bout AW [aU]
25 | ER bird ER [3`]
26 | IXR beer IA [I@R]
27 | UH book UH [U]
28 | # Sonorants
29 | RR rent R [r]
30 | RX fire AX [@`] # Rhotic
31 | HH hat HH [h]
32 | HX hurrah HH [h] # Allophone ?
33 | WW wet W [w]
34 | WH which W [W] # [hw] sound ?
35 | LL let L [l] # Allophone before vowel
36 | LX bill L [5] # Allophone after vowel
37 | EL bottle L [l=] # Syllabic l
38 | YY yet Y [j]
39 | # Nasals
40 | EM 'em M [m=] # syllabic m
41 | EN button N [n=] # syllabic n
42 | MM met M [m]
43 | NN net N [n]
44 | NG sing NG [N]
45 | # Fricatives
46 | DH that DH [D]
47 | VV vat V [v]
48 | FF fin F [f]
49 | ZZ zoo Z [z]
50 | SS sat S [s]
51 | ZH azure ZH [Z]
52 | SH shin SH [S]
53 | TH thin TH [T]
54 | # Plosives
55 | BB bet B [b]
56 | KK core K [k] # allophone before back vowel?
57 | KP keen K [k] # allophone before front vowel?
58 | GG gore G [g] # allophone before back vowel?
59 | GP give G [g] # allophone before front vowel?
60 | DD debt D [d]
61 | PP pet P [p]
62 | TT ten T [t] #
63 | DX butter T [4] # allophone beween vowels
64 | TQ at Alan T [t] # allophone before stressed vowel?
65 | # Affricates
66 | CH chin CH [tS]
67 | JJ gin G [g]
68 | # Plosive release
69 | AXP ship P [p] # artifact of terminal plosive?
70 |
71 |
72 |
--------------------------------------------------------------------------------
/atari_py/ale_interface/src/emucore/rsynth/module.mk:
--------------------------------------------------------------------------------
1 | MODULE := src/emucore/rsynth
2 |
3 | MODULE_OBJS := \
4 | src/emucore/rsynth/darray.o \
5 | src/emucore/rsynth/elements.o \
6 | src/emucore/rsynth/holmes.o \
7 | src/emucore/rsynth/opsynth.o \
8 | src/emucore/rsynth/phones.o \
9 | src/emucore/rsynth/phtoelm.o \
10 | src/emucore/rsynth/trie.o
11 |
12 | MODULE_DIRS += \
13 | src/emucore/rsynth
14 |
15 | # Include common rules
16 | include $(srcdir)/common.rules
17 |
--------------------------------------------------------------------------------
/atari_py/ale_interface/src/emucore/rsynth/phfeat.h:
--------------------------------------------------------------------------------
1 | #ifndef __PHFEAT_H
2 | #define __PHFEAT_H
3 |
4 | #define unr 0x00000000
5 | #define rnd 0x00000001
6 | #define low 0x00000002
7 | #define lmd 0x00000004
8 | #define mdl 0x00000008
9 | #define smh 0x00000010
10 | #define lax 0x00000020
11 | #define hgh 0x00000040
12 | #define bck 0x00000080
13 | #define cnt 0x00000100
14 | #define fnt 0x00000200
15 | #define vwl 0x00000400
16 | #define dip 0x00000800
17 | #define blb 0x00001000
18 | #define stl 0x00002000
19 | #define vls 0x00004000
20 | #define stp 0x00008000
21 | #define vcd 0x00010000
22 | #define alv 0x00020000
23 | #define vel 0x00040000
24 | #define glt 0x00080000
25 | #define nas 0x00100000
26 | #define tap 0x00200000
27 | #define apr 0x00400000
28 | #define rzd 0x00800000
29 | #define frc 0x01000000
30 | #define lbd 0x02000000
31 | #define dnt 0x04000000
32 | #define pla 0x08000000
33 | #define lat 0x10000000
34 | #define gld 0x20000000
35 | #define lbv 0x40000000
36 | #define pal 0x80000000
37 |
38 | #endif
39 |
--------------------------------------------------------------------------------
/atari_py/ale_interface/src/emucore/rsynth/phones.c:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (c) 1994,2001-2002 Nick Ing-Simmons. All rights reserved.
3 |
4 | This library is free software; you can redistribute it and/or
5 | modify it under the terms of the GNU Library General Public
6 | License as published by the Free Software Foundation; either
7 | version 2 of the License, or (at your option) any later version.
8 |
9 | This library is distributed in the hope that it will be useful,
10 | but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 | Library General Public License for more details.
13 |
14 | You should have received a copy of the GNU Library General Public
15 | License along with this library; if not, write to the Free
16 | Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
17 | MA 02111-1307, USA
18 |
19 | */
20 | #include
21 | #include
22 | #include "phones.h"
23 |
24 | #if 0
25 | #ifdef __STDC__
26 | #define PHONE(nm,br,am,ex) #nm,
27 | #else
28 | #define PHONE(nm,br,am,ex) "nm",
29 | #endif
30 | #endif
31 |
32 | #define PHONE(nm,st,br,am,ex) st
33 |
34 | char *ph_name[] =
35 | {" ",
36 | #include "phones.def"
37 | NULL};
38 | #undef PHONE
39 |
40 | #define PHONE(nm,st,br,am,ex) br
41 | char *ph_br[] =
42 | {" ",
43 | #include "phones.def"
44 | NULL};
45 | #undef PHONE
46 |
47 | #define PHONE(nm,st,br,am,ex) am
48 | char *ph_am[] =
49 | {" ",
50 | #include "phones.def"
51 | NULL};
52 | #undef PHONE
53 |
--------------------------------------------------------------------------------
/atari_py/ale_interface/src/emucore/rsynth/phones.h:
--------------------------------------------------------------------------------
1 | #ifndef __PHONES_H
2 | #define __PHONES_H
3 |
4 | #ifdef __cplusplus
5 | extern "C" {
6 | #endif
7 |
8 | #define PHONE(nm,st,br,am,ex) nm
9 | enum phone_e { SIL,
10 | #include "phones.def"
11 | END };
12 | #undef PHONE
13 | extern char *ph_name[];
14 | extern char *ph_br[];
15 | extern char *ph_am[];
16 |
17 | #ifdef __cplusplus
18 | }
19 | #endif
20 |
21 | #endif
22 |
--------------------------------------------------------------------------------
/atari_py/ale_interface/src/emucore/rsynth/phtoelm.h:
--------------------------------------------------------------------------------
1 | /* $Id: phtoelm.h,v 1.2 2006/06/11 21:49:09 stephena Exp $
2 | */
3 | #ifndef __PHTOELM_H
4 | #define __PHTOELM_H
5 |
6 | #ifdef __cplusplus
7 | extern "C" {
8 | #endif
9 |
10 | struct rsynth_s;
11 | extern unsigned phone_to_elm (char *s, int n, darray_ptr elm, darray_ptr f0);
12 | extern void say_pho(struct rsynth_s *rsynth, const char *path, int dodur,char *phoneset);
13 |
14 | #ifdef __cplusplus
15 | }
16 | #endif
17 |
18 | #endif
19 |
--------------------------------------------------------------------------------
/atari_py/ale_interface/src/emucore/rsynth/trie.c:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (c) 1994,2001-2002 Nick Ing-Simmons. All rights reserved.
3 |
4 | This library is free software; you can redistribute it and/or
5 | modify it under the terms of the GNU Library General Public
6 | License as published by the Free Software Foundation; either
7 | version 2 of the License, or (at your option) any later version.
8 |
9 | This library is distributed in the hope that it will be useful,
10 | but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 | Library General Public License for more details.
13 |
14 | You should have received a copy of the GNU Library General Public
15 | License along with this library; if not, write to the Free
16 | Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
17 | MA 02111-1307, USA
18 |
19 | */
20 |
21 | #include "config.h"
22 | /* $Id: trie.c,v 1.1 2006/06/11 07:13:27 urchlay Exp $
23 | */
24 | char *trie_id = "$Id: trie.c,v 1.1 2006/06/11 07:13:27 urchlay Exp $";
25 | #include "useconfig.h"
26 | #include
27 | #include "trie.h"
28 |
29 | struct trie_s {
30 | struct trie_s *otherwise;
31 | struct trie_s *more;
32 | void *value;
33 | char ch;
34 | };
35 |
36 | void
37 | trie_free(trie_ptr * r, void (*func) (void *))
38 | {
39 | trie_ptr p;
40 | while ((p = *r)) {
41 | trie_free(&p->more, func);
42 | *r = p->otherwise;
43 | if (func)
44 | (*func) (p->value);
45 | free(p);
46 | }
47 | }
48 |
49 | void
50 | trie_insert(trie_ptr * r, char *s, void *value)
51 | {
52 | trie_ptr p = NULL;
53 | char ch;
54 | while ((ch = *s++)) {
55 | while ((p = *r)) {
56 | if (p->ch == ch)
57 | break;
58 | else
59 | r = &p->otherwise;
60 | }
61 | if (!p) {
62 | p = (trie_ptr) malloc(sizeof(*p));
63 | memset(p, 0, sizeof(*p));
64 | p->ch = ch;
65 | *r = p;
66 | }
67 | r = &p->more;
68 | }
69 | p->value = value;
70 | }
71 |
72 | void *
73 | trie_lookup(trie_ptr * r, char **sp)
74 | {
75 | char *s = *sp;
76 | char *value = NULL;
77 | char ch;
78 | while ((ch = *s)) {
79 | trie_ptr *l = r;
80 | trie_ptr p;
81 | while ((p = *l)) {
82 | if (p->ch == ch)
83 | break;
84 | else
85 | l = &p->otherwise;
86 | }
87 | if (p) {
88 | *l = p->otherwise;
89 | p->otherwise = *r;
90 | *r = p;
91 | r = &p->more;
92 | value = (char *) p->value;
93 | s++;
94 | }
95 | else
96 | break;
97 | }
98 | *sp = s;
99 | return value;
100 | }
101 |
--------------------------------------------------------------------------------
/atari_py/ale_interface/src/emucore/rsynth/trie.h:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (c) 1994,2001-2003 Nick Ing-Simmons. All rights reserved.
3 |
4 | This library is free software; you can redistribute it and/or
5 | modify it under the terms of the GNU Library General Public
6 | License as published by the Free Software Foundation; either
7 | version 2 of the License, or (at your option) any later version.
8 |
9 | This library is distributed in the hope that it will be useful,
10 | but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 | Library General Public License for more details.
13 |
14 | You should have received a copy of the GNU Library General Public
15 | License along with this library; if not, write to the Free
16 | Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
17 | MA 02111-1307, USA
18 |
19 | */
20 | /* $Id: trie.h,v 1.1 2006/06/11 07:13:27 urchlay Exp $
21 | */
22 | #ifndef TRIE_H
23 | #define TRIE_H
24 |
25 | #ifdef __cplusplus
26 | extern "C" {
27 | #endif
28 |
29 | typedef struct trie_s *trie_ptr;
30 |
31 | extern void trie_insert(trie_ptr *r,char *s,void *value);
32 | extern void *trie_lookup(trie_ptr *r,char **sp);
33 | extern void trie_free(trie_ptr *r,void (*func)(void *));
34 |
35 | #ifdef __cplusplus
36 | }
37 | #endif
38 |
39 |
40 | #endif /* TRIE_H */
41 |
--------------------------------------------------------------------------------
/atari_py/ale_interface/src/emucore/rsynth/useconfig.h:
--------------------------------------------------------------------------------
1 | #ifdef HAVE_SYS_TYPES_H
2 | #include
3 | #endif
4 |
5 | #if STDC_HEADERS
6 | #include
7 | #include
8 | #include
9 | #else
10 | #ifndef HAVE_STRCHR
11 | #define strchr index
12 | #define strrchr rindex
13 | #endif
14 | char *strchr (), *strrchr ();
15 | #ifndef HAVE_MEMCPY
16 | #define memcpy(d, s, n) bcopy ((s), (d), (n))
17 | #endif
18 | #ifdef HAVE_MALLOC_H
19 | #include
20 | #endif
21 | #endif /* STDC_HEADERS */
22 |
23 | #if HAVE_UNISTD_H
24 | #include
25 | #endif
26 |
27 | #if HAVE_LIBC_H
28 | /* From NeXT stuff */
29 | #include
30 | #endif
31 |
32 |
--------------------------------------------------------------------------------
/atari_py/ale_interface/src/environment/ale_ram.hpp:
--------------------------------------------------------------------------------
1 | /* *****************************************************************************
2 | * A.L.E (Arcade Learning Environment)
3 | * Copyright (c) 2009-2013 by Yavar Naddaf, Joel Veness, Marc G. Bellemare and
4 | * the Reinforcement Learning and Artificial Intelligence Laboratory
5 | * Released under the GNU General Public License; see License.txt for details.
6 | *
7 | * Based on: Stella -- "An Atari 2600 VCS Emulator"
8 | * Copyright (c) 1995-2007 by Bradford W. Mott and the Stella team
9 | *
10 | * *****************************************************************************
11 | * ale_ram.hpp
12 | *
13 | * A class that encapsulates the Atari 2600 RAM. Code is provided inline for
14 | * efficiency reasonss.
15 | *
16 | **************************************************************************** */
17 |
18 | #ifndef __ALE_RAM_HPP__
19 | #define __ALE_RAM_HPP__
20 |
21 | #include
22 |
23 | typedef unsigned char byte_t;
24 |
25 | #define RAM_SIZE (128)
26 |
27 | /** A simple wrapper around the Atari RAM. */
28 | class ALERAM {
29 | public:
30 | ALERAM();
31 | ALERAM(const ALERAM &rhs);
32 |
33 | ALERAM& operator=(const ALERAM &rhs);
34 |
35 | /** Byte accessors */
36 | byte_t get(unsigned int x) const;
37 | byte_t *byte(unsigned int x);
38 |
39 | /** Returns the whole array (equivalent to byte(0)). */
40 | byte_t *array() const { return (byte_t*)(m_ram); }
41 |
42 | size_t size() const { return sizeof(m_ram); }
43 | /** Returns whether two copies of the RAM are equal */
44 | bool equals(const ALERAM &rhs) const;
45 |
46 | protected:
47 | byte_t m_ram[RAM_SIZE];
48 | };
49 |
50 | inline ALERAM::ALERAM() {
51 | }
52 |
53 | inline ALERAM::ALERAM(const ALERAM &rhs) {
54 | // Copy data over
55 | memcpy(m_ram, rhs.m_ram, sizeof(m_ram));
56 | }
57 |
58 | inline ALERAM& ALERAM::operator=(const ALERAM &rhs) {
59 | // Copy data over
60 | memcpy(m_ram, rhs.m_ram, sizeof(m_ram));
61 |
62 | return *this;
63 | }
64 |
65 | inline bool ALERAM::equals(const ALERAM &rhs) const {
66 | return (memcmp(m_ram, rhs.m_ram, size()) == 0);
67 | }
68 |
69 | // Byte accessors
70 | inline byte_t ALERAM::get(unsigned int x) const {
71 | // Wrap RAM around the first 128 bytes
72 | return m_ram[x & 0x7F];
73 | }
74 |
75 | inline byte_t* ALERAM::byte(unsigned int x) {
76 | return &m_ram[x & 0x7F];
77 | }
78 |
79 | #endif // __ALE_RAM_HPP__
80 |
81 |
--------------------------------------------------------------------------------
/atari_py/ale_interface/src/environment/module.mk:
--------------------------------------------------------------------------------
1 | MODULE := src/environment
2 |
3 | MODULE_OBJS := \
4 | src/environment/ale_state.o \
5 | src/environment/stella_environment.o \
6 | src/environment/phosphor_blend.o \
7 |
8 | MODULE_DIRS += \
9 | src/environment
10 |
11 | # Include common rules
12 | include $(srcdir)/common.rules
13 |
--------------------------------------------------------------------------------
/atari_py/ale_interface/src/environment/phosphor_blend.hpp:
--------------------------------------------------------------------------------
1 | /* *****************************************************************************
2 | * A.L.E (Arcade Learning Environment)
3 | * Copyright (c) 2009-2013 by Yavar Naddaf, Joel Veness, Marc G. Bellemare and
4 | * the Reinforcement Learning and Artificial Intelligence Laboratory
5 | * Released under the GNU General Public License; see License.txt for details.
6 | *
7 | * Based on: Stella -- "An Atari 2600 VCS Emulator"
8 | * Copyright (c) 1995-2007 by Bradford W. Mott and the Stella team
9 | *
10 | * *****************************************************************************
11 | * phosphor_blend.hpp
12 | *
13 | * Methods for performing colour averaging over the screen.
14 | *
15 | **************************************************************************** */
16 |
17 | #ifndef __PHOSPHOR_BLEND_HPP__
18 | #define __PHOSPHOR_BLEND_HPP__
19 |
20 | #include "../emucore/OSystem.hxx"
21 | #include "ale_screen.hpp"
22 |
23 | class PhosphorBlend {
24 | public:
25 | PhosphorBlend(OSystem *);
26 |
27 | void process(ALEScreen& screen);
28 |
29 | private:
30 | void makeAveragePalette();
31 | uInt8 getPhosphor(uInt8 v1, uInt8 v2);
32 | uInt32 makeRGB(uInt8 r, uInt8 g, uInt8 b);
33 | /** Converts a RGB value to an 8-bit format */
34 | uInt8 rgbToNTSC(uInt32 rgb);
35 |
36 | private:
37 | OSystem * m_osystem;
38 |
39 | uInt8 m_rgb_ntsc[64][64][64];
40 |
41 | uInt32 m_avg_palette[256][256];
42 | uInt8 m_phosphor_blend_ratio;
43 | };
44 |
45 | #endif // __PHOSPHOR_BLEND_HPP__
46 |
47 |
--------------------------------------------------------------------------------
/atari_py/ale_interface/src/external/TinyMT/LICENSE.txt:
--------------------------------------------------------------------------------
1 | Copyright (c) 2011 Mutsuo Saito, Makoto Matsumoto, Hiroshima
2 | University and The University of Tokyo. All rights reserved.
3 |
4 | Redistribution and use in source and binary forms, with or without
5 | modification, are permitted provided that the following conditions are
6 | met:
7 |
8 | * Redistributions of source code must retain the above copyright
9 | notice, this list of conditions and the following disclaimer.
10 | * Redistributions in binary form must reproduce the above
11 | copyright notice, this list of conditions and the following
12 | disclaimer in the documentation and/or other materials provided
13 | with the distribution.
14 | * Neither the name of the Hiroshima University nor the names of
15 | its contributors may be used to endorse or promote products
16 | derived from this software without specific prior written
17 | permission.
18 |
19 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
20 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
21 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
22 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
23 | OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
24 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
25 | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
27 | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30 |
--------------------------------------------------------------------------------
/atari_py/ale_interface/src/external/module.mk:
--------------------------------------------------------------------------------
1 | MODULE := src/external
2 |
3 | MODULE_OBJS := \
4 | src/external/TinyMT/tinymt32.o \
5 |
6 | MODULE_DIRS += \
7 | src/external/TinyMT
8 |
9 | # Include common rules
10 | include $(srcdir)/common.rules
11 |
--------------------------------------------------------------------------------
/atari_py/ale_interface/src/games/RomSettings.cpp:
--------------------------------------------------------------------------------
1 | /* *****************************************************************************
2 | * A.L.E (Arcade Learning Environment)
3 | * Copyright (c) 2009-2013 by Yavar Naddaf, Joel Veness, Marc G. Bellemare and
4 | * the Reinforcement Learning and Artificial Intelligence Laboratory
5 | * Released under the GNU General Public License; see License.txt for details.
6 | *
7 | * Based on: Stella -- "An Atari 2600 VCS Emulator"
8 | * Copyright (c) 1995-2007 by Bradford W. Mott and the Stella team
9 | *
10 | * *****************************************************************************
11 | *
12 | * RomSettings.cpp
13 | *
14 | * The interface to describe games as RL environments. It provides terminal and
15 | * reward information.
16 | * *****************************************************************************
17 | */
18 | #include "RomSettings.hpp"
19 |
20 | bool RomSettings::isLegal(const Action& a) const {
21 | return true;
22 | }
23 |
24 | ActionVect RomSettings::getMinimalActionSet() {
25 | ActionVect actions;
26 | for (int a = 0; a < PLAYER_B_NOOP; a++) {
27 | if (isMinimal((Action)a) && isLegal((Action)a)) {
28 | actions.push_back((Action)a);
29 | }
30 | }
31 | return actions;
32 | }
33 |
34 | ActionVect RomSettings::getAllActions() {
35 | ActionVect actions;
36 | for (int a = 0; a < PLAYER_B_NOOP; a++) {
37 | if (isLegal((Action)a)) {
38 | actions.push_back((Action)a);
39 | }
40 | }
41 | return actions;
42 | }
43 |
44 | ActionVect RomSettings::getStartingActions() {
45 | return ActionVect();
46 | }
47 |
--------------------------------------------------------------------------------
/atari_py/ale_interface/src/games/RomUtils.hpp:
--------------------------------------------------------------------------------
1 | /* *****************************************************************************
2 | * A.L.E (Arcade Learning Environment)
3 | * Copyright (c) 2009-2013 by Yavar Naddaf, Joel Veness, Marc G. Bellemare and
4 | * the Reinforcement Learning and Artificial Intelligence Laboratory
5 | * Released under the GNU General Public License; see License.txt for details.
6 | *
7 | * Based on: Stella -- "An Atari 2600 VCS Emulator"
8 | * Copyright (c) 1995-2007 by Bradford W. Mott and the Stella team
9 | *
10 | * *****************************************************************************
11 | *
12 | * RomUtils.hpp
13 | *
14 | * Additional utilities to operate on RAM.
15 | * *****************************************************************************
16 | */
17 | #ifndef __ROMUTILS_HPP__
18 | #define __ROMUTILS_HPP__
19 |
20 | class System;
21 |
22 | // reads a byte at a memory location between 0 and 1023
23 | extern int readRam(const System* system, int offset);
24 |
25 | // extracts a decimal value from 1, 2, and 3 bytes respectively
26 | extern int getDecimalScore(int idx, const System* system);
27 | extern int getDecimalScore(int lo, int hi, const System* system);
28 | extern int getDecimalScore(int lo, int mid, int hi, const System* system);
29 |
30 | #endif // __ROMUTILS_HPP__
31 |
32 |
33 |
34 |
--------------------------------------------------------------------------------
/atari_py/ale_interface/src/games/Roms.hpp:
--------------------------------------------------------------------------------
1 | /* *****************************************************************************
2 | * A.L.E (Arcade Learning Environment)
3 | * Copyright (c) 2009-2013 by Yavar Naddaf, Joel Veness, Marc G. Bellemare and
4 | * the Reinforcement Learning and Artificial Intelligence Laboratory
5 | * Released under the GNU General Public License; see License.txt for details.
6 | *
7 | * Based on: Stella -- "An Atari 2600 VCS Emulator"
8 | * Copyright (c) 1995-2007 by Bradford W. Mott and the Stella team
9 | *
10 | * *****************************************************************************
11 | */
12 | #ifndef __ROMS_HPP__
13 | #define __ROMS_HPP__
14 |
15 | #include
16 |
17 | struct RomSettings;
18 |
19 |
20 | // looks for the RL wrapper corresponding to a particular rom title
21 | extern RomSettings *buildRomRLWrapper(const std::string &rom);
22 |
23 |
24 | #endif // __ROMS_HPP__
25 |
26 |
--------------------------------------------------------------------------------
/atari_py/ale_interface/src/games/module.mk:
--------------------------------------------------------------------------------
1 | MODULE := src/games
2 |
3 | MODULE_OBJS := \
4 | src/games/Roms.o \
5 | src/games/RomSettings.o \
6 | src/games/RomUtils.o \
7 | src/games/supported/AirRaid.o \
8 | src/games/supported/Alien.o \
9 | src/games/supported/Amidar.o \
10 | src/games/supported/Assault.o \
11 | src/games/supported/Asterix.o \
12 | src/games/supported/Asteroids.o \
13 | src/games/supported/Atlantis.o \
14 | src/games/supported/BankHeist.o \
15 | src/games/supported/BattleZone.o \
16 | src/games/supported/BeamRider.o \
17 | src/games/supported/Berzerk.o \
18 | src/games/supported/Bowling.o \
19 | src/games/supported/Boxing.o \
20 | src/games/supported/Breakout.o \
21 | src/games/supported/Carnival.o \
22 | src/games/supported/Centipede.o \
23 | src/games/supported/ChopperCommand.o \
24 | src/games/supported/CrazyClimber.o \
25 | src/games/supported/Defender.o \
26 | src/games/supported/DemonAttack.o \
27 | src/games/supported/DoubleDunk.o \
28 | src/games/supported/ElevatorAction.o \
29 | src/games/supported/Enduro.o \
30 | src/games/supported/FishingDerby.o \
31 | src/games/supported/Freeway.o \
32 | src/games/supported/Frostbite.o \
33 | src/games/supported/Gopher.o \
34 | src/games/supported/Gravitar.o \
35 | src/games/supported/Hero.o \
36 | src/games/supported/IceHockey.o \
37 | src/games/supported/JamesBond.o \
38 | src/games/supported/JourneyEscape.o \
39 | src/games/supported/Kangaroo.o \
40 | src/games/supported/Krull.o \
41 | src/games/supported/KungFuMaster.o \
42 | src/games/supported/MontezumaRevenge.o \
43 | src/games/supported/MsPacman.o \
44 | src/games/supported/NameThisGame.o \
45 | src/games/supported/Phoenix.o \
46 | src/games/supported/Pitfall.o \
47 | src/games/supported/Pong.o \
48 | src/games/supported/Pooyan.o \
49 | src/games/supported/PrivateEye.o \
50 | src/games/supported/QBert.o \
51 | src/games/supported/RiverRaid.o \
52 | src/games/supported/RoadRunner.o \
53 | src/games/supported/RoboTank.o \
54 | src/games/supported/Seaquest.o \
55 | src/games/supported/Skiing.o \
56 | src/games/supported/Solaris.o \
57 | src/games/supported/SpaceInvaders.o \
58 | src/games/supported/StarGunner.o \
59 | src/games/supported/Tennis.o \
60 | src/games/supported/TimePilot.o \
61 | src/games/supported/Tutankham.o \
62 | src/games/supported/UpNDown.o \
63 | src/games/supported/Venture.o \
64 | src/games/supported/VideoPinball.o \
65 | src/games/supported/WizardOfWor.o \
66 | src/games/supported/YarsRevenge.o \
67 | src/games/supported/Zaxxon.o \
68 |
69 | MODULE_DIRS += \
70 | src/games
71 |
72 | # Include common rules
73 | include $(srcdir)/common.rules
74 |
--------------------------------------------------------------------------------
/atari_py/ale_interface/src/games/supported/AirRaid.hpp:
--------------------------------------------------------------------------------
1 | /* *****************************************************************************
2 | * A.L.E (Arcade Learning Environment)
3 | * Copyright (c) 2009-2013 by Yavar Naddaf, Joel Veness, Marc G. Bellemare and
4 | * the Reinforcement Learning and Artificial Intelligence Laboratory
5 | * Released under the GNU General Public License; see License.txt for details.
6 | *
7 | * Based on: Stella -- "An Atari 2600 VCS Emulator"
8 | * Copyright (c) 1995-2007 by Bradford W. Mott and the Stella team
9 | *
10 | * *****************************************************************************
11 | */
12 | #ifndef __AIRRAID_HPP__
13 | #define __AIRRAID_HPP__
14 |
15 | #include "../RomSettings.hpp"
16 |
17 |
18 | /* RL wrapper for Air Raid settings */
19 | class AirRaidSettings : public RomSettings {
20 |
21 | public:
22 |
23 | AirRaidSettings();
24 |
25 | // reset
26 | void reset();
27 |
28 | // is end of game
29 | bool isTerminal() const;
30 |
31 | // get the most recently observed reward
32 | reward_t getReward() const;
33 |
34 | // the rom-name
35 | const char* rom() const { return "air_raid"; }
36 |
37 | // create a new instance of the rom
38 | RomSettings* clone() const;
39 |
40 | // is an action part of the minimal set?
41 | bool isMinimal(const Action& a) const;
42 |
43 | // process the latest information from ALE
44 | void step(const System& system);
45 |
46 | // saves the state of the rom settings
47 | void saveState(Serializer & ser);
48 |
49 | // loads the state of the rom settings
50 | void loadState(Deserializer & ser);
51 |
52 | ActionVect getStartingActions();
53 |
54 | private:
55 |
56 | bool m_terminal;
57 | reward_t m_reward;
58 | reward_t m_score;
59 | };
60 |
61 | #endif // __AIRRAID_HPP__
62 |
63 |
--------------------------------------------------------------------------------
/atari_py/ale_interface/src/games/supported/Bowling.cpp:
--------------------------------------------------------------------------------
1 | /* *****************************************************************************
2 | * A.L.E (Arcade Learning Environment)
3 | * Copyright (c) 2009-2013 by Yavar Naddaf, Joel Veness, Marc G. Bellemare and
4 | * the Reinforcement Learning and Artificial Intelligence Laboratory
5 | * Released under the GNU General Public License; see License.txt for details.
6 | *
7 | * Based on: Stella -- "An Atari 2600 VCS Emulator"
8 | * Copyright (c) 1995-2007 by Bradford W. Mott and the Stella team
9 | *
10 | * *****************************************************************************
11 | */
12 | #include "Bowling.hpp"
13 |
14 | #include "../RomUtils.hpp"
15 |
16 |
17 | BowlingSettings::BowlingSettings() {
18 |
19 | reset();
20 | }
21 |
22 |
23 | /* create a new instance of the rom */
24 | RomSettings* BowlingSettings::clone() const {
25 |
26 | RomSettings* rval = new BowlingSettings();
27 | *rval = *this;
28 | return rval;
29 | }
30 |
31 |
32 | /* process the latest information from ALE */
33 | void BowlingSettings::step(const System& system) {
34 |
35 | // update the reward
36 | reward_t score = getDecimalScore(0xA1, 0xA6, &system);
37 | m_reward = score - m_score;
38 | m_score = score;
39 |
40 | // update terminal status
41 | int round = readRam(&system, 0xA4);
42 | m_terminal = round > 0x10;
43 | }
44 |
45 |
46 | /* is end of game */
47 | bool BowlingSettings::isTerminal() const {
48 |
49 | return m_terminal;
50 | };
51 |
52 |
53 | /* get the most recently observed reward */
54 | reward_t BowlingSettings::getReward() const {
55 |
56 | return m_reward;
57 | }
58 |
59 |
60 | /* is an action part of the minimal set? */
61 | bool BowlingSettings::isMinimal(const Action &a) const {
62 |
63 | switch (a) {
64 | case PLAYER_A_NOOP:
65 | case PLAYER_A_FIRE:
66 | case PLAYER_A_UP:
67 | case PLAYER_A_DOWN:
68 | case PLAYER_A_UPFIRE:
69 | case PLAYER_A_DOWNFIRE:
70 | return true;
71 | default:
72 | return false;
73 | }
74 | }
75 |
76 |
77 | /* reset the state of the game */
78 | void BowlingSettings::reset() {
79 |
80 | m_reward = 0;
81 | m_score = 0;
82 | m_terminal = false;
83 | }
84 |
85 |
86 |
87 | /* saves the state of the rom settings */
88 | void BowlingSettings::saveState(Serializer & ser) {
89 | ser.putInt(m_reward);
90 | ser.putInt(m_score);
91 | ser.putBool(m_terminal);
92 | }
93 |
94 | // loads the state of the rom settings
95 | void BowlingSettings::loadState(Deserializer & ser) {
96 | m_reward = ser.getInt();
97 | m_score = ser.getInt();
98 | m_terminal = ser.getBool();
99 | }
100 |
101 |
--------------------------------------------------------------------------------
/atari_py/ale_interface/src/games/supported/Bowling.hpp:
--------------------------------------------------------------------------------
1 | /* *****************************************************************************
2 | * The line 67 is based on Xitari's code, from Google Inc.
3 | *
4 | * This program is free software; you can redistribute it and/or
5 | * modify it under the terms of the GNU General Public License version 2
6 | * as published by the Free Software Foundation.
7 | *
8 | * This program is distributed in the hope that it will be useful,
9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 | * GNU General Public License for more details.
12 | *
13 | * You should have received a copy of the GNU General Public License
14 | * along with this program; if not, write to the Free Software
15 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
16 | * *****************************************************************************
17 | * A.L.E (Arcade Learning Environment)
18 | * Copyright (c) 2009-2013 by Yavar Naddaf, Joel Veness, Marc G. Bellemare and
19 | * the Reinforcement Learning and Artificial Intelligence Laboratory
20 | * Released under the GNU General Public License; see License.txt for details.
21 | *
22 | * Based on: Stella -- "An Atari 2600 VCS Emulator"
23 | * Copyright (c) 1995-2007 by Bradford W. Mott and the Stella team
24 | *
25 | * *****************************************************************************
26 | */
27 | #ifndef __BOWLING_HPP__
28 | #define __BOWLING_HPP__
29 |
30 | #include "../RomSettings.hpp"
31 |
32 |
33 | /* RL wrapper for Bowling settings */
34 | class BowlingSettings : public RomSettings {
35 |
36 | public:
37 |
38 | BowlingSettings();
39 |
40 | // reset
41 | void reset();
42 |
43 | // is end of game
44 | bool isTerminal() const;
45 |
46 | // get the most recently observed reward
47 | reward_t getReward() const;
48 |
49 | // the rom-name
50 | const char* rom() const { return "bowling"; }
51 |
52 | // create a new instance of the rom
53 | RomSettings* clone() const;
54 |
55 | // is an action part of the minimal set?
56 | bool isMinimal(const Action& a) const;
57 |
58 | // process the latest information from ALE
59 | void step(const System& system);
60 |
61 | // saves the state of the rom settings
62 | void saveState(Serializer & ser);
63 |
64 | // loads the state of the rom settings
65 | void loadState(Deserializer & ser);
66 |
67 | // No lives in bowling!
68 | virtual const int lives() { return 0; }
69 |
70 | private:
71 |
72 | bool m_terminal;
73 | reward_t m_reward;
74 | reward_t m_score;
75 | };
76 |
77 | #endif // __BOWLING_HPP__
78 |
79 |
--------------------------------------------------------------------------------
/atari_py/ale_interface/src/games/supported/Boxing.hpp:
--------------------------------------------------------------------------------
1 | /* *****************************************************************************
2 | * The line 67 is based on Xitari's code, from Google Inc.
3 | *
4 | * This program is free software; you can redistribute it and/or
5 | * modify it under the terms of the GNU General Public License version 2
6 | * as published by the Free Software Foundation.
7 | *
8 | * This program is distributed in the hope that it will be useful,
9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 | * GNU General Public License for more details.
12 | *
13 | * You should have received a copy of the GNU General Public License
14 | * along with this program; if not, write to the Free Software
15 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
16 | * *****************************************************************************
17 | * A.L.E (Arcade Learning Environment)
18 | * Copyright (c) 2009-2013 by Yavar Naddaf, Joel Veness, Marc G. Bellemare and
19 | * the Reinforcement Learning and Artificial Intelligence Laboratory
20 | * Released under the GNU General Public License; see License.txt for details.
21 | *
22 | * Based on: Stella -- "An Atari 2600 VCS Emulator"
23 | * Copyright (c) 1995-2007 by Bradford W. Mott and the Stella team
24 | *
25 | * *****************************************************************************
26 | */
27 | #ifndef __BOXING_HPP__
28 | #define __BOXING_HPP__
29 |
30 | #include "../RomSettings.hpp"
31 |
32 |
33 | /* RL wrapper for Boxing settings */
34 | class BoxingSettings : public RomSettings {
35 |
36 | public:
37 |
38 | BoxingSettings();
39 |
40 | // reset
41 | void reset();
42 |
43 | // is end of game
44 | bool isTerminal() const;
45 |
46 | // get the most recently observed reward
47 | reward_t getReward() const;
48 |
49 | // the rom-name
50 | const char* rom() const { return "boxing"; }
51 |
52 | // create a new instance of the rom
53 | RomSettings* clone() const;
54 |
55 | // is an action part of the minimal set?
56 | bool isMinimal(const Action& a) const;
57 |
58 | // process the latest information from ALE
59 | void step(const System& system);
60 |
61 | // saves the state of the rom settings
62 | void saveState(Serializer & ser);
63 |
64 | // loads the state of the rom settings
65 | void loadState(Deserializer & ser);
66 |
67 | virtual const int lives() { return 0; }
68 |
69 | private:
70 |
71 | bool m_terminal;
72 | reward_t m_reward;
73 | reward_t m_score;
74 | };
75 |
76 | #endif // __BOXING_HPP__
77 |
78 |
--------------------------------------------------------------------------------
/atari_py/ale_interface/src/games/supported/Carnival.cpp:
--------------------------------------------------------------------------------
1 | /* *****************************************************************************
2 | * A.L.E (Arcade Learning Environment)
3 | * Copyright (c) 2009-2013 by Yavar Naddaf, Joel Veness, Marc G. Bellemare and
4 | * the Reinforcement Learning and Artificial Intelligence Laboratory
5 | * Released under the GNU General Public License; see License.txt for details.
6 | *
7 | * Based on: Stella -- "An Atari 2600 VCS Emulator"
8 | * Copyright (c) 1995-2007 by Bradford W. Mott and the Stella team
9 | *
10 | * *****************************************************************************
11 | */
12 | #include "Carnival.hpp"
13 |
14 | #include "../RomUtils.hpp"
15 |
16 |
17 | CarnivalSettings::CarnivalSettings() {
18 |
19 | reset();
20 | }
21 |
22 |
23 | /* create a new instance of the rom */
24 | RomSettings* CarnivalSettings::clone() const {
25 |
26 | RomSettings* rval = new CarnivalSettings();
27 | *rval = *this;
28 | return rval;
29 | }
30 |
31 |
32 | /* process the latest information from ALE */
33 | void CarnivalSettings::step(const System& system) {
34 |
35 | // update the reward
36 | reward_t score = getDecimalScore(0xAE, 0xAD, &system);
37 | score *= 10;
38 | m_reward = score - m_score;
39 | m_score = score;
40 |
41 | // update terminal status
42 | int ammo = readRam(&system, 0x83);
43 | m_terminal = ammo < 1;
44 | }
45 |
46 |
47 | /* is end of game */
48 | bool CarnivalSettings::isTerminal() const {
49 |
50 | return m_terminal;
51 | };
52 |
53 |
54 | /* get the most recently observed reward */
55 | reward_t CarnivalSettings::getReward() const {
56 |
57 | return m_reward;
58 | }
59 |
60 |
61 | /* is an action part of the minimal set? */
62 | bool CarnivalSettings::isMinimal(const Action &a) const {
63 |
64 | switch (a) {
65 | case PLAYER_A_NOOP:
66 | case PLAYER_A_FIRE:
67 | case PLAYER_A_RIGHT:
68 | case PLAYER_A_LEFT:
69 | case PLAYER_A_RIGHTFIRE:
70 | case PLAYER_A_LEFTFIRE:
71 | return true;
72 | default:
73 | return false;
74 | }
75 | }
76 |
77 |
78 | /* reset the state of the game */
79 | void CarnivalSettings::reset() {
80 |
81 | m_reward = 0;
82 | m_score = 0;
83 | m_terminal = false;
84 | }
85 |
86 |
87 |
88 | /* saves the state of the rom settings */
89 | void CarnivalSettings::saveState(Serializer & ser) {
90 | ser.putInt(m_reward);
91 | ser.putInt(m_score);
92 | ser.putBool(m_terminal);
93 | }
94 |
95 | // loads the state of the rom settings
96 | void CarnivalSettings::loadState(Deserializer & ser) {
97 | m_reward = ser.getInt();
98 | m_score = ser.getInt();
99 | m_terminal = ser.getBool();
100 | }
101 |
102 |
--------------------------------------------------------------------------------
/atari_py/ale_interface/src/games/supported/Carnival.hpp:
--------------------------------------------------------------------------------
1 | /* *****************************************************************************
2 | * The line 67 is based on Xitari's code, from Google Inc.
3 | *
4 | * This program is free software; you can redistribute it and/or
5 | * modify it under the terms of the GNU General Public License version 2
6 | * as published by the Free Software Foundation.
7 | *
8 | * This program is distributed in the hope that it will be useful,
9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 | * GNU General Public License for more details.
12 | *
13 | * You should have received a copy of the GNU General Public License
14 | * along with this program; if not, write to the Free Software
15 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
16 | * *****************************************************************************
17 | * A.L.E (Arcade Learning Environment)
18 | * Copyright (c) 2009-2013 by Yavar Naddaf, Joel Veness, Marc G. Bellemare and
19 | * the Reinforcement Learning and Artificial Intelligence Laboratory
20 | * Released under the GNU General Public License; see License.txt for details.
21 | *
22 | * Based on: Stella -- "An Atari 2600 VCS Emulator"
23 | * Copyright (c) 1995-2007 by Bradford W. Mott and the Stella team
24 | *
25 | * *****************************************************************************
26 | */
27 | #ifndef __CARNIVAL_HPP__
28 | #define __CARNIVAL_HPP__
29 |
30 | #include "../RomSettings.hpp"
31 |
32 |
33 | /* RL wrapper for Carnival settings */
34 | class CarnivalSettings : public RomSettings {
35 |
36 | public:
37 |
38 | CarnivalSettings();
39 |
40 | // reset
41 | void reset();
42 |
43 | // is end of game
44 | bool isTerminal() const;
45 |
46 | // get the most recently observed reward
47 | reward_t getReward() const;
48 |
49 | // the rom-name
50 | const char* rom() const { return "carnival"; }
51 |
52 | // create a new instance of the rom
53 | RomSettings* clone() const;
54 |
55 | // is an action part of the minimal set?
56 | bool isMinimal(const Action& a) const;
57 |
58 | // process the latest information from ALE
59 | void step(const System& system);
60 |
61 | // saves the state of the rom settings
62 | void saveState(Serializer & ser);
63 |
64 | // loads the state of the rom settings
65 | void loadState(Deserializer & ser);
66 |
67 | virtual const int lives() { return 0; }
68 |
69 | private:
70 |
71 | bool m_terminal;
72 | reward_t m_reward;
73 | reward_t m_score;
74 | };
75 |
76 | #endif // __CARNIVAL_HPP__
77 |
78 |
--------------------------------------------------------------------------------
/atari_py/ale_interface/src/games/supported/Enduro.hpp:
--------------------------------------------------------------------------------
1 | /* *****************************************************************************
2 | * The line 69 is based on Xitari's code, from Google Inc.
3 | *
4 | * This program is free software; you can redistribute it and/or
5 | * modify it under the terms of the GNU General Public License version 2
6 | * as published by the Free Software Foundation.
7 | *
8 | * This program is distributed in the hope that it will be useful,
9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 | * GNU General Public License for more details.
12 | *
13 | * You should have received a copy of the GNU General Public License
14 | * along with this program; if not, write to the Free Software
15 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
16 | * *****************************************************************************
17 | * A.L.E (Arcade Learning Environment)
18 | * Copyright (c) 2009-2013 by Yavar Naddaf, Joel Veness, Marc G. Bellemare and
19 | * the Reinforcement Learning and Artificial Intelligence Laboratory
20 | * Released under the GNU General Public License; see License.txt for details.
21 | *
22 | * Based on: Stella -- "An Atari 2600 VCS Emulator"
23 | * Copyright (c) 1995-2007 by Bradford W. Mott and the Stella team
24 | *
25 | * *****************************************************************************
26 | */
27 | #ifndef __ENDURO_HPP__
28 | #define __ENDURO_HPP__
29 |
30 | #include "../RomSettings.hpp"
31 |
32 |
33 | /* RL wrapper for Enduro settings */
34 | class EnduroSettings : public RomSettings {
35 |
36 | public:
37 |
38 | EnduroSettings();
39 |
40 | // reset
41 | void reset();
42 |
43 | // is end of game
44 | bool isTerminal() const;
45 |
46 | // get the most recently observed reward
47 | reward_t getReward() const;
48 |
49 | // the rom-name
50 | const char* rom() const { return "enduro"; }
51 |
52 | // create a new instance of the rom
53 | RomSettings* clone() const;
54 |
55 | // is an action part of the minimal set?
56 | bool isMinimal(const Action& a) const;
57 |
58 | // process the latest information from ALE
59 | void step(const System& system);
60 |
61 | // saves the state of the rom settings
62 | void saveState(Serializer & ser);
63 |
64 | // loads the state of the rom settings
65 | void loadState(Deserializer & ser);
66 |
67 | ActionVect getStartingActions();
68 |
69 | virtual const int lives() { return 0; }
70 |
71 | private:
72 |
73 | bool m_terminal;
74 | reward_t m_reward;
75 | reward_t m_score;
76 | };
77 |
78 | #endif // __ENDURO_HPP__
79 |
80 |
--------------------------------------------------------------------------------
/atari_py/ale_interface/src/games/supported/FishingDerby.hpp:
--------------------------------------------------------------------------------
1 | /* *****************************************************************************
2 | * The line 67 is based on Xitari's code, from Google Inc.
3 | *
4 | * This program is free software; you can redistribute it and/or
5 | * modify it under the terms of the GNU General Public License version 2
6 | * as published by the Free Software Foundation.
7 | *
8 | * This program is distributed in the hope that it will be useful,
9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 | * GNU General Public License for more details.
12 | *
13 | * You should have received a copy of the GNU General Public License
14 | * along with this program; if not, write to the Free Software
15 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
16 | * *****************************************************************************
17 | * A.L.E (Arcade Learning Environment)
18 | * Copyright (c) 2009-2013 by Yavar Naddaf, Joel Veness, Marc G. Bellemare and
19 | * the Reinforcement Learning and Artificial Intelligence Laboratory
20 | * Released under the GNU General Public License; see License.txt for details.
21 | *
22 | * Based on: Stella -- "An Atari 2600 VCS Emulator"
23 | * Copyright (c) 1995-2007 by Bradford W. Mott and the Stella team
24 | *
25 | * *****************************************************************************
26 | */
27 | #ifndef __FISHINGDERBY_HPP__
28 | #define __FISHINGDERBY_HPP__
29 |
30 | #include "../RomSettings.hpp"
31 |
32 |
33 | /* RL wrapper for Fishing Derby settings */
34 | class FishingDerbySettings : public RomSettings {
35 |
36 | public:
37 |
38 | FishingDerbySettings();
39 |
40 | // reset
41 | void reset();
42 |
43 | // is end of game
44 | bool isTerminal() const;
45 |
46 | // get the most recently observed reward
47 | reward_t getReward() const;
48 |
49 | // the rom-name
50 | const char* rom() const { return "fishing_derby"; }
51 |
52 | // create a new instance of the rom
53 | RomSettings* clone() const;
54 |
55 | // is an action part of the minimal set?
56 | bool isMinimal(const Action& a) const;
57 |
58 | // process the latest information from ALE
59 | void step(const System& system);
60 |
61 | // saves the state of the rom settings
62 | void saveState(Serializer & ser);
63 |
64 | // loads the state of the rom settings
65 | void loadState(Deserializer & ser);
66 |
67 | virtual const int lives() { return 0; }
68 |
69 | private:
70 |
71 | bool m_terminal;
72 | reward_t m_reward;
73 | reward_t m_score;
74 | };
75 |
76 | #endif // __FISHINGDERBY_HPP__
77 |
78 |
--------------------------------------------------------------------------------
/atari_py/ale_interface/src/games/supported/Freeway.cpp:
--------------------------------------------------------------------------------
1 | /* *****************************************************************************
2 | * A.L.E (Arcade Learning Environment)
3 | * Copyright (c) 2009-2013 by Yavar Naddaf, Joel Veness, Marc G. Bellemare and
4 | * the Reinforcement Learning and Artificial Intelligence Laboratory
5 | * Released under the GNU General Public License; see License.txt for details.
6 | *
7 | * Based on: Stella -- "An Atari 2600 VCS Emulator"
8 | * Copyright (c) 1995-2007 by Bradford W. Mott and the Stella team
9 | *
10 | * *****************************************************************************
11 | */
12 | #include "Freeway.hpp"
13 |
14 | #include "../RomUtils.hpp"
15 |
16 |
17 | FreewaySettings::FreewaySettings() {
18 |
19 | reset();
20 | }
21 |
22 |
23 | /* create a new instance of the rom */
24 | RomSettings* FreewaySettings::clone() const {
25 |
26 | RomSettings* rval = new FreewaySettings();
27 | *rval = *this;
28 | return rval;
29 | }
30 |
31 |
32 | /* process the latest information from ALE */
33 | void FreewaySettings::step(const System& system) {
34 |
35 | // update the reward
36 | int score = getDecimalScore(103, -1, &system);
37 | int reward = score - m_score;
38 | if (reward < 0) reward = 0;
39 | if (reward > 1) reward = 1;
40 | m_reward = reward;
41 | m_score = score;
42 |
43 | // update terminal status
44 | m_terminal = readRam(&system, 22) == 1;
45 | }
46 |
47 |
48 | /* is end of game */
49 | bool FreewaySettings::isTerminal() const {
50 |
51 | return m_terminal;
52 | };
53 |
54 |
55 | /* get the most recently observed reward */
56 | reward_t FreewaySettings::getReward() const {
57 |
58 | return m_reward;
59 | }
60 |
61 |
62 | /* is an action part of the minimal set? */
63 | bool FreewaySettings::isMinimal(const Action &a) const {
64 |
65 | switch (a) {
66 | case PLAYER_A_NOOP:
67 | case PLAYER_A_UP:
68 | case PLAYER_A_DOWN:
69 | return true;
70 | default:
71 | return false;
72 | }
73 | }
74 |
75 |
76 | /* reset the state of the game */
77 | void FreewaySettings::reset() {
78 |
79 | m_reward = 0;
80 | m_score = 0;
81 | m_terminal = false;
82 | }
83 |
84 | /* saves the state of the rom settings */
85 | void FreewaySettings::saveState(Serializer & ser) {
86 | ser.putInt(m_reward);
87 | ser.putInt(m_score);
88 | ser.putBool(m_terminal);
89 | }
90 |
91 | // loads the state of the rom settings
92 | void FreewaySettings::loadState(Deserializer & ser) {
93 | m_reward = ser.getInt();
94 | m_score = ser.getInt();
95 | m_terminal = ser.getBool();
96 | }
97 |
98 |
--------------------------------------------------------------------------------
/atari_py/ale_interface/src/games/supported/Freeway.hpp:
--------------------------------------------------------------------------------
1 | /* *****************************************************************************
2 | * The line 67 is based on Xitari's code, from Google Inc.
3 | *
4 | * This program is free software; you can redistribute it and/or
5 | * modify it under the terms of the GNU General Public License version 2
6 | * as published by the Free Software Foundation.
7 | *
8 | * This program is distributed in the hope that it will be useful,
9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 | * GNU General Public License for more details.
12 | *
13 | * You should have received a copy of the GNU General Public License
14 | * along with this program; if not, write to the Free Software
15 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
16 | * *****************************************************************************
17 | * A.L.E (Arcade Learning Environment)
18 | * Copyright (c) 2009-2013 by Yavar Naddaf, Joel Veness, Marc G. Bellemare and
19 | * the Reinforcement Learning and Artificial Intelligence Laboratory
20 | * Released under the GNU General Public License; see License.txt for details.
21 | *
22 | * Based on: Stella -- "An Atari 2600 VCS Emulator"
23 | * Copyright (c) 1995-2007 by Bradford W. Mott and the Stella team
24 | *
25 | * *****************************************************************************
26 | */
27 | #ifndef __FREEWAY_HPP__
28 | #define __FREEWAY_HPP__
29 |
30 | #include "../RomSettings.hpp"
31 |
32 |
33 | /* RL wrapper for Freeway */
34 | class FreewaySettings : public RomSettings {
35 |
36 | public:
37 |
38 | FreewaySettings();
39 |
40 | // reset
41 | void reset();
42 |
43 | // is end of game
44 | bool isTerminal() const;
45 |
46 | // get the most recently observed reward
47 | reward_t getReward() const;
48 |
49 | // the rom-name
50 | const char* rom() const { return "freeway"; }
51 |
52 | // create a new instance of the rom
53 | RomSettings* clone() const;
54 |
55 | // is an action part of the minimal set?
56 | bool isMinimal(const Action& a) const;
57 |
58 | // process the latest information from ALE
59 | void step(const System& system);
60 |
61 | // saves the state of the rom settings
62 | void saveState(Serializer & ser);
63 |
64 | // loads the state of the rom settings
65 | void loadState(Deserializer & ser);
66 |
67 | virtual const int lives() { return 0; }
68 |
69 | private:
70 |
71 | bool m_terminal;
72 | reward_t m_reward;
73 | reward_t m_score;
74 | };
75 |
76 | #endif // __FREEWAY_HPP__
77 |
78 |
--------------------------------------------------------------------------------
/atari_py/ale_interface/src/games/supported/Hero.hpp:
--------------------------------------------------------------------------------
1 | /* *****************************************************************************
2 | * The lines 67 and 74 are based on Xitari's code, from Google Inc.
3 | *
4 | * This program is free software; you can redistribute it and/or
5 | * modify it under the terms of the GNU General Public License version 2
6 | * as published by the Free Software Foundation.
7 | *
8 | * This program is distributed in the hope that it will be useful,
9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 | * GNU General Public License for more details.
12 | *
13 | * You should have received a copy of the GNU General Public License
14 | * along with this program; if not, write to the Free Software
15 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
16 | * *****************************************************************************
17 | * A.L.E (Arcade Learning Environment)
18 | * Copyright (c) 2009-2013 by Yavar Naddaf, Joel Veness, Marc G. Bellemare and
19 | * the Reinforcement Learning and Artificial Intelligence Laboratory
20 | * Released under the GNU General Public License; see License.txt for details.
21 | *
22 | * Based on: Stella -- "An Atari 2600 VCS Emulator"
23 | * Copyright (c) 1995-2007 by Bradford W. Mott and the Stella team
24 | *
25 | * *****************************************************************************
26 | */
27 | #ifndef __HERO_HPP__
28 | #define __HERO_HPP__
29 |
30 | #include "../RomSettings.hpp"
31 |
32 |
33 | /* RL wrapper for Hero */
34 | class HeroSettings : public RomSettings {
35 |
36 | public:
37 |
38 | HeroSettings();
39 |
40 | // reset
41 | void reset();
42 |
43 | // is end of game
44 | bool isTerminal() const;
45 |
46 | // get the most recently observed reward
47 | reward_t getReward() const;
48 |
49 | // the rom-name
50 | const char* rom() const { return "hero"; }
51 |
52 | // create a new instance of the rom
53 | RomSettings* clone() const;
54 |
55 | // is an action part of the minimal set?
56 | bool isMinimal(const Action& a) const;
57 |
58 | // process the latest information from ALE
59 | void step(const System& system);
60 |
61 | // saves the state of the rom settings
62 | void saveState(Serializer & ser);
63 |
64 | // loads the state of the rom settings
65 | void loadState(Deserializer & ser);
66 |
67 | virtual const int lives() { return isTerminal() ? 0 : m_lives; }
68 |
69 | private:
70 |
71 | bool m_terminal;
72 | reward_t m_reward;
73 | reward_t m_score;
74 | int m_lives;
75 | };
76 |
77 | #endif // __HERO_HPP__
78 |
79 |
--------------------------------------------------------------------------------
/atari_py/ale_interface/src/games/supported/IceHockey.hpp:
--------------------------------------------------------------------------------
1 | /* *****************************************************************************
2 | * The line 67 is based on Xitari's code, from Google Inc.
3 | *
4 | * This program is free software; you can redistribute it and/or
5 | * modify it under the terms of the GNU General Public License version 2
6 | * as published by the Free Software Foundation.
7 | *
8 | * This program is distributed in the hope that it will be useful,
9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 | * GNU General Public License for more details.
12 | *
13 | * You should have received a copy of the GNU General Public License
14 | * along with this program; if not, write to the Free Software
15 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
16 | * *****************************************************************************
17 | * A.L.E (Arcade Learning Environment)
18 | * Copyright (c) 2009-2013 by Yavar Naddaf, Joel Veness, Marc G. Bellemare and
19 | * the Reinforcement Learning and Artificial Intelligence Laboratory
20 | * Released under the GNU General Public License; see License.txt for details.
21 | *
22 | * Based on: Stella -- "An Atari 2600 VCS Emulator"
23 | * Copyright (c) 1995-2007 by Bradford W. Mott and the Stella team
24 | *
25 | * *****************************************************************************
26 | */
27 | #ifndef __ICEHOCKEY_HPP__
28 | #define __ICEHOCKEY_HPP__
29 |
30 | #include "../RomSettings.hpp"
31 |
32 |
33 | /* RL wrapper for Ice Hockey */
34 | class IceHockeySettings : public RomSettings {
35 |
36 | public:
37 |
38 | IceHockeySettings();
39 |
40 | // reset
41 | void reset();
42 |
43 | // is end of game
44 | bool isTerminal() const;
45 |
46 | // get the most recently observed reward
47 | reward_t getReward() const;
48 |
49 | // the rom-name
50 | const char* rom() const { return "ice_hockey"; }
51 |
52 | // create a new instance of the rom
53 | RomSettings* clone() const;
54 |
55 | // is an action part of the minimal set?
56 | bool isMinimal(const Action& a) const;
57 |
58 | // process the latest information from ALE
59 | void step(const System& system);
60 |
61 | // saves the state of the rom settings
62 | void saveState(Serializer & ser);
63 |
64 | // loads the state of the rom settings
65 | void loadState(Deserializer & ser);
66 |
67 | virtual const int lives() { return 0; }
68 |
69 | private:
70 |
71 | bool m_terminal;
72 | reward_t m_reward;
73 | reward_t m_score;
74 | };
75 |
76 | #endif // __ICEHOCKEY_HPP__
77 |
78 |
--------------------------------------------------------------------------------
/atari_py/ale_interface/src/games/supported/Krull.hpp:
--------------------------------------------------------------------------------
1 | /* *****************************************************************************
2 | * The lines 67 and 74 are based on Xitari's code, from Google Inc.
3 | *
4 | * This program is free software; you can redistribute it and/or
5 | * modify it under the terms of the GNU General Public License version 2
6 | * as published by the Free Software Foundation.
7 | *
8 | * This program is distributed in the hope that it will be useful,
9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 | * GNU General Public License for more details.
12 | *
13 | * You should have received a copy of the GNU General Public License
14 | * along with this program; if not, write to the Free Software
15 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
16 | * *****************************************************************************
17 | * A.L.E (Arcade Learning Environment)
18 | * Copyright (c) 2009-2013 by Yavar Naddaf, Joel Veness, Marc G. Bellemare and
19 | * the Reinforcement Learning and Artificial Intelligence Laboratory
20 | * Released under the GNU General Public License; see License.txt for details.
21 | *
22 | * Based on: Stella -- "An Atari 2600 VCS Emulator"
23 | * Copyright (c) 1995-2007 by Bradford W. Mott and the Stella team
24 | *
25 | * *****************************************************************************
26 | */
27 | #ifndef __KRULL_HPP__
28 | #define __KRULL_HPP__
29 |
30 | #include "../RomSettings.hpp"
31 |
32 |
33 | /* RL wrapper for Krull */
34 | class KrullSettings : public RomSettings {
35 |
36 | public:
37 |
38 | KrullSettings();
39 |
40 | // reset
41 | void reset();
42 |
43 | // is end of game
44 | bool isTerminal() const;
45 |
46 | // get the most recently observed reward
47 | reward_t getReward() const;
48 |
49 | // the rom-name
50 | const char* rom() const { return "krull"; }
51 |
52 | // create a new instance of the rom
53 | RomSettings* clone() const;
54 |
55 | // is an action part of the minimal set?
56 | bool isMinimal(const Action& a) const;
57 |
58 | // process the latest information from ALE
59 | void step(const System& system);
60 |
61 | // saves the state of the rom settings
62 | void saveState(Serializer & ser);
63 |
64 | // loads the state of the rom settings
65 | void loadState(Deserializer & ser);
66 |
67 | virtual const int lives() { return isTerminal() ? 0 : m_lives; }
68 |
69 | private:
70 |
71 | bool m_terminal;
72 | reward_t m_reward;
73 | reward_t m_score;
74 | int m_lives;
75 | };
76 |
77 | #endif // __KRULL_HPP__
78 |
79 |
--------------------------------------------------------------------------------
/atari_py/ale_interface/src/games/supported/Pong.cpp:
--------------------------------------------------------------------------------
1 | /* *****************************************************************************
2 | * A.L.E (Arcade Learning Environment)
3 | * Copyright (c) 2009-2013 by Yavar Naddaf, Joel Veness, Marc G. Bellemare and
4 | * the Reinforcement Learning and Artificial Intelligence Laboratory
5 | * Released under the GNU General Public License; see License.txt for details.
6 | *
7 | * Based on: Stella -- "An Atari 2600 VCS Emulator"
8 | * Copyright (c) 1995-2007 by Bradford W. Mott and the Stella team
9 | *
10 | * *****************************************************************************
11 | */
12 | #include "Pong.hpp"
13 |
14 | #include "../RomUtils.hpp"
15 |
16 |
17 | PongSettings::PongSettings() {
18 |
19 | reset();
20 | }
21 |
22 |
23 | /* create a new instance of the rom */
24 | RomSettings* PongSettings::clone() const {
25 |
26 | RomSettings* rval = new PongSettings();
27 | *rval = *this;
28 | return rval;
29 | }
30 |
31 |
32 | /* process the latest information from ALE */
33 | void PongSettings::step(const System& system) {
34 |
35 | // update the reward
36 | int x = readRam(&system, 13); // cpu score
37 | int y = readRam(&system, 14); // player score
38 | reward_t score = y - x;
39 | m_reward = score - m_score;
40 | m_score = score;
41 |
42 | // update terminal status
43 | // (game over when a player reaches 21)
44 | m_terminal = x == 21 || y == 21;
45 | }
46 |
47 |
48 | /* is end of game */
49 | bool PongSettings::isTerminal() const {
50 |
51 | return m_terminal;
52 | };
53 |
54 |
55 | /* get the most recently observed reward */
56 | reward_t PongSettings::getReward() const {
57 |
58 | return m_reward;
59 | }
60 |
61 |
62 | /* is an action part of the minimal set? */
63 | bool PongSettings::isMinimal(const Action &a) const {
64 |
65 | switch (a) {
66 | case PLAYER_A_NOOP:
67 | case PLAYER_A_FIRE:
68 | case PLAYER_A_RIGHT:
69 | case PLAYER_A_LEFT:
70 | case PLAYER_A_RIGHTFIRE:
71 | case PLAYER_A_LEFTFIRE:
72 | return true;
73 | default:
74 | return false;
75 | }
76 | }
77 |
78 |
79 | /* reset the state of the game */
80 | void PongSettings::reset() {
81 |
82 | m_reward = 0;
83 | m_score = 0;
84 | m_terminal = false;
85 | }
86 |
87 |
88 | /* saves the state of the rom settings */
89 | void PongSettings::saveState(Serializer & ser) {
90 | ser.putInt(m_reward);
91 | ser.putInt(m_score);
92 | ser.putBool(m_terminal);
93 | }
94 |
95 | // loads the state of the rom settings
96 | void PongSettings::loadState(Deserializer & ser) {
97 | m_reward = ser.getInt();
98 | m_score = ser.getInt();
99 | m_terminal = ser.getBool();
100 | }
101 |
102 |
--------------------------------------------------------------------------------
/atari_py/ale_interface/src/games/supported/Pong.hpp:
--------------------------------------------------------------------------------
1 | /* *****************************************************************************
2 | * The line 67 is based on Xitari's code, from Google Inc.
3 | *
4 | * This program is free software; you can redistribute it and/or
5 | * modify it under the terms of the GNU General Public License version 2
6 | * as published by the Free Software Foundation.
7 | *
8 | * This program is distributed in the hope that it will be useful,
9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 | * GNU General Public License for more details.
12 | *
13 | * You should have received a copy of the GNU General Public License
14 | * along with this program; if not, write to the Free Software
15 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
16 | * *****************************************************************************
17 | * A.L.E (Arcade Learning Environment)
18 | * Copyright (c) 2009-2013 by Yavar Naddaf, Joel Veness, Marc G. Bellemare and
19 | * the Reinforcement Learning and Artificial Intelligence Laboratory
20 | * Released under the GNU General Public License; see License.txt for details.
21 | *
22 | * Based on: Stella -- "An Atari 2600 VCS Emulator"
23 | * Copyright (c) 1995-2007 by Bradford W. Mott and the Stella team
24 | *
25 | * *****************************************************************************
26 | */
27 | #ifndef __PONG_HPP__
28 | #define __PONG_HPP__
29 |
30 | #include "../RomSettings.hpp"
31 |
32 |
33 | /* RL wrapper for Pong */
34 | class PongSettings : public RomSettings {
35 |
36 | public:
37 |
38 | PongSettings();
39 |
40 | // reset
41 | void reset();
42 |
43 | // is end of game
44 | bool isTerminal() const;
45 |
46 | // get the most recently observed reward
47 | reward_t getReward() const;
48 |
49 | // the rom-name
50 | const char* rom() const { return "pong"; }
51 |
52 | // create a new instance of the rom
53 | RomSettings* clone() const;
54 |
55 | // is an action part of the minimal set?
56 | bool isMinimal(const Action& a) const;
57 |
58 | // process the latest information from ALE
59 | void step(const System& system);
60 |
61 | // saves the state of the rom settings
62 | void saveState(Serializer & ser);
63 |
64 | // loads the state of the rom settings
65 | void loadState(Deserializer & ser);
66 |
67 | virtual const int lives() { return 0; }
68 |
69 | private:
70 |
71 | bool m_terminal;
72 | reward_t m_reward;
73 | reward_t m_score;
74 | };
75 |
76 | #endif // __PONG_HPP__
77 |
78 |
--------------------------------------------------------------------------------
/atari_py/ale_interface/src/games/supported/Pooyan.hpp:
--------------------------------------------------------------------------------
1 | /* *****************************************************************************
2 | * The lines 67 and 74 are based on Xitari's code, from Google Inc.
3 | *
4 | * This program is free software; you can redistribute it and/or
5 | * modify it under the terms of the GNU General Public License version 2
6 | * as published by the Free Software Foundation.
7 | *
8 | * This program is distributed in the hope that it will be useful,
9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 | * GNU General Public License for more details.
12 | *
13 | * You should have received a copy of the GNU General Public License
14 | * along with this program; if not, write to the Free Software
15 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
16 | * *****************************************************************************
17 | * A.L.E (Arcade Learning Environment)
18 | * Copyright (c) 2009-2013 by Yavar Naddaf, Joel Veness, Marc G. Bellemare and
19 | * the Reinforcement Learning and Artificial Intelligence Laboratory
20 | * Released under the GNU General Public License; see License.txt for details.
21 | *
22 | * Based on: Stella -- "An Atari 2600 VCS Emulator"
23 | * Copyright (c) 1995-2007 by Bradford W. Mott and the Stella team
24 | *
25 | * *****************************************************************************
26 | */
27 | #ifndef __POOYAN_HPP__
28 | #define __POOYAN_HPP__
29 |
30 | #include "../RomSettings.hpp"
31 |
32 |
33 | /* RL wrapper for Pooyan */
34 | class PooyanSettings : public RomSettings {
35 |
36 | public:
37 |
38 | PooyanSettings();
39 |
40 | // reset
41 | void reset();
42 |
43 | // is end of game
44 | bool isTerminal() const;
45 |
46 | // get the most recently observed reward
47 | reward_t getReward() const;
48 |
49 | // the rom-name
50 | const char* rom() const { return "pooyan"; }
51 |
52 | // create a new instance of the rom
53 | RomSettings* clone() const;
54 |
55 | // is an action part of the minimal set?
56 | bool isMinimal(const Action& a) const;
57 |
58 | // process the latest information from ALE
59 | void step(const System& system);
60 |
61 | // saves the state of the rom settings
62 | void saveState(Serializer & ser);
63 |
64 | // loads the state of the rom settings
65 | void loadState(Deserializer & ser);
66 |
67 | virtual const int lives() { return isTerminal() ? 0 : m_lives; }
68 |
69 | private:
70 |
71 | bool m_terminal;
72 | reward_t m_reward;
73 | reward_t m_score;
74 | int m_lives;
75 | };
76 |
77 | #endif // __POOYAN_HPP__
78 |
79 |
--------------------------------------------------------------------------------
/atari_py/ale_interface/src/games/supported/Tennis.hpp:
--------------------------------------------------------------------------------
1 | /* *****************************************************************************
2 | * The line 67 is based on Xitari's code, from Google Inc.
3 | *
4 | * This program is free software; you can redistribute it and/or
5 | * modify it under the terms of the GNU General Public License version 2
6 | * as published by the Free Software Foundation.
7 | *
8 | * This program is distributed in the hope that it will be useful,
9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 | * GNU General Public License for more details.
12 | *
13 | * You should have received a copy of the GNU General Public License
14 | * along with this program; if not, write to the Free Software
15 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
16 | * *****************************************************************************
17 | * A.L.E (Arcade Learning Environment)
18 | * Copyright (c) 2009-2013 by Yavar Naddaf, Joel Veness, Marc G. Bellemare and
19 | * the Reinforcement Learning and Artificial Intelligence Laboratory
20 | * Released under the GNU General Public License; see License.txt for details.
21 | *
22 | * Based on: Stella -- "An Atari 2600 VCS Emulator"
23 | * Copyright (c) 1995-2007 by Bradford W. Mott and the Stella team
24 | *
25 | * *****************************************************************************
26 | */
27 | #ifndef __TENNIS_HPP__
28 | #define __TENNIS_HPP__
29 |
30 | #include "../RomSettings.hpp"
31 |
32 |
33 | /* RL wrapper for Tennis */
34 | class TennisSettings : public RomSettings {
35 |
36 | public:
37 |
38 | TennisSettings();
39 |
40 | // reset
41 | void reset();
42 |
43 | // is end of game
44 | bool isTerminal() const;
45 |
46 | // get the most recently observed reward
47 | reward_t getReward() const;
48 |
49 | // the rom-name
50 | const char* rom() const { return "tennis"; }
51 |
52 | // create a new instance of the rom
53 | RomSettings* clone() const;
54 |
55 | // is an action part of the minimal set?
56 | bool isMinimal(const Action& a) const;
57 |
58 | // process the latest information from ALE
59 | void step(const System& system);
60 |
61 | // saves the state of the rom settings
62 | void saveState(Serializer & ser);
63 |
64 | // loads the state of the rom settings
65 | void loadState(Deserializer & ser);
66 |
67 | virtual const int lives() { return 0; }
68 |
69 | private:
70 |
71 | bool m_terminal;
72 | reward_t m_reward;
73 | int m_prev_delta_points;
74 | int m_prev_delta_score;
75 | };
76 |
77 | #endif // __TENNIS_HPP__
78 |
79 |
--------------------------------------------------------------------------------
/atari_py/ale_interface/src/module.mk:
--------------------------------------------------------------------------------
1 | MODULE := src/
2 |
3 | MODULE_OBJS := \
4 | src/main.o \
5 | src/ale_interface.o
6 |
7 | MODULE_DIRS += \
8 | src/
9 |
10 | # Include common rules
11 | include $(srcdir)/common.rules
12 |
--------------------------------------------------------------------------------
/atari_py/ale_interface/src/os_dependent/OSystemUNIX.cxx:
--------------------------------------------------------------------------------
1 | //============================================================================
2 | //
3 | // SSSS tt lll lll
4 | // SS SS tt ll ll
5 | // SS tttttt eeee ll ll aaaa
6 | // SSSS tt ee ee ll ll aa
7 | // SS tt eeeeee ll ll aaaaa -- "An Atari 2600 VCS Emulator"
8 | // SS SS tt ee ll ll aa aa
9 | // SSSS ttt eeeee llll llll aaaaa
10 | //
11 | // Copyright (c) 1995-2007 by Bradford W. Mott and the Stella team
12 | //
13 | // See the file "license" for information on usage and redistribution of
14 | // this file, and for a DISCLAIMER OF ALL WARRANTIES.
15 | //
16 | // $Id: OSystemUNIX.cxx,v 1.27 2007/07/19 16:21:39 stephena Exp $
17 | //============================================================================
18 |
19 | #include
20 | #include
21 | #include
22 |
23 | #include
24 | #include
25 | #include
26 |
27 | #include "bspf.hxx"
28 | #include "OSystem.hxx"
29 | #include "OSystemUNIX.hxx"
30 | using namespace std;
31 |
32 | //ALE #ifdef HAVE_GETTIMEOFDAY
33 | #include
34 | #include
35 | //ALE #endif
36 |
37 | /**
38 | Each derived class is responsible for calling the following methods
39 | in its constructor:
40 |
41 | setBaseDir()
42 | setConfigFile()
43 |
44 | See OSystem.hxx for a further explanation
45 | */
46 |
47 | // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
48 | OSystemUNIX::OSystemUNIX()
49 | : OSystem()
50 | {
51 | //ALE const string& basedir = string(getenv("HOME")) + "/.stella";
52 | string basedir = string("."); //ALE
53 | setBaseDir(basedir);
54 | setConfigFile(basedir + "/stellarc");
55 | }
56 |
57 | // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
58 | OSystemUNIX::~OSystemUNIX()
59 | {
60 | }
61 |
62 | // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
63 | uInt32 OSystemUNIX::getTicks() {
64 | //ALE #ifdef HAVE_GETTIMEOFDAY
65 | timeval now;
66 | gettimeofday(&now, 0);
67 | return (uInt32) (now.tv_sec * 1000000 + now.tv_usec);
68 | //ALE #else
69 | //ALE return (uInt32) SDL_GetTicks() * 1000;
70 | //ALE #endif
71 | }
72 |
--------------------------------------------------------------------------------
/atari_py/ale_interface/src/os_dependent/OSystemUNIX.hxx:
--------------------------------------------------------------------------------
1 | //============================================================================
2 | //
3 | // SSSS tt lll lll
4 | // SS SS tt ll ll
5 | // SS tttttt eeee ll ll aaaa
6 | // SSSS tt ee ee ll ll aa
7 | // SS tt eeeeee ll ll aaaaa -- "An Atari 2600 VCS Emulator"
8 | // SS SS tt ee ll ll aa aa
9 | // SSSS ttt eeeee llll llll aaaaa
10 | //
11 | // Copyright (c) 1995-2007 by Bradford W. Mott and the Stella team
12 | //
13 | // See the file "license" for information on usage and redistribution of
14 | // this file, and for a DISCLAIMER OF ALL WARRANTIES.
15 | //
16 | // $Id: OSystemUNIX.hxx,v 1.16 2007/07/19 16:21:39 stephena Exp $
17 | //============================================================================
18 |
19 | #ifndef OSYSTEM_UNIX_HXX
20 | #define OSYSTEM_UNIX_HXX
21 |
22 | #include "../emucore/m6502/src/bspf/src/bspf.hxx"
23 |
24 | /**
25 | This class defines UNIX-like OS's (Linux) system specific settings.
26 |
27 | @author Stephen Anthony
28 | @version $Id: OSystemUNIX.hxx,v 1.16 2007/07/19 16:21:39 stephena Exp $
29 | */
30 | class OSystemUNIX : public OSystem
31 | {
32 | public:
33 | /**
34 | Create a new UNIX-specific operating system object
35 | */
36 | OSystemUNIX();
37 |
38 | /**
39 | Destructor
40 | */
41 | virtual ~OSystemUNIX();
42 |
43 | /**
44 | This method returns number of ticks in microseconds.
45 |
46 | @return Current time in microseconds.
47 | */
48 | uInt32 getTicks();
49 | };
50 |
51 | #endif
52 |
--------------------------------------------------------------------------------
/atari_py/ale_interface/src/os_dependent/OSystemWin32.cxx:
--------------------------------------------------------------------------------
1 | //============================================================================
2 | //
3 | // SSSS tt lll lll
4 | // SS SS tt ll ll
5 | // SS tttttt eeee ll ll aaaa
6 | // SSSS tt ee ee ll ll aa
7 | // SS tt eeeeee ll ll aaaaa -- "An Atari 2600 VCS Emulator"
8 | // SS SS tt ee ll ll aa aa
9 | // SSSS ttt eeeee llll llll aaaaa
10 | //
11 | // Copyright (c) 1995-2007 by Bradford W. Mott and the Stella team
12 | //
13 | // See the file "license" for information on usage and redistribution of
14 | // this file, and for a DISCLAIMER OF ALL WARRANTIES.
15 | //
16 | // $Id: OSystemWin32.cxx,v 1.20 2007/08/04 20:32:54 stephena Exp $
17 | //============================================================================
18 |
19 | #include
20 | #include
21 | #include
22 |
23 | #include "bspf.hxx"
24 | #include "OSystem.hxx"
25 | #include "OSystemWin32.hxx"
26 |
27 | using namespace std;
28 |
29 | /**
30 | Each derived class is responsible for calling the following methods
31 | in its constructor:
32 |
33 | setBaseDir()
34 | setConfigFile()
35 |
36 | See OSystem.hxx for a further explanation
37 | */
38 |
39 | // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
40 | OSystemWin32::OSystemWin32()
41 | : OSystem()
42 | {
43 | // TODO - there really should be code here to determine which version
44 | // of Windows is being used.
45 | // If using a version which supports multiple users (NT and above),
46 | // the relevant directories should be created in per-user locations.
47 | // For now, we just put it in the same directory as the executable.
48 | const string& basedir = ".";
49 | setBaseDir(basedir);
50 | setConfigFile(basedir + "\\stellarc");
51 | }
52 |
53 | // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
54 | OSystemWin32::~OSystemWin32()
55 | {
56 | }
57 |
58 | // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
59 | uInt32 OSystemWin32::getTicks()
60 | {
61 | //return (uInt32) SDL_GetTicks() * 1000;
62 | return static_cast(GetTickCount() * 1000);
63 | }
64 |
--------------------------------------------------------------------------------
/atari_py/ale_interface/src/os_dependent/OSystemWin32.hxx:
--------------------------------------------------------------------------------
1 | //============================================================================
2 | //
3 | // SSSS tt lll lll
4 | // SS SS tt ll ll
5 | // SS tttttt eeee ll ll aaaa
6 | // SSSS tt ee ee ll ll aa
7 | // SS tt eeeeee ll ll aaaaa -- "An Atari 2600 VCS Emulator"
8 | // SS SS tt ee ll ll aa aa
9 | // SSSS ttt eeeee llll llll aaaaa
10 | //
11 | // Copyright (c) 1995-2007 by Bradford W. Mott and the Stella team
12 | //
13 | // See the file "license" for information on usage and redistribution of
14 | // this file, and for a DISCLAIMER OF ALL WARRANTIES.
15 | //
16 | // $Id: OSystemWin32.hxx,v 1.11 2007/07/19 16:21:39 stephena Exp $
17 | //============================================================================
18 |
19 | #ifndef OSYSTEM_WIN32_HXX
20 | #define OSYSTEM_WIN32_HXX
21 |
22 | #include "../emucore/m6502/src/bspf/src/bspf.hxx"
23 |
24 | /**
25 | This class defines Windows system specific settings.
26 |
27 | @author Stephen Anthony
28 | @version $Id: OSystemWin32.hxx,v 1.11 2007/07/19 16:21:39 stephena Exp $
29 | */
30 | class OSystemWin32 : public OSystem
31 | {
32 | public:
33 | /**
34 | Create a new Win32 operating system object
35 | */
36 | OSystemWin32();
37 |
38 | /**
39 | Destructor
40 | */
41 | virtual ~OSystemWin32();
42 |
43 | public:
44 | /**
45 | This method returns number of ticks in microseconds.
46 |
47 | @return Current time in microseconds.
48 | */
49 | virtual uInt32 getTicks();
50 | };
51 |
52 | #endif
53 |
--------------------------------------------------------------------------------
/atari_py/ale_interface/src/os_dependent/SettingsUNIX.cxx:
--------------------------------------------------------------------------------
1 | //============================================================================
2 | //
3 | // SSSS tt lll lll
4 | // SS SS tt ll ll
5 | // SS tttttt eeee ll ll aaaa
6 | // SSSS tt ee ee ll ll aa
7 | // SS tt eeeeee ll ll aaaaa -- "An Atari 2600 VCS Emulator"
8 | // SS SS tt ee ll ll aa aa
9 | // SSSS ttt eeeee llll llll aaaaa
10 | //
11 | // Copyright (c) 1995-2007 by Bradford W. Mott and the Stella team
12 | //
13 | // See the file "license" for information on usage and redistribution of
14 | // this file, and for a DISCLAIMER OF ALL WARRANTIES.
15 | //
16 | // $Id: SettingsUNIX.cxx,v 1.23 2007/07/27 13:49:16 stephena Exp $
17 | //============================================================================
18 |
19 | #include "bspf.hxx"
20 | #include "Settings.hxx"
21 | #include "SettingsUNIX.hxx"
22 |
23 | // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
24 | SettingsUNIX::SettingsUNIX(OSystem* osystem)
25 | : Settings(osystem)
26 | {
27 | setInternal("gl_lib", "libGL.so");
28 | // Most Linux GL implementations don't support this yet
29 | setInternal("gl_vsync", "false");
30 | }
31 |
32 | // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
33 | SettingsUNIX::~SettingsUNIX()
34 | {
35 | }
36 |
--------------------------------------------------------------------------------
/atari_py/ale_interface/src/os_dependent/SettingsUNIX.hxx:
--------------------------------------------------------------------------------
1 | //============================================================================
2 | //
3 | // SSSS tt lll lll
4 | // SS SS tt ll ll
5 | // SS tttttt eeee ll ll aaaa
6 | // SSSS tt ee ee ll ll aa
7 | // SS tt eeeeee ll ll aaaaa -- "An Atari 2600 VCS Emulator"
8 | // SS SS tt ee ll ll aa aa
9 | // SSSS ttt eeeee llll llll aaaaa
10 | //
11 | // Copyright (c) 1995-2007 by Bradford W. Mott and the Stella team
12 | //
13 | // See the file "license" for information on usage and redistribution of
14 | // this file, and for a DISCLAIMER OF ALL WARRANTIES.
15 | //
16 | // $Id: SettingsUNIX.hxx,v 1.8 2007/01/01 18:04:55 stephena Exp $
17 | //============================================================================
18 |
19 | #ifndef SETTINGS_UNIX_HXX
20 | #define SETTINGS_UNIX_HXX
21 |
22 | class OSystem;
23 |
24 | #include "../emucore/m6502/src/bspf/src/bspf.hxx"
25 |
26 | /**
27 | This class defines UNIX-like OS's (Linux) system specific settings.
28 |
29 | @author Stephen Anthony
30 | @version $Id: SettingsUNIX.hxx,v 1.8 2007/01/01 18:04:55 stephena Exp $
31 | */
32 | class SettingsUNIX : public Settings
33 | {
34 | public:
35 | /**
36 | Create a new UNIX settings object
37 | */
38 | SettingsUNIX(OSystem* osystem);
39 |
40 | /**
41 | Destructor
42 | */
43 | virtual ~SettingsUNIX();
44 | };
45 |
46 | #endif
47 |
--------------------------------------------------------------------------------
/atari_py/ale_interface/src/os_dependent/SettingsWin32.cxx:
--------------------------------------------------------------------------------
1 | //============================================================================
2 | //
3 | // SSSS tt lll lll
4 | // SS SS tt ll ll
5 | // SS tttttt eeee ll ll aaaa
6 | // SSSS tt ee ee ll ll aa
7 | // SS tt eeeeee ll ll aaaaa -- "An Atari 2600 VCS Emulator"
8 | // SS SS tt ee ll ll aa aa
9 | // SSSS ttt eeeee llll llll aaaaa
10 | //
11 | // Copyright (c) 1995-2007 by Bradford W. Mott and the Stella team
12 | //
13 | // See the file "license" for information on usage and redistribution of
14 | // this file, and for a DISCLAIMER OF ALL WARRANTIES.
15 | //
16 | // $Id: SettingsWin32.cxx,v 1.26 2007/01/01 18:04:56 stephena Exp $
17 | //============================================================================
18 |
19 | #include "bspf.hxx"
20 | #include "Settings.hxx"
21 | #include "SettingsWin32.hxx"
22 |
23 | // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
24 | SettingsWin32::SettingsWin32(OSystem* osystem)
25 | : Settings(osystem)
26 | {
27 | // Anything less than this usually causes sound skipping
28 | setInternal("fragsize", "2048");
29 | // Most Windows systems work better without this
30 | setInternal("dirtyrects", "false");
31 | setInternal("romdir", "c:\\");
32 | setInternal("gl_lib", "opengl32.dll");
33 | }
34 |
35 | // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
36 | SettingsWin32::~SettingsWin32()
37 | {
38 | }
39 |
--------------------------------------------------------------------------------
/atari_py/ale_interface/src/os_dependent/SettingsWin32.hxx:
--------------------------------------------------------------------------------
1 | //============================================================================
2 | //
3 | // SSSS tt lll lll
4 | // SS SS tt ll ll
5 | // SS tttttt eeee ll ll aaaa
6 | // SSSS tt ee ee ll ll aa
7 | // SS tt eeeeee ll ll aaaaa -- "An Atari 2600 VCS Emulator"
8 | // SS SS tt ee ll ll aa aa
9 | // SSSS ttt eeeee llll llll aaaaa
10 | //
11 | // Copyright (c) 1995-2007 by Bradford W. Mott and the Stella team
12 | //
13 | // See the file "license" for information on usage and redistribution of
14 | // this file, and for a DISCLAIMER OF ALL WARRANTIES.
15 | //
16 | // $Id: SettingsWin32.hxx,v 1.8 2007/01/01 18:04:56 stephena Exp $
17 | //============================================================================
18 |
19 | #ifndef SETTINGS_WIN32_HXX
20 | #define SETTINGS_WIN32_HXX
21 |
22 | class OSystem;
23 |
24 | #include "../emucore/m6502/src/bspf/src/bspf.hxx"
25 |
26 |
27 | class SettingsWin32 : public Settings
28 | {
29 | public:
30 | /**
31 | Create a new UNIX settings object
32 | */
33 | SettingsWin32(OSystem* osystem);
34 |
35 | /**
36 | Destructor
37 | */
38 | virtual ~SettingsWin32();
39 | };
40 |
41 | #endif
42 |
--------------------------------------------------------------------------------
/atari_py/ale_interface/src/os_dependent/module.mk:
--------------------------------------------------------------------------------
1 | MODULE := src/os_dependent
2 |
3 | MODULE_OBJS := \
4 | src/os_dependent/FSNodePOSIX.o \
5 | src/os_dependent/OSystemUNIX.o \
6 | src/os_dependent/SettingsUNIX.o \
7 |
8 | MODULE_DIRS += \
9 | src/os_dependent
10 |
11 | # Include common rules
12 | include $(srcdir)/common.rules
13 |
--------------------------------------------------------------------------------
/atari_py/ale_interface/stellarc:
--------------------------------------------------------------------------------
1 | cpu=low
2 |
3 |
--------------------------------------------------------------------------------
/atari_py/atari_ntsc_rgb_palette.h:
--------------------------------------------------------------------------------
1 | //taken from Stella in Arcade-Learning-Environment/src/emucore/console.cxx
2 | static const int rgb_palette[256] = {
3 | 0x000000, 0, 0x4a4a4a, 0, 0x6f6f6f, 0, 0x8e8e8e, 0,
4 | 0xaaaaaa, 0, 0xc0c0c0, 0, 0xd6d6d6, 0, 0xececec, 0,
5 | 0x484800, 0, 0x69690f, 0, 0x86861d, 0, 0xa2a22a, 0,
6 | 0xbbbb35, 0, 0xd2d240, 0, 0xe8e84a, 0, 0xfcfc54, 0,
7 | 0x7c2c00, 0, 0x904811, 0, 0xa26221, 0, 0xb47a30, 0,
8 | 0xc3903d, 0, 0xd2a44a, 0, 0xdfb755, 0, 0xecc860, 0,
9 | 0x901c00, 0, 0xa33915, 0, 0xb55328, 0, 0xc66c3a, 0,
10 | 0xd5824a, 0, 0xe39759, 0, 0xf0aa67, 0, 0xfcbc74, 0,
11 | 0x940000, 0, 0xa71a1a, 0, 0xb83232, 0, 0xc84848, 0,
12 | 0xd65c5c, 0, 0xe46f6f, 0, 0xf08080, 0, 0xfc9090, 0,
13 | 0x840064, 0, 0x97197a, 0, 0xa8308f, 0, 0xb846a2, 0,
14 | 0xc659b3, 0, 0xd46cc3, 0, 0xe07cd2, 0, 0xec8ce0, 0,
15 | 0x500084, 0, 0x68199a, 0, 0x7d30ad, 0, 0x9246c0, 0,
16 | 0xa459d0, 0, 0xb56ce0, 0, 0xc57cee, 0, 0xd48cfc, 0,
17 | 0x140090, 0, 0x331aa3, 0, 0x4e32b5, 0, 0x6848c6, 0,
18 | 0x7f5cd5, 0, 0x956fe3, 0, 0xa980f0, 0, 0xbc90fc, 0,
19 | 0x000094, 0, 0x181aa7, 0, 0x2d32b8, 0, 0x4248c8, 0,
20 | 0x545cd6, 0, 0x656fe4, 0, 0x7580f0, 0, 0x8490fc, 0,
21 | 0x001c88, 0, 0x183b9d, 0, 0x2d57b0, 0, 0x4272c2, 0,
22 | 0x548ad2, 0, 0x65a0e1, 0, 0x75b5ef, 0, 0x84c8fc, 0,
23 | 0x003064, 0, 0x185080, 0, 0x2d6d98, 0, 0x4288b0, 0,
24 | 0x54a0c5, 0, 0x65b7d9, 0, 0x75cceb, 0, 0x84e0fc, 0,
25 | 0x004030, 0, 0x18624e, 0, 0x2d8169, 0, 0x429e82, 0,
26 | 0x54b899, 0, 0x65d1ae, 0, 0x75e7c2, 0, 0x84fcd4, 0,
27 | 0x004400, 0, 0x1a661a, 0, 0x328432, 0, 0x48a048, 0,
28 | 0x5cba5c, 0, 0x6fd26f, 0, 0x80e880, 0, 0x90fc90, 0,
29 | 0x143c00, 0, 0x355f18, 0, 0x527e2d, 0, 0x6e9c42, 0,
30 | 0x87b754, 0, 0x9ed065, 0, 0xb4e775, 0, 0xc8fc84, 0,
31 | 0x303800, 0, 0x505916, 0, 0x6d762b, 0, 0x88923e, 0,
32 | 0xa0ab4f, 0, 0xb7c25f, 0, 0xccd86e, 0, 0xe0ec7c, 0,
33 | 0x482c00, 0, 0x694d14, 0, 0x866a26, 0, 0xa28638, 0,
34 | 0xbb9f47, 0, 0xd2b656, 0, 0xe8cc63, 0, 0xfce070, 0
35 | };
36 |
37 |
38 |
--------------------------------------------------------------------------------
/atari_py/atari_roms/air_raid.bin:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/rybskej/atari-py/7c432d43402d46ebb174e319091dde4a687da882/atari_py/atari_roms/air_raid.bin
--------------------------------------------------------------------------------
/atari_py/atari_roms/alien.bin:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/rybskej/atari-py/7c432d43402d46ebb174e319091dde4a687da882/atari_py/atari_roms/alien.bin
--------------------------------------------------------------------------------
/atari_py/atari_roms/amidar.bin:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/rybskej/atari-py/7c432d43402d46ebb174e319091dde4a687da882/atari_py/atari_roms/amidar.bin
--------------------------------------------------------------------------------
/atari_py/atari_roms/assault.bin:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/rybskej/atari-py/7c432d43402d46ebb174e319091dde4a687da882/atari_py/atari_roms/assault.bin
--------------------------------------------------------------------------------
/atari_py/atari_roms/asterix.bin:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/rybskej/atari-py/7c432d43402d46ebb174e319091dde4a687da882/atari_py/atari_roms/asterix.bin
--------------------------------------------------------------------------------
/atari_py/atari_roms/asteroids.bin:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/rybskej/atari-py/7c432d43402d46ebb174e319091dde4a687da882/atari_py/atari_roms/asteroids.bin
--------------------------------------------------------------------------------
/atari_py/atari_roms/atlantis.bin:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/rybskej/atari-py/7c432d43402d46ebb174e319091dde4a687da882/atari_py/atari_roms/atlantis.bin
--------------------------------------------------------------------------------
/atari_py/atari_roms/bank_heist.bin:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/rybskej/atari-py/7c432d43402d46ebb174e319091dde4a687da882/atari_py/atari_roms/bank_heist.bin
--------------------------------------------------------------------------------
/atari_py/atari_roms/battle_zone.bin:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/rybskej/atari-py/7c432d43402d46ebb174e319091dde4a687da882/atari_py/atari_roms/battle_zone.bin
--------------------------------------------------------------------------------
/atari_py/atari_roms/beam_rider.bin:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/rybskej/atari-py/7c432d43402d46ebb174e319091dde4a687da882/atari_py/atari_roms/beam_rider.bin
--------------------------------------------------------------------------------
/atari_py/atari_roms/berzerk.bin:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/rybskej/atari-py/7c432d43402d46ebb174e319091dde4a687da882/atari_py/atari_roms/berzerk.bin
--------------------------------------------------------------------------------
/atari_py/atari_roms/bowling.bin:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/rybskej/atari-py/7c432d43402d46ebb174e319091dde4a687da882/atari_py/atari_roms/bowling.bin
--------------------------------------------------------------------------------
/atari_py/atari_roms/boxing.bin:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/rybskej/atari-py/7c432d43402d46ebb174e319091dde4a687da882/atari_py/atari_roms/boxing.bin
--------------------------------------------------------------------------------
/atari_py/atari_roms/breakout.bin:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/rybskej/atari-py/7c432d43402d46ebb174e319091dde4a687da882/atari_py/atari_roms/breakout.bin
--------------------------------------------------------------------------------
/atari_py/atari_roms/carnival.bin:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/rybskej/atari-py/7c432d43402d46ebb174e319091dde4a687da882/atari_py/atari_roms/carnival.bin
--------------------------------------------------------------------------------
/atari_py/atari_roms/centipede.bin:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/rybskej/atari-py/7c432d43402d46ebb174e319091dde4a687da882/atari_py/atari_roms/centipede.bin
--------------------------------------------------------------------------------
/atari_py/atari_roms/chopper_command.bin:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/rybskej/atari-py/7c432d43402d46ebb174e319091dde4a687da882/atari_py/atari_roms/chopper_command.bin
--------------------------------------------------------------------------------
/atari_py/atari_roms/crazy_climber.bin:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/rybskej/atari-py/7c432d43402d46ebb174e319091dde4a687da882/atari_py/atari_roms/crazy_climber.bin
--------------------------------------------------------------------------------
/atari_py/atari_roms/defender.bin:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/rybskej/atari-py/7c432d43402d46ebb174e319091dde4a687da882/atari_py/atari_roms/defender.bin
--------------------------------------------------------------------------------
/atari_py/atari_roms/demon_attack.bin:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/rybskej/atari-py/7c432d43402d46ebb174e319091dde4a687da882/atari_py/atari_roms/demon_attack.bin
--------------------------------------------------------------------------------
/atari_py/atari_roms/double_dunk.bin:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/rybskej/atari-py/7c432d43402d46ebb174e319091dde4a687da882/atari_py/atari_roms/double_dunk.bin
--------------------------------------------------------------------------------
/atari_py/atari_roms/elevator_action.bin:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/rybskej/atari-py/7c432d43402d46ebb174e319091dde4a687da882/atari_py/atari_roms/elevator_action.bin
--------------------------------------------------------------------------------
/atari_py/atari_roms/enduro.bin:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/rybskej/atari-py/7c432d43402d46ebb174e319091dde4a687da882/atari_py/atari_roms/enduro.bin
--------------------------------------------------------------------------------
/atari_py/atari_roms/fishing_derby.bin:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/rybskej/atari-py/7c432d43402d46ebb174e319091dde4a687da882/atari_py/atari_roms/fishing_derby.bin
--------------------------------------------------------------------------------
/atari_py/atari_roms/freeway.bin:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/rybskej/atari-py/7c432d43402d46ebb174e319091dde4a687da882/atari_py/atari_roms/freeway.bin
--------------------------------------------------------------------------------
/atari_py/atari_roms/frostbite.bin:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/rybskej/atari-py/7c432d43402d46ebb174e319091dde4a687da882/atari_py/atari_roms/frostbite.bin
--------------------------------------------------------------------------------
/atari_py/atari_roms/gopher.bin:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/rybskej/atari-py/7c432d43402d46ebb174e319091dde4a687da882/atari_py/atari_roms/gopher.bin
--------------------------------------------------------------------------------
/atari_py/atari_roms/gravitar.bin:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/rybskej/atari-py/7c432d43402d46ebb174e319091dde4a687da882/atari_py/atari_roms/gravitar.bin
--------------------------------------------------------------------------------
/atari_py/atari_roms/ice_hockey.bin:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/rybskej/atari-py/7c432d43402d46ebb174e319091dde4a687da882/atari_py/atari_roms/ice_hockey.bin
--------------------------------------------------------------------------------
/atari_py/atari_roms/jamesbond.bin:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/rybskej/atari-py/7c432d43402d46ebb174e319091dde4a687da882/atari_py/atari_roms/jamesbond.bin
--------------------------------------------------------------------------------
/atari_py/atari_roms/journey_escape.bin:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/rybskej/atari-py/7c432d43402d46ebb174e319091dde4a687da882/atari_py/atari_roms/journey_escape.bin
--------------------------------------------------------------------------------
/atari_py/atari_roms/kangaroo.bin:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/rybskej/atari-py/7c432d43402d46ebb174e319091dde4a687da882/atari_py/atari_roms/kangaroo.bin
--------------------------------------------------------------------------------
/atari_py/atari_roms/krull.bin:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/rybskej/atari-py/7c432d43402d46ebb174e319091dde4a687da882/atari_py/atari_roms/krull.bin
--------------------------------------------------------------------------------
/atari_py/atari_roms/kung_fu_master.bin:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/rybskej/atari-py/7c432d43402d46ebb174e319091dde4a687da882/atari_py/atari_roms/kung_fu_master.bin
--------------------------------------------------------------------------------
/atari_py/atari_roms/montezuma_revenge.bin:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/rybskej/atari-py/7c432d43402d46ebb174e319091dde4a687da882/atari_py/atari_roms/montezuma_revenge.bin
--------------------------------------------------------------------------------
/atari_py/atari_roms/ms_pacman.bin:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/rybskej/atari-py/7c432d43402d46ebb174e319091dde4a687da882/atari_py/atari_roms/ms_pacman.bin
--------------------------------------------------------------------------------
/atari_py/atari_roms/name_this_game.bin:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/rybskej/atari-py/7c432d43402d46ebb174e319091dde4a687da882/atari_py/atari_roms/name_this_game.bin
--------------------------------------------------------------------------------
/atari_py/atari_roms/phoenix.bin:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/rybskej/atari-py/7c432d43402d46ebb174e319091dde4a687da882/atari_py/atari_roms/phoenix.bin
--------------------------------------------------------------------------------
/atari_py/atari_roms/pitfall.bin:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/rybskej/atari-py/7c432d43402d46ebb174e319091dde4a687da882/atari_py/atari_roms/pitfall.bin
--------------------------------------------------------------------------------
/atari_py/atari_roms/pong.bin:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/rybskej/atari-py/7c432d43402d46ebb174e319091dde4a687da882/atari_py/atari_roms/pong.bin
--------------------------------------------------------------------------------
/atari_py/atari_roms/pooyan.bin:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/rybskej/atari-py/7c432d43402d46ebb174e319091dde4a687da882/atari_py/atari_roms/pooyan.bin
--------------------------------------------------------------------------------
/atari_py/atari_roms/private_eye.bin:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/rybskej/atari-py/7c432d43402d46ebb174e319091dde4a687da882/atari_py/atari_roms/private_eye.bin
--------------------------------------------------------------------------------
/atari_py/atari_roms/qbert.bin:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/rybskej/atari-py/7c432d43402d46ebb174e319091dde4a687da882/atari_py/atari_roms/qbert.bin
--------------------------------------------------------------------------------
/atari_py/atari_roms/riverraid.bin:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/rybskej/atari-py/7c432d43402d46ebb174e319091dde4a687da882/atari_py/atari_roms/riverraid.bin
--------------------------------------------------------------------------------
/atari_py/atari_roms/road_runner.bin:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/rybskej/atari-py/7c432d43402d46ebb174e319091dde4a687da882/atari_py/atari_roms/road_runner.bin
--------------------------------------------------------------------------------
/atari_py/atari_roms/robotank.bin:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/rybskej/atari-py/7c432d43402d46ebb174e319091dde4a687da882/atari_py/atari_roms/robotank.bin
--------------------------------------------------------------------------------
/atari_py/atari_roms/seaquest.bin:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/rybskej/atari-py/7c432d43402d46ebb174e319091dde4a687da882/atari_py/atari_roms/seaquest.bin
--------------------------------------------------------------------------------
/atari_py/atari_roms/skiing.bin:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/rybskej/atari-py/7c432d43402d46ebb174e319091dde4a687da882/atari_py/atari_roms/skiing.bin
--------------------------------------------------------------------------------
/atari_py/atari_roms/solaris.bin:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/rybskej/atari-py/7c432d43402d46ebb174e319091dde4a687da882/atari_py/atari_roms/solaris.bin
--------------------------------------------------------------------------------
/atari_py/atari_roms/space_invaders.bin:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/rybskej/atari-py/7c432d43402d46ebb174e319091dde4a687da882/atari_py/atari_roms/space_invaders.bin
--------------------------------------------------------------------------------
/atari_py/atari_roms/star_gunner.bin:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/rybskej/atari-py/7c432d43402d46ebb174e319091dde4a687da882/atari_py/atari_roms/star_gunner.bin
--------------------------------------------------------------------------------
/atari_py/atari_roms/tennis.bin:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/rybskej/atari-py/7c432d43402d46ebb174e319091dde4a687da882/atari_py/atari_roms/tennis.bin
--------------------------------------------------------------------------------
/atari_py/atari_roms/time_pilot.bin:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/rybskej/atari-py/7c432d43402d46ebb174e319091dde4a687da882/atari_py/atari_roms/time_pilot.bin
--------------------------------------------------------------------------------
/atari_py/atari_roms/tutankham.bin:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/rybskej/atari-py/7c432d43402d46ebb174e319091dde4a687da882/atari_py/atari_roms/tutankham.bin
--------------------------------------------------------------------------------
/atari_py/atari_roms/up_n_down.bin:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/rybskej/atari-py/7c432d43402d46ebb174e319091dde4a687da882/atari_py/atari_roms/up_n_down.bin
--------------------------------------------------------------------------------
/atari_py/atari_roms/venture.bin:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/rybskej/atari-py/7c432d43402d46ebb174e319091dde4a687da882/atari_py/atari_roms/venture.bin
--------------------------------------------------------------------------------
/atari_py/atari_roms/video_pinball.bin:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/rybskej/atari-py/7c432d43402d46ebb174e319091dde4a687da882/atari_py/atari_roms/video_pinball.bin
--------------------------------------------------------------------------------
/atari_py/atari_roms/wizard_of_wor.bin:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/rybskej/atari-py/7c432d43402d46ebb174e319091dde4a687da882/atari_py/atari_roms/wizard_of_wor.bin
--------------------------------------------------------------------------------
/atari_py/atari_roms/yars_revenge.bin:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/rybskej/atari-py/7c432d43402d46ebb174e319091dde4a687da882/atari_py/atari_roms/yars_revenge.bin
--------------------------------------------------------------------------------
/atari_py/atari_roms/zaxxon.bin:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/rybskej/atari-py/7c432d43402d46ebb174e319091dde4a687da882/atari_py/atari_roms/zaxxon.bin
--------------------------------------------------------------------------------
/atari_py/tests/test_smoke.py:
--------------------------------------------------------------------------------
1 | import atari_py
2 | import numpy as np
3 |
4 | def test_smoke():
5 | pong_path = atari_py.get_game_path('pong')
6 | ale = atari_py.ALEInterface()
7 | ale.loadROM(pong_path)
8 | action_set = ale.getMinimalActionSet()
9 |
10 | # Test stepping
11 | ale.act(action_set[0])
12 |
13 | # Test screen capture
14 | (screen_width,screen_height) = ale.getScreenDims()
15 | arr = np.zeros((screen_height, screen_width, 4), dtype=np.uint8)
16 | ale.getScreenRGB(arr)
17 |
--------------------------------------------------------------------------------
/doc/examples/Makefile:
--------------------------------------------------------------------------------
1 | # We do not automatically build the recording agent, which requires SDL. To build it, run
2 | #
3 | # > make recordingAgent
4 | all: sharedLibraryAgent rlglueAgent fifoAgent
5 |
6 | sharedLibraryAgent:
7 | make -f Makefile.sharedlibrary
8 |
9 | rlglueAgent:
10 | make -f Makefile.rlglue
11 |
12 | fifoAgent:
13 | make -f Makefile.fifo
14 |
15 | recordingAgent:
16 | make -f Makefile.recording
17 |
18 | clean:
19 | make -f Makefile.rlglue clean
20 | make -f Makefile.sharedlibrary clean
21 | make -f Makefile.fifo clean
22 | make -f Makefile.recording clean
23 |
--------------------------------------------------------------------------------
/doc/examples/Makefile.fifo:
--------------------------------------------------------------------------------
1 | # Modified from the sharedLibraryInterfaceExample's makefile.
2 |
3 | USE_SDL := 0
4 |
5 | # This will likely need to be changed to suit your installation.
6 | ALE := ../..
7 |
8 | FLAGS := -I$(ALE)/src -I$(ALE)/src/controllers -I$(ALE)/src/os_dependent -I$(ALE)/src/environment -I$(ALE)/src/external -L$(ALE)
9 | CXX := g++
10 | FILE := fifoInterfaceExample
11 | LDFLAGS := -lale -lz
12 |
13 | UNAME_S := $(shell uname -s)
14 | ifeq ($(UNAME_S),Linux)
15 | FLAGS += -Wl,-rpath=$(ALE)
16 | endif
17 | ifeq ($(UNAME_S),Darwin)
18 | FLAGS += -framework Cocoa
19 | endif
20 |
21 | ifeq ($(strip $(USE_SDL)), 1)
22 | DEFINES += -D__USE_SDL -DSOUND_SUPPORT
23 | FLAGS += $(shell sdl-config --cflags)
24 | LDFLAGS += $(shell sdl-config --libs)
25 | endif
26 |
27 | all: fifoInterfaceExample
28 |
29 | fifoInterfaceExample:
30 | $(CXX) $(DEFINES) $(FLAGS) $(FILE).cpp $(LDFLAGS) -o $(FILE)
31 |
32 | clean:
33 | rm -rf fifoInterfaceExample *.o
34 |
--------------------------------------------------------------------------------
/doc/examples/Makefile.recording:
--------------------------------------------------------------------------------
1 | # Modified from the sharedLibraryInterface's makefile.
2 | # Video recording requires SDL. If you do not have SDL installed, you will not be able to
3 | # compile this example.
4 | #
5 | # > make recordingAgent
6 |
7 | USE_SDL := 1
8 |
9 | # This will likely need to be changed to suit your installation.
10 | ALE := ../..
11 |
12 | FLAGS := -I$(ALE)/src -I$(ALE)/src/controllers -I$(ALE)/src/os_dependent -I$(ALE)/src/environment -I$(ALE)/src/external -L$(ALE)
13 | CXX := g++
14 | FILE := videoRecordingExample
15 | LDFLAGS := -lale -lz
16 |
17 | UNAME_S := $(shell uname -s)
18 | ifeq ($(UNAME_S),Linux)
19 | FLAGS += -Wl,-rpath=$(ALE)
20 | endif
21 | ifeq ($(UNAME_S),Darwin)
22 | FLAGS += -framework Cocoa
23 | endif
24 |
25 | ifeq ($(strip $(USE_SDL)), 1)
26 | DEFINES += -D__USE_SDL -DSOUND_SUPPORT
27 | FLAGS += $(shell sdl-config --cflags)
28 | LDFLAGS += $(shell sdl-config --libs)
29 | endif
30 |
31 | all: videoRecordingExample
32 |
33 | videoRecordingExample:
34 | $(CXX) $(DEFINES) $(FLAGS) $(FILE).cpp $(LDFLAGS) -o $(FILE)
35 |
36 | clean:
37 | rm -rf videoRecordingExample *.o
38 |
--------------------------------------------------------------------------------
/doc/examples/Makefile.rlglue:
--------------------------------------------------------------------------------
1 | # Modified from the C/C++ RL-Glue codec RLGlueAgent's makefile.
2 |
3 | AGENTLDFLAGS := -lrlutils -lrlagent -lrlgluenetdev
4 | EXPLDFLAGS := -lrlutils -lrlexperiment -lrlgluenetdev
5 | CFLAGS := -Wall -pedantic
6 |
7 | all: RLGlueAgent RLGlueExperiment
8 |
9 | RLGlueAgent: RLGlueAgent.o
10 | $(CC) RLGlueAgent.o $(AGENTLDFLAGS) -o RLGlueAgent
11 | RLGlueExperiment: RLGlueExperiment.o
12 | $(CC) RLGlueExperiment.o $(EXPLDFLAGS) -o RLGlueExperiment
13 |
14 | %.o: %.c
15 | $(CC) $(CFLAGS) -c $<
16 |
17 | clean:
18 | rm -rf RLGlueAgent RLGlueExperiment *.o
19 |
20 |
--------------------------------------------------------------------------------
/doc/examples/Makefile.sharedlibrary:
--------------------------------------------------------------------------------
1 | USE_SDL := 0
2 |
3 | # This will likely need to be changed to suit your installation.
4 | ALE := ../..
5 |
6 | FLAGS := -I$(ALE)/src -I$(ALE)/src/controllers -I$(ALE)/src/os_dependent -I$(ALE)/src/environment -I$(ALE)/src/external -L$(ALE)
7 | CXX := g++
8 | FILE := sharedLibraryInterfaceExample
9 | LDFLAGS := -lale -lz
10 |
11 | UNAME_S := $(shell uname -s)
12 | ifeq ($(UNAME_S),Linux)
13 | FLAGS += -Wl,-rpath=$(ALE)
14 | endif
15 | ifeq ($(UNAME_S),Darwin)
16 | FLAGS += -framework Cocoa
17 | endif
18 |
19 | ifeq ($(strip $(USE_SDL)), 1)
20 | DEFINES += -D__USE_SDL -DSOUND_SUPPORT
21 | FLAGS += $(shell sdl-config --cflags)
22 | LDFLAGS += $(shell sdl-config --libs)
23 | endif
24 |
25 | all: sharedLibraryInterfaceExample
26 |
27 | sharedLibraryInterfaceExample:
28 | $(CXX) $(DEFINES) $(FLAGS) $(FILE).cpp $(LDFLAGS) -o $(FILE)
29 |
30 | clean:
31 | rm -rf sharedLibraryInterfaceExample *.o
32 |
--------------------------------------------------------------------------------
/doc/examples/python_example.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env python
2 | # python_example.py
3 | # Author: Ben Goodrich
4 | #
5 | # This is a direct port to python of the shared library example from
6 | # ALE provided in doc/examples/sharedLibraryInterfaceExample.cpp
7 | import sys
8 | from random import randrange
9 | from ale_python_interface import ALEInterface
10 |
11 | if len(sys.argv) < 2:
12 | print 'Usage:', sys.argv[0], 'rom_file'
13 | sys.exit()
14 |
15 | ale = ALEInterface()
16 |
17 | # Get & Set the desired settings
18 | ale.setInt('random_seed', 123)
19 |
20 | # Set USE_SDL to true to display the screen. ALE must be compilied
21 | # with SDL enabled for this to work. On OSX, pygame init is used to
22 | # proxy-call SDL_main.
23 | USE_SDL = False
24 | if USE_SDL:
25 | if sys.platform == 'darwin':
26 | import pygame
27 | pygame.init()
28 | ale.setBool('sound', False) # Sound doesn't work on OSX
29 | elif sys.platform.startswith('linux'):
30 | ale.setBool('sound', True)
31 | ale.setBool('display_screen', True)
32 |
33 | # Load the ROM file
34 | ale.loadROM(sys.argv[1])
35 |
36 | # Get the list of legal actions
37 | legal_actions = ale.getLegalActionSet()
38 |
39 | # Play 10 episodes
40 | for episode in xrange(10):
41 | total_reward = 0
42 | while not ale.game_over():
43 | a = legal_actions[randrange(len(legal_actions))]
44 | # Apply an action and get the resulting reward
45 | reward = ale.act(a);
46 | total_reward += reward
47 | print 'Episode', episode, 'ended with score:', total_reward
48 | ale.reset_game()
49 |
--------------------------------------------------------------------------------
/doc/examples/sharedLibraryInterfaceExample.cpp:
--------------------------------------------------------------------------------
1 | /* *****************************************************************************
2 | * A.L.E (Arcade Learning Environment)
3 | * Copyright (c) 2009-2013 by Yavar Naddaf, Joel Veness, Marc G. Bellemare,
4 | * Matthew Hausknecht, and the Reinforcement Learning and Artificial Intelligence
5 | * Laboratory
6 | * Released under the GNU General Public License; see License.txt for details.
7 | *
8 | * Based on: Stella -- "An Atari 2600 VCS Emulator"
9 | * Copyright (c) 1995-2007 by Bradford W. Mott and the Stella team
10 | *
11 | * *****************************************************************************
12 | * sharedLibraryInterfaceExample.cpp
13 | *
14 | * Sample code for running an agent with the shared library interface.
15 | **************************************************************************** */
16 |
17 | #include
18 | #include
19 |
20 | #ifdef __USE_SDL
21 | #include
22 | #endif
23 |
24 | using namespace std;
25 |
26 | int main(int argc, char** argv) {
27 | if (argc < 2) {
28 | std::cerr << "Usage: " << argv[0] << " rom_file" << std::endl;
29 | return 1;
30 | }
31 |
32 | ALEInterface ale;
33 |
34 | // Get & Set the desired settings
35 | ale.setInt("random_seed", 123);
36 | //The default is already 0.25, this is just an example
37 | ale.setFloat("repeat_action_probability", 0.25);
38 |
39 | #ifdef __USE_SDL
40 | ale.setBool("display_screen", true);
41 | ale.setBool("sound", true);
42 | #endif
43 |
44 | // Load the ROM file. (Also resets the system for new settings to
45 | // take effect.)
46 | ale.loadROM(argv[1]);
47 |
48 | // Get the vector of legal actions
49 | ActionVect legal_actions = ale.getLegalActionSet();
50 |
51 | // Play 10 episodes
52 | for (int episode=0; episode<10; episode++) {
53 | float totalReward = 0;
54 | while (!ale.game_over()) {
55 | Action a = legal_actions[rand() % legal_actions.size()];
56 | // Apply the action and get the resulting reward
57 | float reward = ale.act(a);
58 | totalReward += reward;
59 | }
60 | cout << "Episode " << episode << " ended with score: " << totalReward << endl;
61 | ale.reset_game();
62 | }
63 |
64 | return 0;
65 | }
66 |
--------------------------------------------------------------------------------
/doc/java-agent/code/manifest.mf:
--------------------------------------------------------------------------------
1 | Manifest-Version: 1.0
2 | X-COMMENT: Main-Class will be added automatically by build
3 |
4 |
--------------------------------------------------------------------------------
/doc/java-agent/code/nbproject/configs/Human.properties:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/rybskej/atari-py/7c432d43402d46ebb174e319091dde4a687da882/doc/java-agent/code/nbproject/configs/Human.properties
--------------------------------------------------------------------------------
/doc/java-agent/code/nbproject/configs/RL.properties:
--------------------------------------------------------------------------------
1 | main.class=ale.agents.RLAgent
2 |
--------------------------------------------------------------------------------
/doc/java-agent/code/nbproject/genfiles.properties:
--------------------------------------------------------------------------------
1 | build.xml.data.CRC32=d952cf82
2 | build.xml.script.CRC32=a7335e3d
3 | build.xml.stylesheet.CRC32=28e38971@1.38.3.45
4 | # This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml.
5 | # Do not edit this file. You may delete it but then the IDE will never regenerate such files for you.
6 | nbproject/build-impl.xml.data.CRC32=d952cf82
7 | nbproject/build-impl.xml.script.CRC32=38f45e83
8 | nbproject/build-impl.xml.stylesheet.CRC32=229523de@1.38.3.45
9 | nbproject/profiler-build-impl.xml.data.CRC32=d952cf82
10 | nbproject/profiler-build-impl.xml.script.CRC32=abda56ed
11 | nbproject/profiler-build-impl.xml.stylesheet.CRC32=f10cf54c@1.11.1
12 |
--------------------------------------------------------------------------------
/doc/java-agent/code/nbproject/project.properties:
--------------------------------------------------------------------------------
1 | annotation.processing.enabled=true
2 | annotation.processing.enabled.in.editor=false
3 | annotation.processing.run.all.processors=true
4 | annotation.processing.source.output=${build.generated.sources.dir}/ap-source-output
5 | application.title=ALEJavaAgent
6 | application.vendor=Marc G. Bellemare
7 | build.classes.dir=${build.dir}/classes
8 | build.classes.excludes=**/*.java,**/*.form
9 | # This directory is removed when the project is cleaned:
10 | build.dir=build
11 | build.generated.dir=${build.dir}/generated
12 | build.generated.sources.dir=${build.dir}/generated-sources
13 | # Only compile against the classpath explicitly listed here:
14 | build.sysclasspath=ignore
15 | build.test.classes.dir=${build.dir}/test/classes
16 | build.test.results.dir=${build.dir}/test/results
17 | # Uncomment to specify the preferred debugger connection transport:
18 | #debug.transport=dt_socket
19 | debug.classpath=\
20 | ${run.classpath}
21 | debug.test.classpath=\
22 | ${run.test.classpath}
23 | # This directory is removed when the project is cleaned:
24 | dist.dir=dist
25 | dist.jar=${dist.dir}/ALEJavaAgent.jar
26 | dist.javadoc.dir=${dist.dir}/javadoc
27 | endorsed.classpath=
28 | excludes=
29 | includes=**
30 | jar.compress=false
31 | javac.classpath=
32 | # Space-separated list of extra javac options
33 | javac.compilerargs=
34 | javac.deprecation=false
35 | javac.processorpath=\
36 | ${javac.classpath}
37 | javac.source=1.5
38 | javac.target=1.5
39 | javac.test.classpath=\
40 | ${javac.classpath}:\
41 | ${build.classes.dir}:\
42 | ${libs.junit.classpath}:\
43 | ${libs.junit_4.classpath}
44 | javac.test.processorpath=\
45 | ${javac.test.classpath}
46 | javadoc.additionalparam=
47 | javadoc.author=false
48 | javadoc.encoding=${source.encoding}
49 | javadoc.noindex=false
50 | javadoc.nonavbar=false
51 | javadoc.notree=false
52 | javadoc.private=false
53 | javadoc.splitindex=true
54 | javadoc.use=true
55 | javadoc.version=false
56 | javadoc.windowtitle=
57 | main.class=ale.agents.HumanAgent
58 | manifest.file=manifest.mf
59 | meta.inf.dir=${src.dir}/META-INF
60 | platform.active=default_platform
61 | run.classpath=\
62 | ${javac.classpath}:\
63 | ${build.classes.dir}
64 | # Space-separated list of JVM arguments used when running the project
65 | # (you may also define separate properties like run-sys-prop.name=value instead of -Dname=value
66 | # or test-sys-prop.name=value to set system properties for unit tests):
67 | run.jvmargs=
68 | run.test.classpath=\
69 | ${javac.test.classpath}:\
70 | ${build.test.classes.dir}
71 | source.encoding=UTF-8
72 | src.dir=src
73 | test.src.dir=test
74 |
--------------------------------------------------------------------------------
/doc/java-agent/code/nbproject/project.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | org.netbeans.modules.java.j2seproject
4 |
5 |
6 | ALEJavaAgent
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
--------------------------------------------------------------------------------
/doc/java-agent/manual/Makefile:
--------------------------------------------------------------------------------
1 | FILE=java-agent
2 |
3 | all: $(FILE).pdf
4 |
5 | %.pdf: $(FILE).tex
6 | pdflatex $(FILE).tex
7 | pdflatex $(FILE).tex
8 |
9 | clean:
10 | rm -f *.{aux,log}
11 |
--------------------------------------------------------------------------------
/doc/java-agent/manual/java-agent.pdf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/rybskej/atari-py/7c432d43402d46ebb174e319091dde4a687da882/doc/java-agent/manual/java-agent.pdf
--------------------------------------------------------------------------------
/doc/manual/Makefile:
--------------------------------------------------------------------------------
1 | FILE=manual
2 |
3 | all: $(FILE).pdf
4 |
5 | %.pdf: $(FILE).tex
6 | pdflatex $(FILE).tex
7 | pdflatex $(FILE).tex
8 | pdflatex $(FILE).tex
9 |
10 | clean:
11 | rm -f *.{aux,log,toc,out}
12 |
--------------------------------------------------------------------------------
/doc/manual/figures/ale.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/rybskej/atari-py/7c432d43402d46ebb174e319091dde4a687da882/doc/manual/figures/ale.gif
--------------------------------------------------------------------------------
/doc/manual/manual.pdf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/rybskej/atari-py/7c432d43402d46ebb174e319091dde4a687da882/doc/manual/manual.pdf
--------------------------------------------------------------------------------
/doc/scripts/videoRecordingExampleJoinMacOSX.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 | # A script to generate an ALE video with FFMpeg, Mac OS X.
3 |
4 | # -r ## specifies the frame rate
5 | # -i record/%06d.png indicates we should use sequentially numbered frames in directory 'record'
6 | # -i sound.wav indicates the location of the sound file
7 | # -f mov specifies a MOV format
8 | # -c:a mp3 specifies the sound codec
9 | # -c:v libx264 specifies the video codec
10 | # -pix_fmt yuv420p is needed on Mac OS X for playback with QuickTime Player
11 | #
12 | ffmpeg -r 60 -i record/%06d.png -i record/sound.wav -f mov -c:a mp3 -c:v libx264 -pix_fmt yuv420p agent.mov
13 |
--------------------------------------------------------------------------------
/doc/scripts/videoRecordingExampleJoinUnix.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 | # A script to generate an ALE video with FFMpeg, *nix systems.
3 |
4 | # -r ## specifies the frame rate
5 | # -i record/%06d.png indicates we should use sequentially numbered frames in directory 'record'
6 | # -i sound.wav indicates the location of the sound file
7 | # -f mov specifies a MOV format
8 | # -c:a mp3 specifies the sound codec
9 | # -c:v libx264 specifies the video codec
10 | #
11 |
12 |
13 | # Attempt to use ffmpeg. If this fails, use avconv (fix for Ubuntu 14.04).
14 | {
15 | ffmpeg -r 60 -i record/%06d.png -i record/sound.wav -f mov -c:a mp3 -c:v libx264 agent.mov
16 | } || {
17 | avconv -r 60 -i record/%06d.png -i record/sound.wav -f mov -c:a mp3 -c:v libx264 agent.mov
18 | }
19 |
20 |
--------------------------------------------------------------------------------
/setup.py:
--------------------------------------------------------------------------------
1 | import multiprocessing
2 | import os
3 | from setuptools import setup
4 | import subprocess
5 | import sys
6 | from distutils.command.build import build as DistutilsBuild
7 |
8 | with open(os.path.join(os.path.dirname(__file__), 'atari_py/package_data.txt')) as f:
9 | package_data = [line.rstrip() for line in f.readlines()]
10 |
11 | class Build(DistutilsBuild):
12 | def run(self):
13 | cores_to_use = max(1, multiprocessing.cpu_count() - 1)
14 | cmd = ['make', 'build', '-C', 'atari_py/ale_interface', '-j', str(cores_to_use)]
15 | try:
16 | subprocess.check_call(cmd)
17 | except subprocess.CalledProcessError as e:
18 | sys.stderr.write("Could not build atari-py: %s. (HINT: are you sure cmake is installed? You might also be missing a library. Atari-py requires: zlib [installable as 'apt-get install zlib1g-dev' on Ubuntu].)\n" % e)
19 | raise
20 | except OSError as e:
21 | sys.stderr.write("Unable to execute '{}'. HINT: are you sure `make` is installed?\n".format(' '.join(cmd)))
22 | raise
23 | DistutilsBuild.run(self)
24 |
25 | setup(name='atari-py',
26 | version='0.0.18',
27 | description='Python bindings to Atari games',
28 | url='https://github.com/openai/atari-py',
29 | author='OpenAI',
30 | author_email='info@openai.com',
31 | license='',
32 | packages=['atari_py'],
33 | package_data={'atari_py': package_data},
34 | cmdclass={'build': Build},
35 | install_requires=['numpy', 'six'],
36 | tests_require=['nose2']
37 | )
38 |
--------------------------------------------------------------------------------
/tox.ini:
--------------------------------------------------------------------------------
1 | # Tox (http://tox.testrun.org/) is a tool for running tests
2 | # in multiple virtualenvs. This configuration file will run the
3 | # test suite on all supported python versions. To use it, "pip install tox"
4 | # and then run "tox" from this directory.
5 |
6 | [tox]
7 | envlist = py27, py35
8 |
9 | [testenv:py35]
10 | whitelist_externals=make
11 | echo
12 | install_command=echo {packages}
13 | commands =
14 | pip install numpy nose2
15 | make
16 | python setup.py build
17 | pip install -e .
18 | nose2
19 | python setup.py clean --all
20 | make clean
21 |
22 | [testenv:py27]
23 | whitelist_externals=make
24 | echo
25 | install_command=echo {packages}
26 | commands =
27 | pip install numpy nose2
28 | python setup.py build
29 | pip install -e .
30 | nose2
31 | python setup.py clean --all
32 | make clean
33 |
--------------------------------------------------------------------------------