Challenges
Drone challenges
Drone vision
Drone stations
More drone challenges
Robot
Conditionals
Fuel check
- Make a variable called
fueland set it to 15. - If
fuelis under 20, print Land now. - Otherwise, print Keep flying.
- Change
fuelto 80 and run it again.
Use if fuel < 20: then else:. Indent the line under each one.
Conditionals
Dice duel
- Roll a dice for you and a dice for the robot with
random.randint(1, 6). - Print both rolls, then You win!, Robot wins! or Draw!
- Play 5 rounds. Count your wins and print the score at the end.
- Bonus: print Double six! when both dice are 6.
You need if, elif and else. Start wins = 0 before the loop, not inside it.
Conditionals
Launch countdown
- Count down from 10 to 1 with a
whileloop. - Print Lift off! at the end.
- Bonus: when the count is 5, also print Halfway!
Start with count = 10. Inside the loop, print it, then take 1 away.
Conditionals
Guess the number
- The computer picks a secret number from 1 to 100.
- Keep asking for guesses until the player gets it.
- Print Too high or Too low after each guess.
- Bonus: count the guesses and print the total at the end.
guess = int(input("Guess: ")) asks the player and turns the answer into a number. Use while guess != secret:.
Conditionals
Ball keeper
1 coin
- The ball is somewhere straight ahead. It moves every time you press Run.
- Drive forward until the robot has the ball.
- Then kick it.
- Bonus: after the kick, drive back to where you started.
while not robot.has_sports_ball(): keeps going until the robot has the ball. Move a little each time.
AI Vision
Face the ball
1 coin
- The ball is somewhere around the robot. It moves every time you press Run.
- Turn until the robot is facing the ball.
Turn in small steps until robot.vision.get_data(SPORTS_BALL)[0].exists is True. Then turn by its bearing.
AI Vision
Barrel sorter
2 coins
- A barrel is in front of the robot. It could be orange or blue.
- Orange: drive into the orange zone on the left.
- Blue: drive into the blue zone on the right.
Check robot.vision.get_data(ORANGE_BARREL)[0].exists. If it is True, go left. Else, go right.
AI Vision
Tag reader
2 coins
- An AprilTag is in front of the robot. It says 1, 2 or 3.
- Drive into the zone with the same number.
- Zone 1 is left, zone 2 is right, zone 3 is behind you.
robot.vision.get_data(ALL_TAGS)[0].id gives the tag number. Use if, elif and else.
AI Vision
Find and fetch
3 coins
- The ball is somewhere on the field. It moves every time you press Run.
- Find it, collect it and bring it back to the start.
- Put it down with
robot.kicker.place().
Face the ball first, then drive forward until the robot has it. Remember how far you drove so you can drive back.
Drone challenges
Smart climb
1 coin
- Take off to 50 cm.
- Climb 20 cm at a time while the drone is lower than 1.5 m.
- Bonus: come back down to 50 cm the same way.
- Then land.
drone.get_z_position() tells you the height in mm. Use it in a while loop.
Drone challenges
Zigzag
2 coins
- Take off to 80 cm.
- Coin 1 is 40 cm ahead and 40 cm to the right.
- Each coin after that is 50 cm further ahead and 80 cm across, on the other side.
- Use a loop, and an if to swap sides.
Keep the direction in a variable, like side = 270. After each move, use if and else to swap it between 90 and 270.
Drone challenges
Square spiral
2 coins
- Take off to 80 cm.
- Fly 40 cm, then 80, 120, 160 and 200 cm.
- Turn right after every side.
- Collect all 5 coins.
Start with side = 400. Inside the loop, fly side, turn, then add 400 to side.
Drone challenges
Hurdles
3 coins
- Take off to 50 cm.
- The hurdles are 80 cm, 1.1 m and 1.4 m high, starting 30 cm ahead and 80 cm apart.
- Drop back to 50 cm after each hurdle to collect its coin.
- Use a loop. The jump gets 30 cm bigger each time.
Keep the jump height in a variable. Climb up by it, fly forward 60 cm, climb down by it, fly 20 cm, then add 300.
Drone vision
Tag landing
2 coins
- An AprilTag is on the floor somewhere ahead. It moves every time you press Run.
- Fly forward until the downward camera sees it.
- Land on it.
Fly low, about 40 cm. drone.vision.get_data(DOWNWARD_CAMERA, ALL_TAGS)[0].exists is True when a tag is below you.
Drone vision
Tag messenger
3 coins
- Take off to 50 cm. An AprilTag under the drone says 1, 2 or 3.
- Pad 1 is 1 m ahead and 80 cm left.
- Pad 2 is 1 m ahead and 80 cm right. Pad 3 is 1.8 m ahead.
- Land on the pad with the same number. The tag changes every Run.
drone.vision.get_data(DOWNWARD_CAMERA, ALL_TAGS)[0].id is the tag number. Then use if, elif and else.
Drone vision
Elevator
2 coins
- Take off to 50 cm. The tag under the drone says 1, 2, 3 or 4.
- Floor 1 is 50 cm, floor 2 is 1 m, floor 3 is 1.5 m, floor 4 is 2 m.
- Climb to the right floor, then land.
Each floor is 500 mm. You start at floor 1, so climb (floor - 1) * 500.
Drone vision
Land on tag 5
2 coins
- Tag 3 and tag 5 are on the floor straight ahead.
- They swap places every time you press Run.
- Land on tag 5.
You can ask for one tag: drone.vision.get_data(DOWNWARD_CAMERA, TAG5).
Drone vision
Tag counter
3 coins
- Between 2 and 4 tags are on the floor ahead. It changes every Run.
- Fly 2.4 m forward, 10 cm at a time, 40 cm high.
- Count the tags and show the number with
controller.screen.print(). - Then land.
The camera sees each tag for a few steps. Only count it when you see a tag now but didn't on the step before.
Drone stations
Slalom
2 coins
- Take off to 80 cm.
- Pole 1 is 60 cm ahead. The poles are 65 cm apart.
- Go left of pole 1, right of pole 2, then left of pole 3.
- Land on the pad 2.45 m ahead.
Fly forward and sideways in turns. move_for(0, ...) goes forward and move_for(90, ...) goes right.
Drone stations
Over and under
3 coins
- Fly under the bar. It is 60 cm ahead and 90 cm high.
- Fly over the table. It starts 1.1 m ahead and is 75 cm high.
- Land on the pad 2.3 m ahead.
Stay low for the bar, then climb before the table. Check your height with drone.get_z_position().
More drone challenges
Spiral staircase
2 coins
- Take off to 50 cm.
- Fly a square with 80 cm sides, turning right at each corner.
- Climb 20 cm after every corner.
- Go round twice and collect all 8 coins.
8 sides is range(8). Each time round: move, turn, climb.
More drone challenges
Rollercoaster
2 coins
- Take off to 50 cm.
- Fly 40 cm forward, climb 70 cm, fly 40 cm forward, drop 70 cm.
- Do it 3 times to collect all 5 coins.
Four lines inside a for loop. DOWN works with climb_for too.
More drone challenges
Maze
3 coins
- Wall 1 is 60 cm ahead with a gap on the right.
- Wall 2 is 1.5 m ahead with a gap on the left.
- The walls are too tall to fly over.
- Land on the pad, 2.3 m straight ahead.
Plan it on paper first. Stay at least 15 cm from every wall.
Python
Make it talk
- Print your name.
- Print your team name.
- Bonus: print a countdown: 3, 2, 1, Lift off!
Text goes inside quote marks, inside the brackets. Use one print() per line.
Python
Name your variables
- Make a variable called
name, set to your name. - Make a variable called
fav_number, set to your favourite number. - Bonus: print a sentence that uses your variables.
Names can't have spaces, so use an underscore. Text needs quote marks. Numbers don't.
Python
Loop the loop
- Print Lift off! 10 times, using only 2 lines of code.
- Loop over
range(5)and printieach time. Which numbers appear? - Bonus: print Ready once, Go! three times, then Landed once.
The first line ends with a colon. The line that repeats is indented under it.
Python
Seconds alive
- Make a variable called
age, set to your age. - Work out how many days, hours and seconds you have been alive.
- Print the number of seconds.
- Bonus: how many minutes?
* means times. Days is age * 365. Then build hours from days, and seconds from hours.
Python
Times tables
- Print the 7 times table, from 7 to 84, using a loop.
- Make each line read like 3 x 7 = 21.
- Bonus: put the number in a variable, so one change gives any times table.
for i in range(1, 13): counts from 1 to 12. Inside the loop, i * 7 is the answer.
Robot
First drive
- Drive forward 30 cm.
- Then drive back to where you started, without turning.
- Bonus: slide 30 cm to the right, then back again.
The second number is the direction. 0 is forward. Which number is backwards?
Robot
Square
1 coin
- Drive a square with 40 cm sides.
- Finish where you started.
- Write every move out, one line at a time.
A square has 4 sides and 4 corners. Each corner is a quarter turn.
Robot
Loop square
1 coin
- Drive the same square using a loop and a variable called
side. - Change
sideto 600 and it should still finish where it started.
Look at your Square program. Which lines repeat? Put them in a loop, and use side instead of a number.
Robot
Hexagon
2 coins
- Drive a hexagon with 30 cm sides.
- Use a loop.
- Finish where you started.
Going all the way round is 360 degrees. Share that between 6 corners.
Robot
Staircase
2 coins
- Climb 3 steps, each 20 cm tall and 20 cm deep.
- Use a loop.
- No
turn_forallowed.
The robot can drive sideways without turning. Change the direction number.
Robot
Fetch the ball
2 coins
- The ball is 60 cm straight ahead.
- Drive to it, collect it and bring it back to the start.
- Put it down with
robot.kicker.place().
Drive straight into the ball and the magnet holds it. Drive back without turning so the ball stays at the front.
Robot
Slalom
2 coins
- Weave between the 3 barrels without touching them.
- Go left of barrel 1, right of barrel 2, left of barrel 3.
- The barrels are 30 cm apart. Stop in the finish box.
Slide sideways with 90 and 270, so you never need to turn. Follow the dashed line.
Robot
Spiral
2 coins
- Drive a square spiral: 20, 30, 40, 50, 60 and 70 cm.
- Turn right after every side.
- Use a loop and a variable that grows.
Start with side = 200. Inside the loop: move side, turn, then add 100 to side.
Robot
Star
3 coins
- Drive a five-pointed star with 50 cm lines.
- Use a loop.
- Bonus challenge for teams who finish early.
Each turn is bigger than 90. Going round a star turns the robot all the way round twice.
Robot
Robot soccer
2 coins for a coded goal
1 coin for a driven goal
- The goal is to the right.
- Collect the ball and score.
- Driven goals use the AIM controller.
Collect the ball first. Then turn to face the goal before you kick.
Drone
Yellow rings
- Plug a controller into a laptop.
- Open VEXcode AIR and choose the Simulator tab.
- Fly through both yellow rings, then land on the platform.
Use small stick movements. Climb to the height of the rings before you fly forward.
Drone
Land on target
1 coin
- Take off, fly to the target and land on it.
- The target is 1 m ahead and 50 cm to the right.
- Your landing must touch the target.
Drone distances are in millimetres, and the direction comes first.
Drone
Drone square
1 coin
- Take off to 1 m.
- Fly a square with 1 m sides.
- Land where you started.
A square is 4 sides and 4 quarter turns. A loop saves typing.
Drone
Triangle
1 coin
- Take off to 1 m.
- Fly a triangle with 1 m sides.
- Land where you started.
Going all the way round is 360 degrees. Share it between 3 corners.
Drone
Coin tower
1 coin
- Collect all 4 coins.
- They are stacked 1 m ahead, at 50 cm, 1 m, 1.5 m and 2 m high.
- Land when you have them all.
Fly forward first, then climb straight up through the stack.
Drone
Sky stairs
2 coins
- Take off to 50 cm.
- Fly up 3 steps. Each step is 50 cm forward, then 40 cm up.
- Land at the top.
Each step is a move, then a climb. Put both inside a loop.
Drone
Climbing square
2 coins
- Take off to 50 cm.
- Fly a square with 1 m sides.
- Climb 30 cm after every side.
- Land.
Start with your square. It needs one more line inside the loop.
Drone
Ring run
2 coins
- Take off to 80 cm.
- Ring 1 is 70 cm ahead, 80 cm high.
- Ring 2 is 70 cm further, 1.5 m high.
- Ring 3 is 70 cm further, 1 m high.
- Fly through all 3 rings, then land.
Get to the right height first, then fly forward through the ring.
Drone
Coin hunt
2 coins
- Collect all 5 coins.
- Use the 3D view to work out where each coin is.
- Land when you have them all.
The floor lines are 50 cm apart. Count the lines to each coin, and check its height.
Drone
Wall jump
2 coins
- A 1.2 m wall stands between you and the landing pad.
- The pad is 1.7 m ahead.
- Fly over the wall and land on the pad.
Climb higher than the wall before you fly forward.
Drone
Cube
3 coins
- Take off to 50 cm.
- Visit all 8 corners of a 1 m cube.
- Land.
A cube is a square on the bottom and a square on top. Climb 1 m in between.
Drone
Corkscrew
3 coins
- Take off to 50 cm.
- Fly an 8-sided shape with 60 cm sides.
- Climb 15 cm after every side.
- Land.
8 sides means each turn is 360 divided by 8.
Drone
Landing competition
2 coins for the closest landing
- Each team flies its Land on target program once.
- Measure from the centre of the target to the centre of the drone.