Summer Deals - hours only!Up to 80% off on all courses and bundles.-Close
Introduction
Cyber Battle Game
Game elements
Main Game Loop
8. Step 6a – losing lives
Robot moves
Final game

## Instruction

Perfect! Right now, our game will always last 10 rounds because we aren't decreasing the robots' lives. Let's change that.

In the actual game, robots lose lives when they are hit by a laser beam. We don't have laser beams implemented yet, so we'll assume that a robot loses one life whenever its opponent shoots a laser beam.

## Exercise

Add the argument lives_left as the last argument of the act_robot() function and as the last argument of play_round() function.

1. Inside the act_robot() function, decrease the opponent's life by 1 whenever a robot shoots a laser beam. Use the get_opponent_name() function we've already prepared to determine which robot's lives to decrease.
2. Change the play_round() function.
1. Start by invoking act_robot() for robot A. Remember to pass the new argument lives_left to act_robot() function.
2. Robot A could have killed robot B in the previous step, so check if robot B has any lives left. If it does, perform act_robot() for robot B.

### Stuck? Here's a hint!

In point 1, decrease the opponent's life in the following way:

lives_left[get_opponent_name(robot)] -= 1

In point 2b, use the following code:

if lives_left['B'] > 0:
act_robot(board, robot_b, lives_left)