5x5 Updated...... V1.5 The Knights Gauntlet.......... Now with demo mode.

721 posts
Thanks Meter: 104
By stephj, Inactive Recognized Developer on 26th April 2009, 09:17 PM
Post Reply Email Thread
There is a game on the iPhone called Lights Out where the object of the game is to light up or knock out all the lights in a 5x5 grid. When a square is selected that square and its four immediate neighbours, above, below, and to each side invert. There is no wraparound. The object of the game is to get all the squares black.

At the risk of revealing my age, I saw a hand held version of this game in the early 1980's.

When mastering any new programming platform, this application becomes the standard with which I start. I know the logic, so the problem merely becomes getting the thing to run under the new platform. I wrote this in 2005 while fighting my way through the very steep learning curve of Embedded C++. Previous platforms for this program have been, ZX81, BBC Micro, DOS, Windows and finally Windows Mobile. Next stop Linux!

It is an example of minimalist programming on WM. Written in Embedded C++ as a Win32 application it is targetted at ARMv4 chipsets. As such it should run on all PPC versions from Windows Mobile 2002 onwards. The menu is limited to two main items, so WM 5/6 will display it as a WM 5/6 app. Minimalist programming means it can be distributed as as a single .EXE file of a mere 9.5 Kb in size. The DLLs it calls are already on your device, there is no need for a .CAB installation.

It has 5x5, 7x7 and 9x9 grids, all are solvable.

I hope you enjoy it. It will keep you quiet but it might drive you totally nuts!

UPDATE!!! Now works with 480x800/240x400 devices, see later posts for the details.

UPDATED!! Version 1.2 released.

Changes: 11x11 grid added. It is solvable, but it took me a while to figure it out!. You may need a stylus as fingers may be a bit too awkward. For that reason, I do not intend to go to 13x13 and beyond.

The short display glitch on initial program load now fixed.

Game and drawing code optimised. (There are often better and faster ways to do things, if you take the time to look.)

UPDATED!! Version 1.3 released.

Now also runs on both Pocket PC and SmartPhone devices. Now runs on any sized screen, even those that have not been released yet! The blank screens that were reported in later posts are now a thing of the past. Here's the method, take the width and height of of the client area and size the game to 90% of smaller of the two. Why did I not think of that in the first place?

SmartPhone users:- Welcome aboard! Image attached below: The white square is the target square. Move it to the square you want to change with the D-Pad/Arrow buttons, then press 'Enter' to change it. Smartphones prior to Mobile 6.0 may not have the 'File Explorer' application. (It depends on the OEM build). In this case, use ActiveSync. Connect to your phone and drop the unzipped 5x5.exe file via the 'Explore' option into the \Windows\Start Menu\Programs\Games\ directory, and it will appear alongside Solitaire and BubbleBreaker in the games menu of your device. Smartphone 2002/2003 users need to use \Storage\Windows\Start Menu\Programs\Games\

Pocket PC users won't see any change, just tap the square you want to change. The program looks at which platform it is running on, and behaves accordingly.

UPDATED!! Version 1.4 released. - The Knight's Gauntlet.

Just when you thought you've mastered it, the Knight's Gauntlet is firmly thrown down. Selecting Knights from the main 5x5 menu, changes the pattern of squares that are inverted to those a knight's move away in chess, (two forward, then one to the side), as per the Knights image below. Up to 9 squares will invert on each move. As per changing the grid size, toggling the knights game on and off will restart the game.

All four grid sizes are solvable, but you are warned, it is a lot harder than the normal cross game.

It was only a small change to the game logic, and this program was all ready to go in September, but I would not release it, until I had proved to myself that it could be done. A brute force attack can be used to break the 5x5 Knight's game but as the grid gets bigger the problem grows exponentially. A quad core processor running a console C++ application, using the SSE3 PC registers (XMM) macros to play one move on the entire board in one machine instruction, was not enough.

I had to use a special version of the mobile program that could dump the state of the board and moves out to a file to be analysed by the PC later by a suite of programs that could combine boards together by the thousands. All good fun!

On and off, it has taken me three months to find the knights solutions to the 7x7, 9x9 and 11x11 games.

UPDATED!! Version 1.5 released. Now with demo mode.

For those who think it is impossible, let the demo mode show you how to do it.... But there is a slight twist........ You will be shown the same solution for each puzzle each time, but the moves are shuffled and they may also be reflected or rotated, just to confuse matters further. Shuffling the moves, rotating, or reflecting, logically, has no effect on the final result.

Happy puzzling!

18th Feb 2010 update fixes WinMo 6.5.3 Dialog box issue mentioned in

23 June 2011 CE version added. Note this version is for Windows CE, ARM powered devices only, as is displayed in the last of the images below. Don't run this version on a WinMo device the display will look awful! As an extra caveat, it will only run properly if the OEM of your CE device has built the OS with components that are expected by the 'Standard' version of the SDK as used by EVC 4.0.
Attached Thumbnails
Click image for larger version

Name:	Knights.JPG
Views:	171
Size:	30.6 KB
ID:	260335   Click image for larger version

Name:	Smart5x5.JPG
Views:	87
Size:	26.6 KB
ID:	260336   Click image for larger version

Name:	5x5.JPG
Views:	91
Size:	29.8 KB
ID:	260734   Click image for larger version

Name:	CE5x5.JPG
Views:	59
Size:	19.3 KB
ID:	634145  
Attached Files
File Type: zip - [Click for QR Code] (5.6 KB, 140 views)
File Type: zip - [Click for QR Code] (4.9 KB, 66 views)
26th April 2009, 10:13 PM |#2  
Junior Member
Thanks Meter: 0
Any screenshot?

26th April 2009, 10:25 PM |#3  
l3v5y's Avatar
Retired Senior Moderator
Flag Bristol
Thanks Meter: 42
Donate to Me
Nice little game.

Attached Thumbnails
Click image for larger version

Name:	5x5.gif
Views:	5436
Size:	9.9 KB
ID:	180440  
13th May 2009, 10:03 PM |#4's Avatar
Thanks Meter: 0
Small problem

I'm probably missing something here, but I get a white screen without anything I can actually do with it (using Omnia).

Any help?
13th May 2009, 10:25 PM |#5  
deedee's Avatar
Senior Member
Flag Coleraine
Thanks Meter: 26
Donate to Me
Grief that is going to be addictive.

So simple yet so tricky at the same time.
13th May 2009, 10:33 PM |#6  
Senior Member
Insjön (almost in the forrest)
Thanks Meter: 0
works fine on a SQVGA (320x320) device to, and im after 1 minute angry ....
14th May 2009, 12:39 AM |#7  
tatnai's Avatar
Senior Member
Flag Ann Arbor, USA
Thanks Meter: 235
Donate to Me
very nice; solved 5x5 - 9 clicks. going to try to crack 7x7
14th May 2009, 12:41 AM |#8  
galaxys's Avatar
Senior Member
Flag Cosmos
Thanks Meter: 2,129
this is lot's of fun & a little tricky!
14th May 2009, 12:59 AM |#9  
the0ne's Avatar
Senior Member
Flag Melbourne
Thanks Meter: 52
nice game
14th May 2009, 09:17 AM |#10  
Junior Member
Thanks Meter: 0
Thumbs down
Does not work with my HTC Touch HD (WVGA 800x480)
I got a white screen.
14th May 2009, 09:25 AM |#11  
DaVince's Avatar
Senior Member
Flag Manila
Thanks Meter: 34
Originally Posted by stephj

At the risk of revealing my age, I saw a hand held version of this game in the early 1980's.

LOL at remark above ^^

Nice little time waster you have here! Thanks!
Post Reply Subscribe to Thread

Guest Quick Reply (no urls or BBcode)
Previous Thread Next Thread
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes