Deals Of The Week - hours only!Up to 80% off on all courses and bundles.-Close
Introduction
Cyber Battle Game
Game elements
4. Step 2 – robot representation
Main Game Loop
Final game

Instruction

Well done! We have a list which represents our game board. Now, we want to create a proper representation of our robots.

Each robot has a name ('A' or 'B') and is facing a given direction (left <, right >, up ^, or down v). We want to merge these two pieces of information into a single data structure.

Exercise

Create two variables: robot_a and robot_b. Each robot should be a dictionary with two keys: name and direction.

  1. robot_a should have the 'name': 'A' and 'direction': '>'.
  2. robot_b should have the 'name': 'B' and 'direction': '<'.

Stuck? Here's a hint!

Recall that dictionaries are initialized with curly brackets. Inside, we need to provide key-value pairs. Example:

robot_a = {'name': 'A', 'direction': '>'}