The answersDownload the PDF
Worksheet

10.5 A team in a game

Competing · Robot club · about 14 min

BugBotLab
NameClassDate

What this lesson is about

Radio in a game, agreeing roles without talking, and swapping jobs when the score says so.

Questions 6 marks in all

  1. [1 mark]In a game, who hears your send("striker")?

    1. AEvery robot on the mat, including the other team
    2. BOnly your team mates
    3. COnly robots within 50 cm
    4. DOnly the game's scorer
  2. [1 mark]What does this program print?

    team = ["bot-7", "bot-2"]
    for me in team:
        job = "attack" if me == min(team) else "defend"
        print(me, job)
  3. [1 mark]What does this program print?

    team = ["bot-10", "bot-9"]
    print(min(team))
  4. [1 mark]Why is a rule like the name that sorts first attacks often better than agreeing by radio?

    1. AIt cannot be jammed, cannot arrive late, and works on the first tick
    2. BIt lets you change jobs more often
    3. CThe other team cannot read your name
    4. DRadio does not work in games
  5. [1 mark]Your attacker has been taken out. What should the defender do?

    1. ABecome the attacker
    2. BKeep defending, since jobs are fixed
    3. CStop and wait for the attacker to return
    4. DSend the score to the other team
  6. [1 mark]In the task, a robot sends attack and then drives to the near base. What is wrong?

    1. AWhat it said and what it did do not match: attack means the far base
    2. BNothing, the message is what counts
    3. CIt should not send anything
    4. Dattack should be in capitals

The task: call it and go

Send a message saying which job you are taking, then do it: drive to the base zone that matches. This time the job is attack: send attack, then drive to the far base, up the mat and to the left. (Defending would mean the near base, down and to the right.)

from bugbot import *
connect()

# say what you are doing, then do it
send("attack")

Plan your program here, then type it in and press Run.

QR code
Do it on the robot
www.bugbotlab.com/learn/10-5-a-team-in-a-game/
The simulator checks it and tells you when it passes. Nothing to install, no account.

Challenges

  1. Choose the job from the robot's own name with min(), as above, and send what you chose.
  2. Print everything messages() gives you for ten seconds, so you can see what a busy game sounds like.
  3. Send a message when you arrive, so a team mate knows the job is done.