Writing a Puzzle for the BOCS
So you want to create a puzzle for the BOCS? That's great! We've tried to make it as painless as possible to interface with all of its various inputs and outputs.
- Make a copy of the file
raspi/puzzlesand name it after your puzzle (all lowercase, underscores instead of spaces).
- Open the file and replace
PuzzleName(toward the top of the file, after
class) with the name of your puzzle (title case, i.e. each word is capitalized, with no spaces).
Initializing the puzzle
When your puzzle first loads, you'll probably need to tell the BOCS which inputs you want displayed and which outputs you want showing what (as an initial prompt). Fortunately, it's relatively straightforward.
In your puzzle code, the
__init__ function is called when the puzzle is first started. You'll want to add all of your initialization code in there.
Displaying something on the e-ink display
Check out Using the E-Ink Display for information on how to display text or an image on the e-ink display (it's quite simple).
Configuring another input or output device
Please see Initialization section on the page corresponding to the input you'd like to use:
Playing a sound
To play a sound, simply place the sound file (
.mp3) in a folder named after your puzzle in
raspi/media and add the following line of code:
Reacting to player input
For instructions on reacting to input events, please refer to the input section on the page for the corresponding I/O device: