A classic robotics competition challenge. Program your Rover to stay inside the sumo ring and push opponents out. In this first level you’ll use the colour sensor to detect the arena edge and the ultrasonic sensor to find your opponent.
Setup
The sumo exercise works best with a circular arena, but any shape can work. The edges of the arena should clearly contrast with the body so Rovers can detect when they’re at the edge with the colour sensors. We recommend an arena of 60–100 cm diameter with a 3–5 cm edge. Many rule variations are available online.
Quick and easy setup: use a desk as the arena floor and make the arena circle with coloured tape.
Our Approach
A simple approach using just the colour sensor and ultrasonic sensor to get you started.
Stage 1: Stay Away From the Edge
Add a While True loop so the code runs continuously. Use an IF statement to move backwards and turn around if the colour sensor detects the edge of the ring.
Stage 2: Move Around the Ring
If the Rover doesn’t detect the edge, it should move in search of the opponent. Use the ELSE part of the IF statement to move forward.
Stage 3: Push the Opponent
Staying in the ring is most important. After checking for the edge, use an ELSE IF to detect if an opponent is in front with the ultrasonic sensor. If one is close, use a motor block at full speed to charge.

Example code, basic sumo algorithm
