Jewel Thief

by ShellfishUser in Circuits > Wearables

512 Views, 1 Favorites, 0 Comments

Jewel Thief

Showing the bluefruit active.jpg
Side view of the bluefruit.jpg
guard bluefruit.jpg

An original game inspired by “Museum" for 3-5 players. Fun, active and socially distanced, steal the jewels before time runs out! Promotes exercise!

Supplies

Per Player:
1 Adafruit Circuit Playground Bluefruit
velcro wrist strap
USB battery pack for cellphone
USB A to Micro B Cable
Bluefruit enclosure bandannas (different colors)

ONLY FOR THE GUARD:
copper tape
small cardboard box
4-40 metal standoffs (spacers) and screws
masking tape (different colors)

Step 1: Getting the Guard Bluefruit Ready

guard bluefruit.jpg
Side view of the bluefruit.jpg
Bolts on the bluefruit.jpg

Attach the velcro strap to the 2 holes on the back of the bluefruit case

Attach standoffs to capacitive touch sensors A1, A3, A4 and TX on the front of the bluefruit using the screws

Put the back of the case/enclosure on the guard bluefruit(s)

Cut out a circle of cardboard around the same size as the bluefruit (about 2.5 inches in diameter)

Make the circle into a ring by cutting a smaller circle (about 1.5 inches in diameter) out of the center of the bigger circle

Cut 4 pieces of copper tape all about 1 1/2 inches long

Stick the copper tape on the inside of the stand offs (picture 3) so that it runs up and off the standoffs

put the ring down flat on the standoffs and attach the copper tape to the top and back down the other side of the standoff

Make a bigger space to touch the copper tape in and separate the areas by using different color masking tape

A1 - yellow A3 - green A4 - red TX - blue

Step 2: Getting the Thief Bluefruits Ready

Per Bluefruit:

Attach the velcro strap to the 2 holes on the back of the bluefruit case

Put the cases/enclosures on the bluefruits

Step 3: Batteries and Code

Take the USB battery pack for cellphone out of the packaging and plug it in

Use mu-editor to download the file "code.py" to each bluefruit using the USB A to Micro B Cable

When the batteries are done charging use the USB A to Micro B Cable to power them and put them in a pocket, after or before doing so read the next step the rules!

Downloads

Step 4: Rules and Playing

Start by reading the rules in the file attached

When your are ready to start playing the guard presses both buttons A and B to start the game

*OPTIONAL* There is a special rule we added that is not in the directions If someone took a step and you see the backlash of the step if would be great for them to not get them out, also if you only have 1 foot in the air you are aloud to put your foot down without being caught

Have Fun!

How the Code Works

state diagram.jpg

The python code works as a state machine. (https://en.wikipedia.org/wiki/Finite-state_machine) The system is in exactly one state at any time. The system changes to the next state when an event occurs.

The attached state diagram tells us how the Bluefruit moves from one state to the next. Each state is represented in the code by a function, named starting with state_. There are 2 kinds of states, one for when the BlueFruit is in guard mode and one for when the Bluefruit is in thief mode. Each state's name is a description of what it is. For example state_thief_sneakage() is the state for when the thieves are sneaking around, state_gaurd_gamesetup() is for when the guard is setting up the game, and so on. Every state returns a value next_state which is a variable containing the name of the next state.

game_main_loop() is the function that runs repeatedly during the game: it checks whether the user has switched from guard to thief, checks for the end of the game, then runs the function for the next state.

The Bluefruit detects jumping jacks by converting the x, y and z acceleration values into a vector length. If the vector length is bigger than about 3 g(gravity), then it counts that as a jumping jack. The 25 is in state_thief_caught().

Things you may want to change

  • To add another player add a color into player_colors near the top and then in state_gaurd_sendsignal() you need to add another if cp.touch thing.
  • To change the guard cool down for when they can get players out you go to gaurd_signal_cooldown() also near the top and change the sound times to make them longer or shorter