User avatar
Posts: 177
Joined: Wed Sep 19, 2012 10:27 pm

Linux User & Developer #117 - PiPong

Mon Oct 29, 2012 3:33 am

On pages 46-52 there's an article by Liam Fraser about creating a simple Pong game using Python + Pygame on the Raspberry Pi. Unfortunately I'm finding it impossible to follow because the code is all over the place. Portions of it are in included in sentences inside the article text, other parts are broken out in little green boxes on the sides.

[ Some of the code listed is enclosed in brackets which shouldn't be there at all ], and then in the middle of that code listing they might throw some more code surrounded by a box ("Figure 4"). One page has code listings in no less than 4 different font sizes, some on a white background, some on light blue, some on white surrounded by green.

What in the hell. I thought I was going to sit down, relax, and enjoy typing in some code from a magazine old-school style. I'd rather enter 5 pages of straight machine code on a Commodore 64 from one of those old magazines -- without even having a floppy or tape drive to save it on -- than go through this again.

Fortunately I remembered the magazine came with a disc and the code is included. Looking at it now, I can see I would never have managed to enter it correctly by following the article. I haven't bothered trying it yet as I have a headache now.

User avatar
Posts: 1382
Joined: Sat Sep 15, 2012 10:35 am
Contact: Website

Re: Linux User & Developer #117 - PiPong

Mon Oct 29, 2012 5:17 am

I don't know what libraries I need in wheezy to get this invaders game working :( it's based on a shooter game he wrote but I can't find that game maybe in MagPi or somthing ... ce-invader

I got it I had to add

Code: Select all

#!/usr/bin/env python
as the first line in save and run can't wait for pong. - always looking for content feel free to ask to have it posted. Or sign up and message me to become a contributor to the site. Raspians is not affiliated with the Raspberry Pi Foundation. (RPi's + You = Raspians)

User avatar
Posts: 177
Joined: Wed Sep 19, 2012 10:27 pm

Re: Linux User & Developer #117 - PiPong

Mon Oct 29, 2012 12:54 pm

Ended up running "PiPong" straight from the code included on the disc -- the program itself is fine, but as mentioned above trying to enter the code directly from the magazine is a nightmare.

Tried the invaders game you linked and that works fine, too. Except I don't see how to exit when running it directly from terminal without X ... ? Same thing with PiPong if I remember correctly.

User avatar
Posts: 35
Joined: Sun May 13, 2012 11:03 am
Location: Northampton, England

Re: Linux User & Developer #117 - PiPong

Mon Oct 29, 2012 8:46 pm

The most recent issue, #119, continues with this game, and although I haven't read it all the way through, it seems better than what you described, with code at the end of every point.

Posts: 1
Joined: Thu Aug 06, 2015 8:52 am

Re: Linux User & Developer #117 - PiPong

Thu Aug 06, 2015 9:08 am

It gets worse - if that's possible. They included a reprint of that article in a book called Raspberry Pi for Beginners that's sold in WH Smiths for £12.99

I agree wholeheartedly with the lead post on this thread - the code presentation and logic of how it's laid out is all over the place. How on earth the author or editor thought that a beginner could ever follow this is beyond me. I bought the book for my grandson, who's 12, and wanting to learn coding. You'd expect that anything in the book should be easy to follow and free of errors. In a section entitled 01 Coding the class initialiser the text makes a cross reference to a section on Page 157 - this has absolutely nothing to do with the pong game artile at all and is part of the overall glossary for the book. A little digging and, of course, the code you need is on page 139 in yet another side listing. What they've done is simply reprinted the original article without checking for any references that need changing. That's just an example of the general sloppiness and laziness that went into this.

Other gripes include not even mentioning whether the code requires Python 2 or 3 - another issue that could easily confuse a beginner.

I've been developing software professionally for over 30 years so was able to help my grandson over the horribleness of this project. If that were not the case I'd suspect that stuff this bad would put him off coding for life.

Return to “Other projects”