This notebook demonstrates the different levels of difficulty for each of the construction tasks.

For further details, see the Documentation.

```
In [0]:
```# Copyright 2020 DeepMind Technologies Limited
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

```
In [0]:
```import matplotlib.pyplot as plt
import dm_construction

```
In [0]:
```def show_difficulties(env_, difficulties=None):
"""Generate and plot episodes at each difficulty level."""
if not difficulties:
difficulties = range(0, env_.core_env.max_difficulty + 1)
frames = []
for difficulty in difficulties:
_ = env_.reset(difficulty=difficulty, curriculum_sample=False)
frames.append(env_.core_env.last_time_step.observation["RGB"].squeeze())
base_size = 5
num_frames = len(frames)
_, axes = plt.subplots(
1, num_frames, squeeze=False, figsize=(base_size*num_frames, base_size))
for i, rgb_observation in enumerate(frames):
ax = axes[0, i]
ax.imshow(rgb_observation)
ax.set_axis_off()
ax.set_aspect("equal")
if isinstance(difficulties[i], str):
ax.set_title(difficulties[i])
else:
ax.set_title("difficulty = {}".format(difficulties[i]))

```
In [0]:
```# Create a new Unity process. Use a higher res on the camera for nicer images.
unity_env = dm_construction.get_unity_environment(width=600, height=600)
# Create one copy of each environment.
envs = {}
env_names = [
"marble_run", "covering_hard", "covering", "connecting", "silhouette"]
for task in env_names:
envs[task] = dm_construction.get_environment(
task, unity_environment=unity_env, curriculum_sample=None,
difficulty=None)

```
In [0]:
```# Curriculum difficulties.
show_difficulties(envs["silhouette"], difficulties=[0, 1, 2, 3])
show_difficulties(envs["silhouette"], difficulties=[4, 5, 6, 7])

```
```

```
In [0]:
```# Generalization.
show_difficulties(envs["silhouette"], difficulties=["double_the_targets"])

```
```

The difficulty levels in Connecting involve increasing the number of obstacles, the number of layers of obstacles, and the height of the targets.

Generalization in connecting involves having mixed heights of the targets, or adding an additional layer of obstacles (and also increasing the height of the targets).

```
In [0]:
```# Curriculum difficulties.
show_difficulties(envs["connecting"], difficulties=[0, 1, 2, 3, 4])
show_difficulties(envs["connecting"], difficulties=[5, 6, 7, 8, 9])

```
```

```
In [0]:
```# Generalization.
show_difficulties(envs["connecting"], difficulties=["mixed_height_targets", "additional_layer"])

```
```

```
In [0]:
```# Curriculum difficulties.
show_difficulties(envs["covering"])

```
```

```
In [0]:
```# Curriculum difficulties.
show_difficulties(envs["covering_hard"])

```
```

```
In [0]:
```# Curriculum difficulties.
show_difficulties(envs["marble_run"], difficulties=[0, 1, 2, 3, 4])
show_difficulties(envs["marble_run"], difficulties=[5, 6, 7, 8])

```
```

```
In [0]:
```for name, env in envs.items():
print("Closing '{}'".format(name))
env.close()

```
```