This weekend I attended a Snake workshop in Brno as a coach. This was my first time I tried the role of coach, so I wasn’t really sure what to expect, but It was pleasant surprise. Snake workshop was organized as part of the Europe codeweek initiative. It was Python language workshop targeted on beginners without any knowledge of Python language.
Workshop started at 8:30AM. There were almost 30 attendees and almost 10 coaches. This workshop was lead by Petr Viktorin, who at the beginning told us, what attendees should expect from this course and what is expected from coaches. First task was to prepare development environment for Python. In this part there were various issues where we as a coaches helped the attendees to get running python virtual environment. Attendees used different OS (MacOS, Linux, Windows), so the issue was specific per attendee.
We had a short break after this for breakfast, which was sponsored by Red Hat, so as usual on Red Hat sponsored event there was plenty of food for everyone.
After this break Petr started to show the basics of the language and how to work with interactive python command line. He talked about operations, lists, dictionaries, number representation, strings and variables. This part of the workshop was calm for coaches. There weren’t many problems that we had to solve. Most of the attendees were catching really quickly with Petr.
This part was followed by another break, this time for lunch. Every attendee could order anything from one Pizzeria, so it was mostly pizza.
Now we got to the hard part, where attendees started to play with creating little script files. As a coach I had plenty of work when this part started. Mostly it was only the save location of the file, where it was saved to different folder than folder with workshop files. This part introduced functions, execution of script files and import of additional libraries.
This was followed by final task, create your own snake game. First issues were encountered when trying to import pyglet python library. After few minutes Petr found out, that this is caused by missing mesa library. When this issue was solved, Petr started with introduction to pyglet, first by showing how to print label in the window and later images.
Now we could create the snake and some food for it. In this part some of the attendees started to fall behind and they needed more help from coaches. We were more busy now, running from one attendee to another. In the meantime the work on the snake game was going forward. Snake started to change from only green cubes to real snake.
In this state Petr explained how to make the snake to start moving. So now we had snake that looked like a real snake and moved on the screen, what we were missing was growing the snake after eating food and to actually control the snake. First the control with key events was implemented so most of the attendees started to play with it, but it wasn’t really fun, when you can’t lose.
So first step on the way to lose the game was growing the snake after eating food. This was really easy, but when the snake gained ability to actually die when he bit himself, we started to see very funny issues on some screens. Like snake killing himself on start or dying after eating food. 🙂 All of these were easy to fix, most of the time it was only bad order of the function calls.
Now the snake can grow and it could bit itself, but it could still vanish behind the border of the window. This was also the last task for attendees, to kill the snake, when touching the border of window. This was nothing difficult. So it was only a matter of few minutes.
And this was the end of the workshop. It was really nice experience for me – first time as couch on event like this. Most of the attendees really wanted to learn something new. We (coaches) had nice time helping and answering questions of attendees and Petr did a great job as instructor.