100 Top Tips: Microsoft Excel
Power up your Microsoft Excel skills with this powerful pocket-sized book of tips that will save you time and help you learn more from your spreadsheets.
19 December 2013
I was invited to write a chapter about programming Minecraft on the Raspberry Pi. Once I'd got to grips with the API, I knew I wanted to do something that was computationally interesting, rather than just positioning some blocks to make a house. The idea I hit upon was to make a maze out of blocks that you could walk through, so I wrote a Python program to do that. I've written many games over the years that include mazes, but they were all hand-designed, so it was interesting to write a program that creates something fresh to explore each time you run it, and that can change the size and style of the maze each time too.
Minecraft was an interesting platform for a maze maker program. Often programs like this require a lot of data to be stored representing the walls, but in Minecraft the world itself stored the blocks and spaces that made up a wall or a path. That simplified the program greatly, because I could just test whether a block was there rather than looking up walls in an abstract data structure.
Below is a video of the program in action. You can fly above the maze and look down on it (as I have here) to watch it being made.
The maze doesn't have entrances or exits, and doesn't have goals (although I left a gold block in there to find - it's there so you can see the path the maze maker algorithm takes while the maze is built). I'm sure Minecraft fans can add goals and challenges to this structure!
At the time of writing, the book is heavily discounted at Amazon, and represents fantastic value given its size (470 pages) and scope. I've had a look through it, and I'm very much looking forward to reading the rest properly.
© 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!
This book, now fully updated for Scratch 3, will take you from the basics of the Scratch language into the depths of its more advanced features. A great way to start programming.
Code a space adventure game in this Python programming book published by No Starch Press.
Discover how to make 3D games, create mazes, build a drum machine, make a game with cartoon animals and more!
Set up your Raspberry Pi, then learn how to use the Linux command line, Scratch, Python, Sonic Pi, Minecraft and electronics projects with it.
In this entertaining techno-thriller, Sean McManus takes a slice through the music industry: from the boardroom to the stage; from the studio to the record fair.
Tips, tutorials and free book chapters for Scratch, a coding language widely used in schools.