Python: Raspberry Pi 3 and Projects
Shivani Jayant
SWE Intern @ Fannie Mae | CS Learning Assistant | Open Source Software Developer | WEP Lead
My dad had bought a Raspberry Pi 3 a couple of years ago and I was curious, with it being the smallest CPU ever and all that, but I didn’t really know how to use it. I eventually gave up and forgot about it until recently when my dad discovered it out of the mountains of old hardware in our house. By this time, I had learnt Python and was an eager student. I finally had a use for it.
What I used it for is a different story. A group of three friends and I collaborated on a school project that was 30% of our final grade in junior year. We had decided that a simple game or booking system was too easy and we wanted a challenge. So, we split the project into four parts. We would make a menu-based game system. Each one of us took on a different game- Sudoku, Wordsearch, Hangman, and Mastermind.
I chose Wordsearch. I remembered how much fun I used to have playing those games and I wanted to virtually recreate that. Remember, we were in 11th grade. My brother called our group ‘The Overachievers’. We utilized certain topics that were covered in the 12th-grade syllabus. We all learnt various things out of it and found that by the end, we had gotten pretty good at this if I do say so myself.
This project required us to have an algorithm, flowchart, and source code. Initially, we all thought the first two were just the bells and whistles to the latter. Upon actually starting, we found that it was pretty hard starting a code without a plan to back it up.
As I said earlier, we all worked separately due to distances and timetables and we combined them only at the end. So, I can describe only what I did. I took a piece of paper and wrote down what a wordsearch required- a grid, a random letter generator, a list of words, a method to input those words into the grid and more. I worked on each topic separately, creating more sub-lists of requirements. By the end of it, I had a flowchart of requirements. This algorithm was the logic behind the whole program. I perfected it and worked on it until I was sure that all I had to do was the coding.
When I started to code, I picked up each function and satisfied each of the requirements that I had listed out in the most efficient manner. (For instance, I had to randomly select words to input into the grid. There were a variety of ways that I could do this by. But I found that reading text files would be the faster method with less storage. So, I learnt how to handle files despite it being within the 12th-grade syllabus.) Once I worked through the functions, I had to generate the main code that would tie all the functions together in real-time.
The last step was testing. We had to solve each step in each of the four games and make sure that they worked seamlessly no matter the user-input or conditions faced. Both individually and collectively, we came across many bugs, which almost took more time to clear than writing the code. Now, we have come to appreciate the step-by-step process of generating a working project.
A few days ago, I put this code into the Raspberry Pi 3 packaged with other Python projects that I had been working on. We have future plans to set this project upon a universal forum so it’s accessible anywhere with user records and databases.