<commit_before># XWorld: a simulator package for Reinforcement Learning
This repository currently contains a collection of simulators for Reinforcement Learning research.

|**Name**|**Description**|**Thread-compatible?***|**Optional?**|**Build-on-the-fly?**|
|-----------|---------------|----------------|-------------|---------------|
|**SimpleGame**|A simple 1D array-walking game.|Yes|No|Yes|
|**SimpleRace**|A simple synthetic car racing game.|Yes|No|Yes|
|**XWorld2D**|A 2D environment for an agent to learn vision and language abilities.|Yes|No|Yes|
|**Atari**|Wrappers for the Arcade Learning Environment ([ALE](http://www.arcadelearningenvironment.org/)) environment. For stability, we use a fork version.|Yes|No|Yes|
|**Malmo**|Wrappers for Microsoft [Malmo](https://github.com/Microsoft/malmo) Project.|*TBD*|Yes|No,has to be installed manually first.|
|**DeepMind Lab**|Wrappers for Deepmind [Lab](https://github.com/deepmind/lab). We use a fork version of the original repository to address a [compiling issue](https://github.com/deepmind/lab/pull/71).|Yes|Yes|Yes|

*If each thread has a different environment instance, then they don't interfere with each other. But if all threads share the same instance, then there is interference.

# Dependencies
The following softwares must be installed before building XWorld.
* [Boost](http://www.boost.org/)
* [Glog](https://github.com/google/glog)
* [GFlags](https://github.com/gflags/gflags)
* [GTest](https://github.com/google/googletest)

In Ubuntu 14.04 and 16.04, you can do
```
sudo apt-get install libboost-all-dev libgflags-dev libgoogle-glog-dev libgtest-dev
```

# Build
First get this git repository
```
git clone https://github.com/PaddlePaddle/XWorld
```

Suppose the directory is `xworld_path`, then do
```
cd <xworld_path>
mkdir -p build
cd build
cmake [<optional parameters>] ..
```
For example,
```
cd ~/XWorld; mkdir build; cd build
cmake -DWITH_DEEPMIND_LAB=ON ..
```

Finally, in the build directory do
```
make
make test
```

# Use
You can compile a C++ project with XWorld. The C++ simulator APIs are located in simulator.h.
Alternatively, we provide a set of simple Python APIs for interacting with the simulators. After building XWorld, you need to export the path of the python module:
```
export PYTHONPATH=<xworld_path>/python:$PYTHONPATH
```
You can add the above line to ~/.bashrc to avoid doing the export in the future.

To get started, several examples of the simulator Python APIs can be found in
```
<xworld_path>/python/examples
```

# Citations
If you use the XWorld2D environment for your research, please consider citing

* <NAME>, <NAME>, <NAME>, [*A Deep Compositional Framework for Human-like Language Acquisition in Virtual Environment*](https://arxiv.org/pdf/1703.09831.pdf), arXiv 1703.09831, 2017.
* <NAME>, <NAME>, <NAME>, [*Listen, Interact and Talk: Learning to Speak via Interaction*](https://arxiv.org/pdf/1705.09906.pdf), arXiv 1705.09906, 2017.
<commit_msg>add instructions to use DeepMind Lab and Malmo<commit_after># XWorld: a simulator package for Reinforcement Learning
This repository currently contains a collection of simulators for Reinforcement Learning research.

|**Name**|**Description**|**Thread-compatible?***|**Optional?**|**Build-on-the-fly?**|
|-----------|---------------|----------------|-------------|---------------|
|**SimpleGame**|A simple 1D array-walking game.|Yes|No|Yes|
|**SimpleRace**|A simple synthetic car racing game.|Yes|No|Yes|
|**XWorld2D**|A 2D environment for an agent to learn vision and language abilities.|Yes|No|Yes|
|**Atari**|Wrappers for the Arcade Learning Environment ([ALE](http://www.arcadelearningenvironment.org/)) environment. For stability, we use a fork version.|Yes|No|Yes|
|**Malmo**|Wrappers for Microsoft [Malmo](https://github.com/Microsoft/malmo) Project.|*TBD*|Yes|No,has to be installed manually first.|
|**DeepMind Lab**|Wrappers for Deepmind [Lab](https://github.com/deepmind/lab). We use a fork version of the original repository to address a [compiling issue](https://github.com/deepmind/lab/pull/71).|Yes|Yes|Yes|

*If each thread has a different environment instance, then they don't interfere with each other. But if all threads share the same instance, then there is interference.

# Requirements
* Compiler: GCC 4.8 or above
* CMake: CMake 3.0 or above
* Python: Python 2.7

# Dependencies
The following softwares must be installed before building XWorld.
* [Boost](http://www.boost.org/)
* [Glog](https://github.com/google/glog)
* [GFlags](https://github.com/gflags/gflags)
* [GTest](https://github.com/google/googletest)
* [Python](https://www.python.org/)

In Ubuntu 14.04 and 16.04, you can do
```
sudo apt-get install libboost-all-dev libgflags-dev libgoogle-glog-dev libgtest-dev
```

# Build
First get this git repository
```
git clone https://github.com/PaddlePaddle/XWorld
```

Suppose the directory is `xworld_path`, then do
```
cd <xworld_path>
mkdir -p build
cd build
cmake [<optional parameters>] ..
```
For example,
```
cd ~/XWorld; mkdir build; cd build
cmake ..
```

Finally, in the build directory do
```
make
make test
```

By default, XWorld only builds the first four games: SimpleGame, SimpleRace, Atari, and XWorld2D. Optionally, you can install [DeepMind Lab](https://deepmind.com/blog/open-sourcing-deepmind-lab) and [Project Malmo](https://www.microsoft.com/en-us/research/project/project-malmo).

To use DeepMind Lab, please install the external dependencies by following the instructions included in this [DeepMind Lab build documentation](https://github.com/deepmind/lab/blob/master/docs/build.md#how-to-build-deepmind-lab) and run the cmake command
```
cmake -DWITH_DEEPMIND_LAB=ON ..
```
which will automatically download and build DeepMind Lab.

To use Malmo, please first follow the instructions on [https://github.com/Microsoft/malmo](https://github.com/Microsoft/malmo) to install Malmo, and then run the cmake command
```
cmake -DMALMO_ROOT=/path/to/MALMO ..
```

# Use
You can compile a C++ project with XWorld. The C++ simulator APIs are located in simulator.h.
Alternatively, we provide a set of simple Python APIs for interacting with the simulators. After building XWorld, you need to export the path of the python module:
```
export PYTHONPATH=<xworld_path>/python:$PYTHONPATH
```
You can add the above line to ~/.bashrc to avoid doing the export in the future.

To get started, several examples of the simulator Python APIs can be found in
```
<xworld_path>/python/examples
```

# Citations
If you use the XWorld2D environment for your research, please consider citing

* <NAME>, <NAME>, <NAME>, [*A Deep Compositional Framework for Human-like Language Acquisition in Virtual Environment*](https://arxiv.org/pdf/1703.09831.pdf), arXiv 1703.09831, 2017.
* <NAME>, <NAME>, <NAME>, [*Listen, Interact and Talk: Learning to Speak via Interaction*](https://arxiv.org/pdf/1705.09906.pdf), arXiv 1705.09906, 2017.

{'fraction_non_alphanumeric': 0.1484047928396131, 'fraction_numerical': 0.017756604590731917, 'mean_word_length': 4.609716599190284, 'pattern_counts': {'":': 0, '<': 23, '<?xml version=': 0, '>': 23, 'https://': 24, 'lorem ipsum': 0, 'www.': 6, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 1, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7261620', 'n_tokens_mistral': 2285, 'n_tokens_neox': 2045, 'n_words': 722}