2022-09-13 20:27:34 +01:00
---
title: Gopher
---
2022-12-04 22:24:02 +08:00
2022-09-13 20:27:34 +01:00
# Gopher
2022-12-04 22:24:02 +08:00
```{figure} ../../_static/videos/atari/gopher.gif
2022-09-13 20:27:34 +01:00
:width: 120px
:name: Gopher
```
This environment is part of the < a href = '..' > Atari environments< / a > . Please read that page first for general information.
2022-09-19 21:14:09 +01:00
| | |
|-------------------|-----------------------------------|
| Action Space | Discrete(18) |
| Observation Space | (210, 160, 3) |
| Observation High | 255 |
| Observation Low | 0 |
2022-12-04 22:24:02 +08:00
| Import | `gymnasium.make("ALE/Gopher-v5")` |
2022-09-13 20:27:34 +01:00
2022-10-12 15:58:01 +01:00
## Description
2022-12-04 22:24:02 +08:00
2022-09-13 20:27:34 +01:00
The player controls a shovel-wielding farmer who protects a crop of three carrots from a gopher. [the AtariAge page ](https://atariage.com/manual_html_page.php?SoftwareLabelID=218 ).
### Rewards
2022-12-04 22:24:02 +08:00
2022-09-13 20:27:34 +01:00
The exact reward dynamics depend on the environment and are usually documented in the game's manual. You can
find these manuals on [AtariAge ](https://atariage.com/manual_html_page.php?SoftwareLabelID=218 ).
2022-12-04 22:24:02 +08:00
Atari environments are simulated via the Arcade Learning Environment (ALE) [[1]](#1 ).
2022-09-13 20:27:34 +01:00
### Action Space
2022-12-04 22:24:02 +08:00
2022-09-13 20:27:34 +01:00
The action space a subset of the following discrete set of legal actions:
2022-09-19 21:14:09 +01:00
| Num | Action |
|-----|---------------|
| 0 | NOOP |
| 1 | FIRE |
| 2 | UP |
| 3 | RIGHT |
| 4 | LEFT |
| 5 | DOWN |
| 6 | UPRIGHT |
| 7 | UPLEFT |
| 8 | DOWNRIGHT |
| 9 | DOWNLEFT |
| 10 | UPFIRE |
| 11 | RIGHTFIRE |
| 12 | LEFTFIRE |
| 13 | DOWNFIRE |
| 14 | UPRIGHTFIRE |
| 15 | UPLEFTFIRE |
| 16 | DOWNRIGHTFIRE |
| 17 | DOWNLEFTFIRE |
2022-09-13 20:27:34 +01:00
If you use v0 or v4 and the environment is initialized via `make` , the action space will usually be much smaller since most legal actions don't have
2022-12-04 22:24:02 +08:00
any effect. Thus, the enumeration of the actions will differ. The action space can be expanded to the full
2022-09-13 20:27:34 +01:00
legal space by passing the keyword argument `full_action_space=True` to `make` .
2022-12-04 22:24:02 +08:00
The reduced action space of an Atari environment may depend on the flavor of the game. You can specify the flavor by providing
2022-09-13 20:27:34 +01:00
the arguments `difficulty` and `mode` when constructing the environment. This documentation only provides details on the
2022-12-04 22:24:02 +08:00
action spaces of default flavors.
2022-10-12 15:58:01 +01:00
## Observations
2022-12-04 22:24:02 +08:00
2022-09-13 20:27:34 +01:00
By default, the environment returns the RGB image that is displayed to human players as an observation. However, it is
possible to observe
2022-12-04 22:24:02 +08:00
2022-09-13 20:27:34 +01:00
- The 128 Bytes of RAM of the console
- A grayscale image
instead. The respective observation spaces are
2022-12-04 22:24:02 +08:00
2022-09-13 20:27:34 +01:00
- `Box([0 ... 0], [255 ... 255], (128,), uint8)`
- `Box([[0 ... 0]
...
[0 ... 0]], [[255 ... 255]
...
[255 ... 255]], (250, 160), uint8)
`
respectively. The general article on Atari environments outlines different ways to instantiate corresponding environments
via `gymnasium.make` .
2022-12-04 22:24:02 +08:00
2022-10-12 15:58:01 +01:00
## Arguments
2022-09-13 20:27:34 +01:00
2022-12-04 22:24:02 +08:00
```python
2022-09-13 20:27:34 +01:00
env = gymnasium.make("ALE/Gopher-v5")
```
The various ways to configure the environment are described in detail in the article on Atari environments.
2022-09-19 21:14:09 +01:00
| Environment | Valid Modes | Valid Difficulties | Default Mode |
|-------------|-------------|--------------------|--------------|
2022-12-04 22:24:02 +08:00
| Gopher | `[0, 2]` | `[0, 1]` | `0` |
2022-09-13 20:27:34 +01:00
2022-12-04 22:24:02 +08:00
You may use the suffix "-ram" to switch to the RAM observation space. In v0 and v4, the suffixes "Deterministic" and "NoFrameskip"
are available. These are no longer supported in v5. In order to obtain equivalent behavior, pass keyword arguments to `gymnasium.make` as outlined in
2022-09-13 20:27:34 +01:00
the general article on Atari environments.
The versions v0 and v4 are not contained in the "ALE" namespace. I.e. they are instantiated via `gymnasium.make("Gopher-v0")` .
2022-10-12 15:58:01 +01:00
## Version History
2022-12-04 22:24:02 +08:00
2022-09-13 20:27:34 +01:00
A thorough discussion of the intricate differences between the versions and configurations can be found in the
2022-12-04 22:24:02 +08:00
general article on Atari environments.
2022-09-13 20:27:34 +01:00
2022-09-19 21:14:09 +01:00
| Version | `frameskip=` | `repeat_action_probability=` | `full_action_space=` |
|---------|--------------|------------------------------|----------------------|
| v0 | `(2, 5,)` | `0.25` | `False` |
| v4 | `(2, 5,)` | `0.0` | `False` |
| v5 | `5` | `0.25` | `True` |
2022-09-13 20:27:34 +01:00
> Version v5 follows the best practices outlined in [[2]](#2). Thus, it is recommended to transition to v5 and
> customize the environment using the arguments above, if necessary.