AI prompts
base on Game Boy emulator written in Python <p align="center">
<img src="extras/README/pyboy.svg" width="480">
</p>
__If you have any questions, or just want to chat, [join us on Discord](https://discord.gg/Zrf2nyH).__
[![Discord](https://img.shields.io/discord/584149554132418570?style=for-the-badge&logo=Discord&label=PyBoy)](https://discord.gg/Zrf2nyH)
<!---
Generate GIF with the layout and captions
-->
<table>
<tbody>
<tr>
<td colspan=2 align="center"><a href=https://github.com/PWhiddy/PokemonRedExperiments>Train RL agents to play Pokemon Red</a>
</td>
<td align="center"><a href=https://github.com/Baekalfen/PyBoy/wiki/Experimental-and-optional-features#rewind-time>Rewind any game</a><br>
</td>
</tr>
<tr>
<td colspan=2 align="center">
<div align="center">
<a href="http://www.youtube.com/watch?feature=player_embedded&v=DcYLT37ImBY" target="_blank">
<img src="http://img.youtube.com/vi/DcYLT37ImBY/maxresdefault.jpg" alt="Watch the video" width="500" border="10" />
<!-- <img src="http://img.youtube.com/vi/DcYLT37ImBY/hqdefault.jpg" alt="Watch the video" width="500" border="10" /> -->
</a>
<!-- https://www.youtube.com/watch?v=DcYLT37ImBY -->
<!-- <img src="extras/README/8.gif" width="400"><br> -->
</div>
</td>
<td align="center">
<img src="extras/README/5.gif" width="250">
</td>
</tr>
<tr>
<td align="center">Play the classics<br>
</td>
<td align="center"><a href=https://github.com/lixado/PyBoy-RL>Create your own AI</a><br>
</td>
<td align="center"><a href=https://github.com/uiucanh/tetris>Beat world records with AI</a><br>
</td>
</tr>
<tr>
<td align="center">
<img src="extras/README/1.gif" width="250">
</td>
<td align="center">
<img src="extras/README/6.gif" width="250">
</td>
<td align="center">
<img src="extras/README/7.gif" width="250">
</td>
</tr>
</tbody>
</table>
Getting Started
===============
The instructions are simple:
```sh
$ pip install pyboy
```
For details, see [installation instructions](https://github.com/Baekalfen/PyBoy/wiki/Installation).
Now you're ready! Either use PyBoy directly from the terminal
```sh
$ pyboy game_rom.gb
```
Or use it in your Python scripts:
```python
from pyboy import PyBoy
pyboy = PyBoy('game_rom.gb')
while pyboy.tick():
pass
pyboy.stop()
```
<!-- Or using the context manager:
```python
from pyboy import PyBoy
with PyBoy('game_rom.gb') as pyboy:
while pyboy.tick():
pass
``` -->
The API
=======
If you are looking to make a bot or AI, then these resources are a good place to start:
* [PyBoy API Documentation](https://baekalfen.github.io/PyBoy/index.html)
* [Wiki Pages](https://github.com/Baekalfen/PyBoy/wiki/)
* [Using PyBoy with Gym](https://github.com/Baekalfen/PyBoy/wiki/Using-PyBoy-with-Gym)
* [Example: Kirby](https://github.com/Baekalfen/PyBoy/wiki/Example-Kirby)
* [Example: Tetris](https://github.com/Baekalfen/PyBoy/wiki/Example-Tetris)
* [Example: Super Mario Land](https://github.com/Baekalfen/PyBoy/wiki/Example-Super-Mario-Land)
* [Code Examples](https://github.com/Baekalfen/PyBoy/tree/master/extras/examples)
* [Discord](https://discord.gg/Zrf2nyH)
When the emulator is running, you can easily access [PyBoy's API](https://baekalfen.github.io/PyBoy/index.html):
```python
pyboy.set_emulation_speed(0) # No speed limit
pyboy.button('down')
pyboy.button('a')
pyboy.tick() # Process at least one frame to let the game register the input
value_of_interest = pyboy.memory[0xC345]
pil_image = pyboy.screen.image
pil_image.save('screenshot.png')
```
The [Wiki](https://github.com/Baekalfen/PyBoy/wiki) shows how to interface with PyBoy from your own project.
Performance
===========
Performance is a priority for PyBoy, to make your AI training and scripts as fast as possible.
The easiest way to improve your performance, is to skip rendering of unnecessary frames. If you know your
character takes X frames to move, or the game doesn't take input every frame, you can skip those to potentially triple
your performance. All game logic etc. will still process.
Here is a simple comparison of rendering every frame, rendering every 15th frame, and not rendering any frames (higher is better). See [`pyboy.tick`](https://docs.pyboy.dk/#pyboy.PyBoy.tick) for how it works. Your performance will depend on the game.
<table>
<tbody>
<tr>
<td align="center">
Full rendering
</td>
<td align="center">
Frame-skip 15
</td>
<td align="center">
No rendering
</td>
</tr>
<tr>
<td>
x124 realtime
</td>
<td>
x344 realtime
</td>
<td>
x395 realtime
</td>
</tr>
<tr> <!-- Markdown/HTML broken after this -->
<td>
```python
for _ in range(target):
pyboy.tick()
```
</td>
<td >
```python
for _ in range(target//15):
pyboy.tick(15)
```
</td>
<td >
```python
pyboy.tick(target, False)
```
</td>
</tr>
</tbody>
</table>
The Game Boy was originally running at 60 frames per second, so a speed-up of 100x realtime is 6,000 frames per
second. And trivially from the table above, simulating 395 hours of gameplay can be done in 1 hour with no rendering.
It's also recommended to be running multiple instances of PyBoy in parallel. On an 8-core machine, you could potentially
do 3160 hours of gameplay in 1 hour.
Contributing
============
Any contribution is appreciated. The currently known problems are tracked in [the Issues tab](https://github.com/Baekalfen/PyBoy/issues). Feel free to take a swing at any one of them. If you have something original in mind, come and [discuss it on on Discord](https://discord.gg/Zrf2nyH).
[![Discord](https://img.shields.io/discord/584149554132418570?style=for-the-badge&logo=Discord&label=PyBoy)](https://discord.gg/Zrf2nyH)
For the more major features, there are the following that you can give a try. They are also described in more detail in the [project list in the Wiki](https://github.com/Baekalfen/PyBoy/wiki/Student-Projects):
* Hacking games
* Link Cable
* Debugger (VSCode, GDB, terminal or otherwise)
* AI - [use the `api`](https://baekalfen.github.io/PyBoy/index.html) or game wrappers to train a neural network
* Game Wrappers - make wrappers for popular games
If you want to implement something which is not on the list, feel free to do so anyway. If you want to merge it into our repo, then just send a pull request and we will have a look at it.
", Assign "at most 3 tags" to the expected json: {"id":"3811","tags":[]} "only from the tags list I provide: [{"id":77,"name":"3d"},{"id":89,"name":"agent"},{"id":17,"name":"ai"},{"id":54,"name":"algorithm"},{"id":24,"name":"api"},{"id":44,"name":"authentication"},{"id":3,"name":"aws"},{"id":27,"name":"backend"},{"id":60,"name":"benchmark"},{"id":72,"name":"best-practices"},{"id":39,"name":"bitcoin"},{"id":37,"name":"blockchain"},{"id":1,"name":"blog"},{"id":45,"name":"bundler"},{"id":58,"name":"cache"},{"id":21,"name":"chat"},{"id":49,"name":"cicd"},{"id":4,"name":"cli"},{"id":64,"name":"cloud-native"},{"id":48,"name":"cms"},{"id":61,"name":"compiler"},{"id":68,"name":"containerization"},{"id":92,"name":"crm"},{"id":34,"name":"data"},{"id":47,"name":"database"},{"id":8,"name":"declarative-gui "},{"id":9,"name":"deploy-tool"},{"id":53,"name":"desktop-app"},{"id":6,"name":"dev-exp-lib"},{"id":59,"name":"dev-tool"},{"id":13,"name":"ecommerce"},{"id":26,"name":"editor"},{"id":66,"name":"emulator"},{"id":62,"name":"filesystem"},{"id":80,"name":"finance"},{"id":15,"name":"firmware"},{"id":73,"name":"for-fun"},{"id":2,"name":"framework"},{"id":11,"name":"frontend"},{"id":22,"name":"game"},{"id":81,"name":"game-engine "},{"id":23,"name":"graphql"},{"id":84,"name":"gui"},{"id":91,"name":"http"},{"id":5,"name":"http-client"},{"id":51,"name":"iac"},{"id":30,"name":"ide"},{"id":78,"name":"iot"},{"id":40,"name":"json"},{"id":83,"name":"julian"},{"id":38,"name":"k8s"},{"id":31,"name":"language"},{"id":10,"name":"learning-resource"},{"id":33,"name":"lib"},{"id":41,"name":"linter"},{"id":28,"name":"lms"},{"id":16,"name":"logging"},{"id":76,"name":"low-code"},{"id":90,"name":"message-queue"},{"id":42,"name":"mobile-app"},{"id":18,"name":"monitoring"},{"id":36,"name":"networking"},{"id":7,"name":"node-version"},{"id":55,"name":"nosql"},{"id":57,"name":"observability"},{"id":46,"name":"orm"},{"id":52,"name":"os"},{"id":14,"name":"parser"},{"id":74,"name":"react"},{"id":82,"name":"real-time"},{"id":56,"name":"robot"},{"id":65,"name":"runtime"},{"id":32,"name":"sdk"},{"id":71,"name":"search"},{"id":63,"name":"secrets"},{"id":25,"name":"security"},{"id":85,"name":"server"},{"id":86,"name":"serverless"},{"id":70,"name":"storage"},{"id":75,"name":"system-design"},{"id":79,"name":"terminal"},{"id":29,"name":"testing"},{"id":12,"name":"ui"},{"id":50,"name":"ux"},{"id":88,"name":"video"},{"id":20,"name":"web-app"},{"id":35,"name":"web-server"},{"id":43,"name":"webassembly"},{"id":69,"name":"workflow"},{"id":87,"name":"yaml"}]" returns me the "expected json"