bbitmaster / ale_python_interface Goto Github PK
View Code? Open in Web Editor NEWA Python Interface for the Arcade Learning Environment (Shared Object)
License: GNU General Public License v2.0
A Python Interface for the Arcade Learning Environment (Shared Object)
License: GNU General Public License v2.0
envy@ub1404:/os_pri/github/ale_python_interface$ gcc --version14.04.3) 4.8.4
gcc (Ubuntu 4.8.4-2ubuntu1
Copyright (C) 2013 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
envy@ub1404:/os_pri/github/ale_python_interface$ python setup.py build/os_pri/github/ale_python_interface$
running build
running build_py
running build_ext
building 'ale_python_interface.ale_c_wrapper' extension
x86_64-linux-gnu-gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -I/usr/include/python2.7 -c ale_python_interface/ale_c_wrapper.cpp -o build/temp.linux-x86_64-2.7/ale_python_interface/ale_c_wrapper.o
cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++ [enabled by default]
In file included from ale_python_interface/ale_c_wrapper.cpp:2:0:
ale_python_interface/ale_c_wrapper.h: In function ‘void setString(ALEInterface_, const char_, const char_)’:
ale_python_interface/ale_c_wrapper.h:19:78: error: ‘class ALEInterface’ has no member named ‘set’
void setString(ALEInterface *ale,const char *key,const char *value){ale->set(key,value);}
^
ale_python_interface/ale_c_wrapper.h: In function ‘void setInt(ALEInterface_, const char_, int)’:
ale_python_interface/ale_c_wrapper.h:20:67: error: ‘class ALEInterface’ has no member named ‘set’
void setInt(ALEInterface *ale,const char *key,int value){ale->set(key,value);}
^
ale_python_interface/ale_c_wrapper.h: In function ‘void setBool(ALEInterface_, const char_, bool)’:
ale_python_interface/ale_c_wrapper.h:21:69: error: ‘class ALEInterface’ has no member named ‘set’
void setBool(ALEInterface *ale,const char *key,bool value){ale->set(key,value);}
^
ale_python_interface/ale_c_wrapper.h: In function ‘void setFloat(ALEInterface_, const char_, float)’:
ale_python_interface/ale_c_wrapper.h:22:71: error: ‘class ALEInterface’ has no member named ‘set’
void setFloat(ALEInterface *ale,const char *key,float value){ale->set(key,value);}
^
ale_python_interface/ale_c_wrapper.h: In function ‘void getLegalActionSet(ALEInterface_, int_)’:
ale_python_interface/ale_c_wrapper.h:30:57: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
for(int i = 0;i < ale->getLegalActionSet().size();i++){
^
ale_python_interface/ale_c_wrapper.h:29:19: warning: unused variable ‘sz’ [-Wunused-variable]
const int sz = (int)ale->getLegalActionSet().size();
^
ale_python_interface/ale_c_wrapper.h: In function ‘void getMinimalActionSet(ALEInterface_, int_)’:
ale_python_interface/ale_c_wrapper.h:40:59: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
for(int i = 0;i < ale->getMinimalActionSet().size();i++){
^
ale_python_interface/ale_c_wrapper.h:39:19: warning: unused variable ‘sz’ [-Wunused-variable]
const int sz = (int)ale->getMinimalActionSet().size();
^
ale_python_interface/ale_c_wrapper.h: In function ‘int getScreen(ALEInterface_, unsigned char_)’:
ale_python_interface/ale_c_wrapper.h:56:5: warning: no return statement in function returning non-void [-Wreturn-type]
}
^
ale_python_interface/ale_c_wrapper.h: In function ‘int getScreenRGB(ALEInterface_, int_)’:
ale_python_interface/ale_c_wrapper.h:65:5: warning: no return statement in function returning non-void [-Wreturn-type]
}
^
ale_python_interface/ale_c_wrapper.h: In function ‘void set(ALEInterface_, const char_, const char_)’:
ale_python_interface/ale_c_wrapper.h:79:71: error: ‘class ALEInterface’ has no member named ‘set’
void set(ALEInterface _ale,const char *key,const char_value){ale->set(key,value);}
^
error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
envy@ub1404:
./ale_python_test2.py space_invaders.bin
A.L.E: Arcade Learning Environment (version 0.5.1)
[Powered by Stella]
Use -help for help screen.
Warning: couldn't load settings file: ./ale.cfg
Traceback (most recent call last):
File "./ale_python_test2.py", line 19, in
ale.set("random_seed",123)
AttributeError: 'ALEInterface' object has no attribute 'set'
It would be amazing if it was possible to run this on a Windows machine.
I have done the following steps:
1.)git clone https://github.com/mgbellemare/Arcade-Learning-Environment.git
cd Arcade-Learning-Environment
cp makefile.unix makefile
make
2.)export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:<PATH-TO_ARCADE-LEARNING-ENVIRONMENT>/
export LIBRARY_PATH=$LIBRARY_PATH:<PATH-TO_ARCADE-LEARNING-ENVIRONMENT>/
export CPLUS_INCLUDE_PATH=$CPLUS_INCLUDE_PATH:<PATH-TO_ARCADE-LEARNING-ENVIRONMENT>/src/
3.git clone https://github.com/bbitmaster/ale_python_interface.git
cd ale_python_interface
python setup.py build
python setup.py install
4.)I get errors when i do "from ale_python_interface import ALEInterface"
I am getting the following error:from: can't read /var/mail/ale_python_interface
Although in this example below, I am sending action 0 -- it's true for any action - tested on Breakout and Zaxxon
import sys
from ale_python_interface import ALEInterface
import numpy as np
ale = ALEInterface()
ale.loadROM("Breakout.bin")
legal_actions = ale.getLegalActionSet()
for episode in range(10):
total_reward = 0.0
while not ale.game_over():
print "acting"
reward = ale.act(0);
total_reward += reward
print("Episode " + str(episode) + " ended with score: " + str(total_reward))
ale.reset_game()
In order to avoid the hanging -- I resorted to performing a random action every 20 (a rough maximum value discovered via trial and error) frames. This bug came up when my Q-learner degenerated to choosing a single action.
HI,
I am trying to install ale_python_interface on Ubuntu 14.04 LTS
I have edited ~./bashrc as follows
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/home/m/Arcade-Learning-Environment/
export LIBRARY_PATH=$LIBRARY_PATH:/home/m/Arcade-Learning-Environment/
export CPLUS_INCLUDE_PATH=$CPLUS_INCLUDE_PATH:/home/m/Arcade-Learning-Environment/src/
but when I execute "python setup.py build "I get the following error:
m@ubuntu:/ale_python_interface$ python setup.py build/ale_python_interface$
running build
running build_py
running build_ext
building 'ale_python_interface.ale_c_wrapper' extension
x86_64-linux-gnu-gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -I/usr/include/python2.7 -c ale_python_interface/ale_c_wrapper.cpp -o build/temp.linux-x86_64-2.7/ale_python_interface/ale_c_wrapper.o
cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++ [enabled by default]
In file included from ale_python_interface/ale_c_wrapper.cpp:2:0:
ale_python_interface/ale_c_wrapper.h:4:29: fatal error: ale_interface.hpp: No such file or directory
#include <ale_interface.hpp>
^
compilation terminated.
error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
m@ubuntu:
When feeding the screen from ALE into pygame using ale.GetScreenRGB(the buffer), the screen displayed is distorted.
It seems like the python GetScreenRGB function does not return RGB (it is the same size as grey scale, when it should be 3 times). GetScreenGrayscale doesn't solve the issue though, so maybe a mismatch between the output format between python and c++?
Hi all (and Sorry if 'Issues' is not the appropriate place for this question)
For the purpose of some IRL, I need to have the transition matrix of these games. Using the RAM version, I have 12825618 maximum of possible states. However, since the game is always determined by the initial state (and the future actions), can't I just sample all the initial states (and obtain the MDP from this) ? If yes how do I sample all the initial states ? Or do you have an advice on a simple (and efficient because I doubt the first one is) way to achieve my goal ?
Thanks in advance for your response
Is this library supposed to work under mac? I am getting segmentation fault for ale_python_test1.py but not under Ubuntu.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.