Skip to content
Snippets Groups Projects
Commit 37750470 authored by MIRANDA GONZALES Marcelo's avatar MIRANDA GONZALES Marcelo
Browse files

Delete visualize_Random4.ipynb

parent 23a8ea8f
No related branches found
No related tags found
No related merge requests found
%% Cell type:markdown id: tags:
<h1 style="background-color: gray;
color: black;
padding: 20px;
text-align: center;">INFO</h1>
In this script, we run player `Random4` in a maze, to visualize its behavior.
%% Cell type:markdown id: tags:
<h1 style="background-color: gray;
color: black;
padding: 20px;
text-align: center;">IMPORTS</h1>
%% Cell type:code id: tags:
``` python
# External imports
import sys
import os
import pprint
# Add needed directories to the path
sys.path.append(os.path.join("..", "players"))
# PyRat imports
from pyrat import Game
from Random4 import Random4
```
%% Cell type:markdown id: tags:
<h1 style="background-color: gray;
color: black;
padding: 20px;
text-align: center;">CONSTANTS</h1>
Let's configure the game with a dictionary.
%% Cell type:code id: tags:
``` python
# Customize the game elements
CONFIG = {"mud_percentage": 0.0,
"nb_cheese": 1,
"random_seed": 42,
"trace_length": 1000}
```
%% Cell type:markdown id: tags:
We perform a single game with the configuration defined above.
%% Cell type:code id: tags:
``` python
# Instantiate a game with specified arguments
game = Game(**CONFIG)
# Instantiate a player and add it to the game
player = Random4()
game.add_player(player)
# Start the game and
stats = game.start()
```
%% Cell type:code id: tags:
``` python
# Show statistics
pprint.pprint(stats)
```
%% Output
{'players': {'Random4': {'actions': {'east': 3,
'error': 0,
'miss': 0,
'mud': 0,
'north': 0,
'nothing': 0,
'south': 4,
'wall': 0,
'west': 7},
'preprocessing_duration': 0.0,
'score': 1.0,
'turn_durations': [0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0]}},
'turns': 14}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment