Files
micromelon-website/content/resources/prison-escape.mdx
Tim Hadwen 1f8c46597b Site audit: fix broken images, add activity metadata, clean up content
- Remove broken image references from 25 MDX files (deleted spacer/content images)
- Add codingSkills and roverConcepts frontmatter to 24 activity pages
- Fix "Activity Demonstration" headings in 15 activity files (plain text -> h3)
- Remove unused "All" category from 89 MDX files
- Decode HTML entities (> <  ) in 9 content files
- Escape bare < > characters in MDX to fix build errors
- Standardize contact email to contact@micromelon.com.au
- Add missing description to rover-repair-request metadata
- Include previous session work: about-us updates, difficulty filtering,
  LearningPathway component, expanded schools list, new product/resource images

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-02 21:49:15 +10:00

44 lines
2.2 KiB
Plaintext
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
---
title: "Activity: Prison Escape"
date: "2021-06-03"
categories: ["Activities"]
tags: ["Colour Sensors", "Branching", "Iteration", "Motors", "Intermediate"]
codingSkills: ["Branching", "Iteration"]
roverConcepts: ["Colour", "Motors"]
excerpt: "Learn branching and iteration using the colour sensors and motors."
featuredImage: "/images/resources/prison-escape.png"
---
Use the colour sensors to find and drive through the gap in the box. Rovers start in the middle facing a random direction and must leave through the gap, they cannot drive over the lines.
### Activity Demonstration
<iframe width="560" height="315" src="https://www.youtube.com/embed/uYk3tOwX6rw" title="Prison Escape Activity Demonstration" frameBorder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowFullScreen></iframe>
### Setup
Use tape on a table or floor or a printed arena to create an outline. It doesn't matter what colour the tape or surface is as long as they contrast to make it easy to detect with the colour sensors. Make sure the gap you leave in the wall is large enough for the rover the move through.
The same code should work no matter where the rover is placed to start. Do not hard code all distances in your solution.
### Heres Our Approach
There are multiple ways to solve this challenge. This starter approach simply moves the rover forward until it detects the wall. If we detect the wall it means we must reverse and change direction. This cycle repeats until the rover finds the exit. You can add randomness to the turning or some other strategy to find the exit faster.
#### Stage 1
Use an IF Statement block with a condition that checks if the colour sensor sees the tape which is brighter than the floor. If the rover does detect the tape is underneath it, it knows it has hit a wall. We use motor blocks to go backward then turn.
#### **Stage 2**
When our rover does not see the tape we must just use a motor block to set the rover to move forward slowly in the ELSE branch.
#### **Stage 3**
We want to repeat this behaviour until the rover finds the exit so we put all our code in a repeat while true loop.
![](/images/content/907fa8-screenshot-2023-10-31-083156.png)
Example Code