Shop OBEX P1 Docs P2 Docs Learn Events
Propeller Nibbles (based on the old QBASIC game) — Parallax Forums

Propeller Nibbles (based on the old QBASIC game)

Dennis FerronDennis Ferron Posts: 480
edited 2006-12-01 03:07 in Propeller 1
For those of you who don't know, Nibbles is the "original" snakes game, afaik. It was released, in source code form, with every copy of QBASIC, and was on the school computers at my high school. Hacking the code to this game, along with Gorillas, gave me some of my first programming experiences.

So far this is just a nonplayable demo version, but I thought I'd let you guys see what I've been up to. It runs on my suitcase computer but should be compatible with the demo board too. The original QBASIC game didn't include a computer player, but I've put the snakes under "AI" control because it's easier to develop the code if the computer can play for you each time you test the program. And because I haven't gotten around to adding the keyboard code yet.

It turns out that it's pretty hard to make a Nibbles AI player that doesn't get itself stuck in corners. This one randomly commits suicide sometimes too, because it was just a quick hack and the avoidance algorithm isn't reliable.

Most of this code I wrote in one all-nighter when I first learned Spin, so it's all quick and dirty. I waste a lot of CPU resources because the computations for a snake game are so simple that I didn't have to optimize anything; I just took the graphics demo code and hacked the Smile out it. I've only had time to tweak it since then, rather than really add to it, hence the lack of scoring and human control. When I get my Hydra, I'll port it to that and put these things in.

After many years of course I have thought of some "improvements" to the original QBASIC Nibbles. For one thing, in the original, when you hit a wall you die and both players have to start over. In my version, when a snake hits a wall, it leaves behind debris in the form of pieces of wall where the snake was, and play continues. The more you run into things, the more dangerous the playing field gets.

Comments

  • Ym2413aYm2413a Posts: 630
    edited 2006-11-30 22:28
    Cool, you should port the game to the Hydra!
  • Dennis FerronDennis Ferron Posts: 480
    edited 2006-11-30 22:35
    Ym2413a said...
    Cool, you should port the game to the Hydra!

    Looking forward to it! I might have to wait until after January to buy one though - I have moving expenses coming up right after Christmas time, and as much as I want a Hydra right now, it'd be better to wait until I'm safely moved than to spend the $250 now and find out that's $250 I didn't have to spend.
  • M. K. BorriM. K. Borri Posts: 279
    edited 2006-12-01 03:07
    Nice! I got my start in programming by modifying the 2-player nibbles into Lightcycle...
Sign In or Register to comment.