Wise Cat
Inkscape Pop-Art
Explorer Context Menu
Escher Toy
SingStar Database
Good Grammar
Navigo Review
Cabinet Calcs
Caveman Rock
JSBombs v2.2

JSBombs v2.2

If you want to get to grips with a programming language try writing a game. I chose this minesweeper clone to practice JavaScript because despite the fact it drives me mad, it lends itself quite well to being represented in HTML.


It's basically the Minesweeper game that's been bundled with Windows forever. Click on a square (in default, "dig", mode) to find out what's underneath. If it's a bomb you'll get blown up. If not you'll reveal an empty square or a number telling you how many adjacent squares have bombs in. The aim is to find all the bombs without being blown up.

Click Mode
Clicking on the bomb or flag icons toggles between "dig" and "flag" modes. In dig mode the operation is as above. In flag mode a marker is placed, denoting that this is where you believe a bomb to be. Click on a flagged square in "flag" mode to remove that flag.

Help Mode
Clicking on this icon toggles the help mode on or off (by default it is off). When help mode is on and the cursor is held over a tile which indicates a number of nearby bombs all adjacent tiles are highlighted. This makes it a little easier to see whether you've located all the bombs.

Bombs Left
This counter tells you how many bombs are left to find. Marking a square in "flag" mode reduces this counter. You can only place as many flags as there are bombs. If you've placed all your flags and not won the game then some of them must be incorrectly placed.

The odometer affair is used to set the difficulty. The value is an approximate percent coverage of the game board with bombs (on this 10x10 grid, approximately the number of bombs that will be placed). Use the up and down widgets above the digits to change the numbers. Changes will be picked up the next time you restart.

None that I know of. If you find any, or have any other comments let me know.

Techie Stuff
The game itself is basically made up of two "classes"; one for the board itself and one for the tiles. The board (perhaps obviously) is basically an array of tiles with methods to set it up and clear it. Thie tiles have properties for their status and image and methods for handling mouse clicks and drawing the image. In addition to these there are a couple of routines for checking if the game has been won and automatically clearing the empty tiles (that one took some doing).
In addition to these I use a couple of other classes for the difficulty counter. One for each individual digit and one for the whole thing.

Planned for further development, maybe restricting the difficulty to three levels and using cookies to remember your best times between visits (that'll be something new to learn). Cookies could also be used to allow resizing of the game board.

© 2008-2009 unstableOvine | Hosting by hostmonster.com - Unlimited Space, Traffic & Domains for $6.95/month