Nibbles (video game)
|Mode(s)||Single-player, Multi player|
Nibbles, also known by the source code's file name NIBBLES.BAS, is a simple variant of the snake video game concept used to demonstrate the QBasic programming language. Nibbles was written in QBasic by Rick Raddatz, who later went on to create small business companies such as Xiosoft and Bizpad.
The game's objective is to navigate a virtual snake through a walled space while consuming numbers (from 1 through 9) along the way. The player must avoid colliding with walls, other snakes or their own snake. Since the length of the snake increases with each number consumed, the game increases in difficulty over time. After the last number has been eaten, the player progresses to the next level, with more complex obstacles and increased speed. There is a multiplayer mode which allows a second player to control a second snake by using a different set of keys on the same keyboard.
Nibbles was included with MS-DOS version 5.0 and above. Written in QBasic, it is one of the programs included as a demonstration of that programming language. The QBasic game uses the standard 80x25 text screen to emulate an 80x50 grid by making clever use of foreground and background colors, and the ANSI characters for full blocks and half-height blocks. Microsoft's 24kB QBasic version was copyrighted in 1990. Because of MS-DOS's prevalence at that time, it was available on almost every PC in the early 1990s. Modern computer speeds have rendered the game-speed-delay timing loops invalid, and thus the QBasic version of Nibbles requires some code changes to operate correctly on modern PCs. However, the adjustable clock rate on the DOSBox DOS emulator allows the original code to run at speeds similar to those on the original hardware. Nibbles is also runnable on QB64 as a way to avoid emulation.
QB64 includes a copy of Nibbles adapted to be run at proper speed under programs\samples\misc\nib64.bas.
-  source code on github