Code a space adventure game in this Python programming book published by No Starch Press.
11 October 2013
Yesterday was Super Thursday when book publishers release their titles for Christmas. This year, I had a book come out on that very day. My author copies of Scratch Programming in Easy Steps arrived yesterday, and I understand that Amazon pre-orders have also now been despatched.
I'm delighted with how the book came out. It's printed in full colour on slightly glossy paper, so I tried to use images that would pop off the page, and the book does look great in print.
When I was commissioned to write it, I had a lot of latitude to decide how long it would be. I extended the number of pages from my original plan, so that I could include more example projects (including a chapter of seven short projects) and go into more depth on some topics. I'm particularly pleased with the section on making music with Scratch, which shows how you can convert sheet music into music in Scratch (with thanks to Tim Benson, a friend and former music teacher who checked this spread for me). Together with the inclusion of an abstract art project in the seven shorties, I hope this will encourage readers to be creative with Scratch, making not just games but also music, art and other interactive programs.
The book takes a step-by-step approach that shows you how to make a series of games and other projects, but balances that with a full explanation of how Scratch works. I considered that essential because otherwise readers would only learn how to make the project in front of them, and my aim was to enable them to experiment and to create their own projects later. It would be wonderful if readers started inventing their own games and other projects using the knowledge from the book, in the same way that readers of Web Design in Easy Steps occasionally email me to tell me they've built their first website after reading the book. It was important to me that my Scratch book covered the full range of what Scratch can do, too. Important features like lists for storing data are often overlooked in tutorials because they're not easy to incorporate in an arcade game, but I wanted to show readers everything that Scratch can do, so they can draw upon it all in their own projects.
Thank you to everyone who pre-ordered the book or has Liked Scratch Programming in Easy Steps on Facebook. Visit the book's Facebook page to take a look inside the book in a new photo gallery I've uploaded there.
You can find out more about Scratch Programming in Easy Steps here. If you'd like to buy a copy, here are some links for places you can buy the book.
04 October 2013
When I arrived I was impressed to see the scale of the event. I think I expected it to be a gathering of about 50 people, but it looked like there were a couple of hundred people there. As is often the case at community events like this, there was a big crossover between the speakers and the audience, with a significant number of attendees leading sessions to share their experiences and expertise, or showcase some of the great applications they've built.
David Mertz from the Python Software Foundation gave an interesting opening keynote that looked at some of the subtleties of list concatenation, including which approaches are fastest and which are easiest to read. He shared a joke about Guido's time machine, where somebody proposes a new language feature, Python creator Guido van Rossum reads it, goes back in his time machine, and adds it to the original language. That's why when people request new features, the outcome is often that they were hidden in there somewhere all along.
There was then a networking session, which gave people an opportunity to meet others who are from the same region as them. I met with Danny Staple from Orion Robots, who makes easy-to-assemble kit robots. He was able to help with some of my technical questions about Python and kindly talked me through some of the solutions.
Events like this provide an opportunity to see what people are building with Python. Nicholas Tollervey gave an interesting high-level talk about distributed hash tables, a peer-to-peer way of storing data which fits well with Python's dictionary sequence. Geoffrey French demonstrated Ubiquitous Larch, a live web-based shareable programming environment for Python, which I can see being particularly valuable for training and documentation applications. He showed how several people can log in to the same session and collaborate on writing Python code which interacts with web data in real time.
Ian Ozsvald demonstrated how he's been using Python together with scikit-learn for analysing Twitter streams to disambiguate mentions of brands from generic words (separating tweets about Apple computers from tweets about fruit, for example). He took 1,100 tweets with the word 'apple' and marked whether they concerned Apple the company or not and used that to train the algorithm. Half were about Apple the company, and half weren't. He then ran some unclassified tweets through to see whether the program could find the company mentions among them, and compared the results by hand. When he benchmarked his results against a leading commercial solution, he found he was able to double the number of detected company mentions while eliminating false positives. Because I do a lot of work in social media marketing, it was particularly interesting to me to see how a home-brew solution using easily available tools can take on some of the major commercial platforms, although obviously Ian Ozsvald brings a lot of expertise to this, so his success might be hard for others to emulate.
Pyglet is a library for creating visually rich applications and Richard Donkin showed how it can be used together with OpenGL to create a Minecraft-like environment. This session also included demonstrations of two games made for PyWeek, the Python game programming challenge. Daniel Pope demonstrated his Asteroids-style game, and Juan Martinez showed his lunar adventure game which involved exploring different rooms to puzzle out what's happened. Both games were good showcases for Pyglet, especially since they were written within the contest's one-week deadline.
For me, the highlights of Pycon were the hands-on sessions. Zeth led an alternative introduction to Python, which showed some of the sophistication of the Python dictionary. When I first came across the dictionary sequence when I was learning Python, I thought of it a bit too literally, and struggled to think beyond applications like phrase books. You can use it to store mixed types, though, and it gets particularly interesting when you store functions in a dictionary. One person I spoke to at Pycon told me that he had an application that took error codes generated by industrial machinery, and used a dictionary lookup to run the appropriate function in response. Being able to do this without any conditional statements is an elegant solution. Zeth's session also covered classes, which was good preparation for Jonathan Fine's in-depth session on classes and objects later that same day. For both these sessions, I ran Python Anywhere on the iPad, so I could have a console to try examples on.
On the Sunday, there was a Raspberry Jam, led by Alan O'Donohoe. This is the first time I've been to one of these Raspberry Pi events and it was great to see so many young people programming the Raspberry Pi, an equal number of girls and boys. There were a few people developing Scratch games, including some who worked in teams to create a game where you're chased by a bee. Minecraft was incredibly popular, with one team hand-building an elaborate house deep underground, and someone else using two lines of Python code to create a swimming pool in the Minecraft world. There was a demonstration that involved an indoor quad copter floating up and down in line with movements in the Minecraft world too, controlled by Python. I've been having some fun with Python and Minecraft on the Raspberry Pi myself lately, so I can see why it seems to captivate the imagination. It takes something quite abstract (Python code) and turns it into something you can actually walk around inside (a Minecraft world).
Pycon is run by volunteers and I have to say they put on a fantastic show. The event was well organised and the facilities were excellent. The sessions ran from an intermediate level to sophisticated niche applications, and were all led by volunteers too, who had clearly put a lot of work into preparing their talks. The event was possible thanks to the generosity of the sponsors, so thanks also to Bank of America (who sponsored the Raspberry Pi Jam), HP, Python Anywhere, Riverbank Computing, Fry-IT, Server Density, Bytemark, ScraperWiki, AbiliSoft, Cloudfind, 2nd Quadrant, O'Reilly, and the Python Software Foundation.
If you missed this one, put the next one in your diary. Pycon 2014 takes place on the weekend starting 19 September 2014 in the West Midlands, most likely in Coventry again. Early bird ticketing is likely to end in July. If you're interested in Python, I hope you can make it!
© Sean McManus. All rights reserved.
Visit www.sean.co.uk for free chapters from Sean's coding books (including Mission Python, Scratch Programming in Easy Steps and Coder Academy) and more!
Code a space adventure game in this Python programming book published by No Starch Press.
Learn to make games and other programs in Scratch, and make a web page in HTML. Highly interactive book for 7-10 year olds.
Discover how to make 3D games, create mazes, build a drum machine, make a game with cartoon animals and more!