Teaching game

teach logo

working title for game

I have an irrepressible habit of turning everything I can into a game, so when searching round for a game idea I could create for myself, my job seemed an obvious inspiration. One game I’ve enjoyed playing is Diner Dash, and I fancied the idea of creating a similar sort of game about balancing the needs of a class of students and reaching the goal of good exam marks.

It also seems to be the ideal type of game for object oriented programming, with classes of students extended into sub-classes of different types of student, all of whom have slightly different needs. One-to-one teaching is straightforward, but the wider the variety of students in the class the tougher it will be to achieve success. The possibilities are endless!

Having mapped out the original idea, I need to start with a single student and work out the balances between the different variables to achieve reasonable gameplay.

I decided to stick to Python for now, although other options are Flash, Greenfoot or Scratch. Each of these offer easier access to graphics, but if we are to be using Python in school I need to have as much experience in it as possible. Flash also has the drawback of not being available on devices using iOS, which suggests to me that its days are limited, and Scratch, while great for first experiments, feels too self-contained to have wider use, while Python and Java/Greenfoot are more widespread and will run on a wider variety of machines and situations.

Next issue was the choice of editor. I started writing my code in Geany, as this is more compatible with pygame and other GUI modules, but then remembered that for the earliest versions it’s easier to test as I go along and for that I need IDLE, which allows me to type in commands directly. Having written out a first example of my code in Geany, I ran it in IDLE, tested some of it, and then amended the code and tried it again. Here I hit the first problem: I suspect that IDLE and Geany handle the indenting slightly differently, and so the code written in the two different editors threw spacing/tabbing errors. Having forgotten my earlier learning and not kept a log or changed file version, it took a bit of fiddling before I was off again, but this time I kept a log open to keep track of progress.

Adding in complexity to make the variables more interdependent proved successful on one level, but I need to know exactly what effect each variable is having, so at this point I’m moving to a spreadsheet so that I can explore the impact of different variables and weightings on the overall game more easily. I also need to draw up a proper flowchart so I can see what is happening.

I’m beginning to realise that this game will take lots of skill in lots of different areas: a spreadsheet model to explore the effects of the variables, maths skills to play around with the weightings, an understanding of game mechanics to achieve a playable game, graphics design to create the graphics needed, writing skills to write game instructions and even music skills to create music for it. And that’s before I even get to the coding skills!

At this point also I’m beginning to understand more of what my students will need to do when writing up their coursework, and appreciating the need to keep careful records of design ideas and progress. And thinking of the fun I’ll have playing with the settings to make sure that I don’t hit problems with transferring back to Geany as my editor!


on computers and female geekism

computer kit with lots of components

build your own computer kit

I and most of my family headed to Margate today for GEEK 2013 (Games Expo East Kent). I and one son went last year and enjoyed the talks and discussions that took place. I was disappointed that there didn’t seem to be scheduled talks this year, and I felt the whole event was much more about looking back and being a games consumer than looking forward and being a games creator, whereas last year the balance was better. Still, there was the main hall full of games consoles for people to play (didn’t spot any ZX81s this year, but spotted a couple of BBCs and Commodores with things like 10 John was here 20 goto 10!) and the upper hall with stalls and exhibitions.

Youngest son enjoyed the halo and minecraft most, of course. Hubby and I found more of interest in the upper hall, where alongside the cosplay there were also electronics demonstrations. The Pi and Arduino workshops turned out to be a couple of people showing what they were and promoting them, and I had an interesting chat with one man about computers and schools and programming and electronics.  There was also a gentleman selling kits to build your own computer. The kits cost £20, and the end result was a tiny circuit board, smaller than a pi or arduino, that included a fully working keyboard (8 keys), plugs into a TV and can be programmed to produce simple games – think of a ZX81 DIY kit, but much smaller.

We decided to buy two, one each, and left the man with our padded envelopes full of components. The instructions are available via the website, and there is also a support group who we are told are active in producing listings and ideas.

Expect to read more about this project over the coming weeks as and when I get a chance to build it and play with it, but the other thing that struck me during the day was how male-oriented the event was. Everywhere you looked, there were boys crowded around screens, playing, watching, discussing, and females were definitely in the minority. There were a couple of talks in the end, unadvertised but announced on the day, one about the history of games and promoting the speaker’s book, and another from a couple who were promoting their film on the games industry in the UK, and through those there was also definitely the message that the games industry is dominated by men. (There was another unadvertised talk, too, a Q and A with indie games developers, but that was scheduled at the same time as the movie talk, which was rather irritating as I would have liked to attend both.)

So why is the computer industry so male orientated? This was something I pondered as I returned to the house and sorted out making tea and organising the washing machine and dryer, pottering around doing various household tasks before finally managing to sit down and get the laptop out.

Is that part of the reason? That the boys who dabbled in computers grew up into men who dabbled with computers, while the girls who dabbled grew up to take care of the house and children and had no time left for playing? That the boys are eager to try things, and the girls much more likely to step back and watch them? The same thing that makes men more likely to figure things out for themselves and women more likely to ask for help? The same thing that makes men more likely to be competitive and women more likely to be co-operative?

Is this innate or is it culture-related? While men are those making games, they will make games that appeal to men, which means men are more likely to want to enter the industry and make more games. While women are content to step back and let the men get their way, how can they change things?

When I studied a foundation course with the open university, as part of the science module we learnt about how it was not until women joined the scientists that a whole new side of the way gorillas behaved was recognised. In the same way, it’s not until women really push themselves into the computer industry that the industry will grow properly and become more balanced.

The idea of introducing computing right from the start of the educational progress is a big step towards that, if done in the right way: if we can introduce it in a way that doesn’t alienate half the population. In the same way that we need to get over this “cool to be useless at maths” attitude, we need to get over the “I can do email and facebook, what more do I need” attitude about computers.

Getting back to the kit, I feel like I’m on a quest to find out how computers really do work. The programming side is straightforward, and I understand the theory/software side of things. What I don’t understand is how the hardware makes these things happen. That’s part of what my electronics experimentation is about, and I welcome this chance to take my knowledge back a stage further, but at some stage I still want to know how the software is acted on, how the processors themselves work.

In the meantime, it’s back to school next week…


codeword success

codeword gui version 1

first idea for a GUI

It only took a screenshot of my project in action to put myself back on the right path, and a very pleasant afternoon was spent adding the last piece of functionality to it – as a reminder, it’s a program that allows me to enter the settings for a codeword grid, which is a puzzle that looks like a crossword but with number standing for letters. The user tries out a letter in place of a number and eventually solves the whole puzzle, with each number representing a different letter. My program does not create or provide puzzles, but instead you can use it as a tool to help solve commercially available puzzles, to save scrubbing out incorrect guesses.

I had got it to the point where it would display the grid in the console and accept changes via direct entry in the console, so what was left to do was to provide a list of what letters had been used already and to not allow the same letter to be used for two different numbers.

Writing code for the list proved to be straightforward – rather than delving into different data types and debating which was best, I opted for a simple list, with the first entry at index 0 set to “*” and the rest of the entries set to ” ” (space). Adding a letter for a specific number then involved setting the list at that index to the letter, and resetting involved setting the entry back to a space.

I could then call these list functions as part of the setting and resetting a letter, and check whether a letter had been used already before allowing it to be entered into the grid.

My code at the moment has very little help for the user (hence part of my problems yesterday!) and it has very little error checking for input, but neither of these is a real issue as the intention is to put a GUI on the front of the code, to handle display and entries.

And here I hit the next issues: issue one is how to create a GUI in python and issue two is which editor to use to create it.

The book I’ve been working from suggests pythoncard, but I have not been able to install this successfully. I’ve managed to establish that Tkinter is already available as part of the python standard library, but it carries a warning that it will not run with the basic python IDLE, as that does not handle events properly, so that then leaves me looking around for an editor that will do the job.

I enjoy working with the IDLE, as it’s incredibly straightforward, and I object to using more time figuring out how to use an editor than I spend actually coding. I’ve got Eclipse that I’ve used for Java, and I’m currently looking into using that with a pydev plugin, but I’m starting to get frustrated by all these different options, which all seem designed to provide high levels of support with very complex projects and make life very complicated for the casual user who just wants to create a simple project.

The other IDE that I’m trying out is Geany, which I recognise as the software that originally came on my raspberry pi, and so I have used already for python. I’ve got it running with my codeword software, but when it gets to the end of the program, which goes as far as creating the grid, the program then seems to terminate without allowing me to enter further commands via the console. If I can put a GUI onto the program, then the console won’t be needed anyway, but it’s just another frustrating step.

I think with fondness of the days when I learnt programming, when we used C++ with an IDE that allowed us to design a GUI and attach code to it really easily. Even the Java editor we used back in those days seemed far more straightforward, even though I never did really get the hang of the different containers that you could use for java layouts.

Surely these things should be getting easier, not more complex?

Incidentally I’m now running a log of my project, with notes for each version change on what I’m attempting to do. Each feature is being developed piece by piece, with constant resaves as different versions – all versions ending in 4X are the basic version, while 5X added in the list and 6X used the list to check whether the letter was available before using it. I’ve also included screenshots of the project in action and a first sketch of what the interface might look like.

Hopefully if I end up leaving the project again for an extended period (for example while I build up my GUI skills) this log will make it much easier next time to pick it up and catch up with progress. I can’t say I understand every line of the code I’ve written or could duplicate it easily, but at least I know enough to know what it does and how to use it, and which functions are available.


Picking up the pieces

codeword throwing an errorIt’s been a while – a hectic six weeks of term, until finally we’ve reached half term and I have time to try to pick up the pieces of my technical developments and see if I can make progress with them.

I left a few projects hovering: there’s the virtual pet that I started in Scratch and app inventor, the Simple Simon game that I made in Scratch and started to convert to app inventor, the general learning I was doing with Python and the codeword project that I started in Python.

It was the codeword project that’s been my ambition for longest, and the project that I remember as the furthest developed, so that’s the one I’ve opted for first. And there I hit my first problem.

Just in trying to pick up the pieces of this project, I’ve learned several things: that it’s really hard to pick up a complex project after so long, that without any real structure it’s difficult to pick it apart and get an overview, and that with no log of changes it’s hard to even find which version to use! I’ve got versions of the file from codeword to codeword6, plus codeword4a and codeword4b. I’ve gone back to codeword4b, as that contained a note saying it was the latest – but of course there’s nothing to say I didn’t progress further and just not remove the note. I remember the project being workable via command line codes, but now it doesn’t seem to respond to even the simplest of commands.

This blog is probably the place I’ve documented my project the most, so I guess I’ll have to read back and see if it’s any help. In the meantime, I really need to pick the code apart and understand it thoroughly, and produce some sort of map or algorithm so that I know how it all ties together – although algorithms/flowcharts become rather complicated when they’re event driven rather than procedural!

In the meantime I’ve learnt that even the most straightforward of projects needs to be thoroughly documented and planned before coding, and that actively writing and testing code is just a small part of any software project. Managing your code so that it can be easily understood and followed, and leaving some sort of explanation to progress, and building in error checking are also incredibly important.

I’ve also proved the point that software needs concentrated effort to get to grips with, and picking it up only for a short while can be counterproductive, as it can take so long to catch up with where you were that you never actually have time to make proper progress. On the other hand, maybe  little and often isn’t too much of a problem – but little and seldom definitely is a no-no!