8×8 Snake v2

A couple of weeks ago the lovely Lisa Mather (party planner extraordinaire) put out a request on Twitter for party games. This was for the Manchester Raspberry Jamboree after party on the 28th February (more on the jam in my next post).

So, having already cobbled the basic Snake game together in December I offered to polish it up a bit and add scoring functionality. In addition I felt it needed a better control interface than the keyboard, so a quick shout out to some local friends and I had a Quickshot II+ from a Spectrum ZX81 – it even has the clicky micro switches that any child of the 80’s instantly recognises – mmmmm, retro.

The core code from my last post hasn’t changed much, the main differences are;

  • swapping keyboard input routine for GPIO pins detection – one for each switch in the joystick (up/down/left/right/fire)
  • implementing code to record scores (1 point for each piece of food) and using two of the 4x seven segment displays from the Delorean Time Circuit for displaying them

Snake Wiring

Wiring was a pig (as you can see), but worth it in the end; even if I did have to do some gorilla soldering on Friday when a couple of leads came loose.  I highly recommend buying at least the 8×8 grid as a PCB kit (e.g. Pimoroni or CPC) to save your sanity.  The desoldering of the seven segments and subsequent wiring you see here took me a goodly portion of my Sunday afternoon 🙁

In the picture you can see 5 (extra chunky) resistors on the breadboard.  These are being used to pull the GPIO pins low (or off).  As the joystick is moved, the internal switches will complete the circuit with the +3.3v line (red wires) which will set the attached pin high (or on).  This is detected by the code and the snake moves the chosen direction (if it’s allowed to of course).

The game had a lot of interest and went down well with young and young at heart. The high score went to both Oliver (who achieved it first) and Michael with a score of 22!

Chris (3rd - 21) Michael  & Oliver (1st - 22)

Chris (3rd – 21) Michael & Oliver (1st – 22)

[updated source to follow]