Another example of C++ Win32 minimalist programming from the 'stephj' stable. The whole lot fits in one 17Kb executable.
The peg version of 'solitaire' as usually played with a wooden board and marbles. To play, hop one counter over another into an empty square on the far side either horizontally or vertically, and remove the counter that has been jumped over. Click or tap the counter you wish to move, and if it can be moved, all possible target positions for it will be highlighted in dark grey. Click or tap one of these targets and it will hop over and remove the 'jumped over' counter.
The object is to end up with one solitary counter in the middle of the board. Easier said than done, so there is a useful 'Undo' function allowing you to back out the previous move, all the way back to the starting pattern if you wish. Try that with the real marble version! There are fourteen patterns from which to start, the default being the 'Classic' starting position. All are solvable, start with the Cross pattern if you are struggling!
Here's the clever stuff:- It will run on any ARM powered Pocket PC or Smartphone from 2003 onwards. (ARMv4 onwards, possibly even 2002, I haven't had chance to test it on this platform.) It will also handle any sized screen as it dynamically resizes to fit it. Portrait, landscape, square or HVGA. Who cares, bring it on! The HVGA compatability should help quell the increasingly vociferous HD Mini owners, who are not too keen when Apps look a mess on their devices.
A Smartphone has no touch screen, and as such the white dot appears as a cursor. Move it with the D-Pad to the counter you wish to move and press the centre button. Possible targets appear dark grey as above, move the cursor to the target, and press the centre button again to hop over.
The program is aware when you run out of possible moves and will tell you so. Land the last counter in the middle hole to successfully complete the puzzle.
On your device the card game Solitaire provided by Microsoft, is included as part of the standard OS. It exists as a .lnk to the real executable. This program is an .exe file of the same name but it identifies itself to Windows Mobile as PegSolitaire so that it will not conflict with the cards game, if they are running simultaneously.
It is possible to drop the executable into \Windows\Start Menu\Programs\Games and it will live next to the real MS Solitaire program link - See the StartMenu image. If on your device the card game is stored here as Solitaire.exe, rename the attached file to 'Peg Solitaire.exe' or whatever you want to call it.
Only the executable is required, as all the DLLs it uses are already on your device.
It used to have quite nice 3D rendered counters, but the trials and tribulations of getting it to run on as many different displays as possible, without it looking dreadful, was just not worth the hassle. Eventually I opted to drop the 3D stuff for the retro look, as seen below.
Happy puzzling!
Patterns bug.
If you were one of those who downloaded this before the date of this post, there is a bug in the shapes section of the menu.
The Circle, Double Arrow and Diamond patterns did not match the menu. They pointed to the next one of these three.
This problem has now been fixed and the app reloaded.
My apologies for the inconvenience.
CE version added.
This has now been ported over to run on ARM powered CE devices.
Do NOT run the CE version on your Windows Mobile phone or Smartphone, and likewise, do NOT run the phone version on a CE device.
If you do, the display looks awful. You have been warned.
Happy puzzling, stephj.
CE version added.
Doesn't work in Windows Embedded CE 6.0 Professional (800x480): Initial screen properly shown (looks great), but then no reaction to stylus.
I have run this on the 4.1 and 5.0 CE SDK emulators, and it works a treat. Unfortunately I do not have a real 'CE' device to test it on but I may be able to get access to one if required.
Remote debugging can prove to be a bit awkward but here goes......
First of all. - Nothing happens until you click or tap on a yellow counter that you can actually move, when the destination 'hole' is then illuminated in dark grey. Tap on this dark grey hole to jump the counter over.
Do the menus work when you tap on them?
What exactly are you trying to run this on? Make model etc.
The program responds to the WM_LEFTBUTTONDOWN message sent to the app by the operating system. This is usually the resonse to a mouse click or screen tap.
Second, run the attached, and what does it report. It returns the co-ordinates returned by the GetClientRect() function.
It should show "Main x x x x - Menu x x x x" with a black bar 20 pixels high across the bottom of the screen, where x represents a value returned.
Report those values or post a screen shot we will use that for starters.......
1) CE 5.0 inbetween is very outdated (but some devices still are based on it), since 2009 CE 6.0 dominates. CE 4.2 you probably only can find in a museum. Emulator with an CE 6.0 image is available from MS free of charge.
2) It shouldn't be of any interest what device (Make, Model) your 'PEG SOLITAIRE for CE 'is planned to be run on. You claimed it should "run on ARM powered CE devices". No restrictions made.
3) Menu seems to work, items are accessible.
4) Result of GetRect is: Main 0 0 454 800 Menu 0 0 24 800
BTW: I'm no longer interested in this game, in no case I'll become a beta-tester.
There is no such thing as a Standard SDK for CE 6.0 like there used to be with 4.2 and 5.0
http://blogs.msdn.com/b/ce_base/archive/2006/12/14/what-exactly-is-an-sdk.aspx
Looks like the OEM's have all gone their own way, anyway.
Under CE 6.0 if you don't have the SDK for the device, which is probably totally proprietary, and not public, then you can't test it in a debug environment, and hence find out what the OEM has changed on the device.
So the disclaimer is now, "Should run under CE 4/5, may or may not run under CE 6.0"
Looks like days of a generic application are over. It's hardly worth the effort.
Windows Embedded CE 6.0 image exists, also Windows Embedded CE 6 SDK exists
FYI
CE 6 image:
http://www.gpspassion.com/forumsen/topic.asp?TOPIC_ID=76695&whichpage=2#963026
CE 6 sdk:
http://blogs.msdn.com/b/obloch/arch...sdk-not-installing-on-visual-studio-2008.aspx
Thanks for that.
Here's the WINCE_6.0.BIN image running in the device emulator.
Solitaire runs a treat.
I can confirm that both versions work - and both look great, running in full screen - on the CE 6 netbook (both 800x480 and 1024x600) as well as on a 7-inch Windows Embedded Compact 7 netbook.
Does not run on WinCE 3 (Windows Mobile 2002) - tested (and failed) on a QTEK 7070.
This game is very interesting. Do you like this puzzle?
tobbbie said:
Does not run on WinCE 3 (Windows Mobile 2002) - tested (and failed) on a QTEK 7070.
Click to expand...
Click to collapse
This program was originally written using Embedded C++ using the WM 2003 and CE 4.2 Standard SDKs.
I have reinstalled Embedded C++ 3.0 and the WM2002 SDK, and the WM2002 Smartphone emulator will not run it the code that works on WM2003.
There are some very subtle nuances between WM2003 and WM2002, which will have to be addressed before it will run properly. I'm on it, but it may take a few days.
This was not meant as a challenge - but if you want to pick that up I will recheck it. No hurry needed anyway - the device is in the museum drawer
Now updated to 1.6
PPC/Smartphone version now rebuilt under the WM2002 SDK. Runs on all versions from WM 2002 to WinMo 6.5.3
As mentioned there were a few oddities to be overcome in trying to retro the thing. Under WM2002 SystemParametersInfo() - used to detect the device platform - PocketPC or SmartPhone, fails with access denied, if it is called before the main window is created. Later versions of WM don't care.
Now runs on the WM2002 as well - tested on a Qtek 7070
I only wish there was a demo mode that brings the shapes to a solution - or something like a roll-back when you feel in a dead end situation.
Oh well - and something obvious: why not have an "Exit" Menu item?! This is missing in all your programs and useful for smartphone where you have no Window Close button.
The roll-back option already exists as the Undo option on the menu. You can roll it back to the original position if required, by the repeated use of it.
The use of a Program Exit option was discouraged by Microsoft in their original Window Mobile interface programming guide, as the programs were meant to sit in the background of the machine until reactivated.
In this case, this program only uses about 70+ Kb of memory when it is running, hardly a show stopping drain on the available resources.
But, if you want it, why not? Now included as 'Exit' on the main Solitaire menu. Program replaced in post #1.
stephj said:
The roll-back option already exists as the Undo option on the menu. You can roll it back to the original position if required, by the repeated use of it.
Click to expand...
Click to collapse
Oh well, you are right - did not notice this. One thought for usability: Can you assign this function to the "2" key - which is usually directly beneath the cursor/D-pad? This could much ease the navigation as it saves you from the "Menu-scroll-enter" sequence. For touchscreen devices a dedicated tap-field could help. I thought suggesting the "back" key for that, but this has a system wide purpose and should not be captured.
stephj said:
The use of a Program Exit option was discouraged by Microsoft in their original Window Mobile interface programming guide, as the programs were meant to sit in the background of the machine until reactivated.
In this case, this program only uses about 70+ Kb of memory when it is running, hardly a show stopping drain on the available resources.
But, if you want it, why not? Now included as 'Exit' on the main Solitaire menu. Program replaced in post #1.
Click to expand...
Click to collapse
I know and I never liked that. If the potential automatic close would also save the current state of any application it would be ok, but it seems that MS has not put THAT to their guidelines. Consequently I would still like to have control which programs run and which not. Other programs have even put that configurable (e.g. Oxios ToDo or Papyrus) but that is overkill I think.
As I use XBAR I can end any running program any time, but part of the menu is better. Thanks for this!
More thoughts for improvements:
show possible moves e.g. by overlaying arrows to the jumps, assigned to a key on smartphone (1 or 3, as 2 should be "Undo")
autosolve feature (animated - from any starting point or possibly with loadable solution paths from the standard start conditions)
coloring adapted to the active color scheme or selectable
skinnable board and pegs
It could be endless and I know that hardly anyone cares for such simple games in the age of animated 3D and Surround sound.
Some of this will be implemented, some of it won't.
Like 5x5 it is a dual platform program, the same executable runs on PocketPC/WinMo Professional and SmartPhone/WinMo Standard. Usually you would release two separate versions each built under the corresponding SDK. This single program looks at which platform it is running on, and behaves accordingly. This means it has to exist with somewhat of a split personality. Some code from one platform must not be run under the other, and vice versa.
Linking the '2' key to the 'Undo' option on Smartphone should be quite easy. Update... Done!
The D-PAD and enter is ignored under PocketPC/WinMo Pro. Under Smartphone, when a suitable counter is selected with enter, the target holes are displayed. I will make the D-PAD respond if it is moved toward a suitable target hole by 'jumping over' it immediately, thereby saving two extra depressions of the D-PAD.
The demo solution option from each pattern starting position could be added, I can quite easily lift some of the code out of 5x5 to do this, as it is a very similar setup. But first I have got to get the solutions! This may take some time........ I'll create a modified version of Solitaire to write out the Undo array if the solution is completed successfully. Once all patterns have been completed, build the data file to load as a program resource later.
Skinning: Looks good but it is a total pain in the butt. It used to have nice 3D rendered marbles and holes, but trying to get it to work and look good on lots of different sized displays turned into a nightmare. Eventually I opted for the vanilla option and dynamically scaled it to fit within 90% of the narrowest side of the display. The code figures this out, and centres the board, having raised it just enough to fit the messages across the bottom.
Colours from a pick list: I'll have a think about it.
"I'll be back"
stephj said:
Linking the '2' key to the 'Undo' option on Smartphone should be quite easy. Update... Done!
Click to expand...
Click to collapse
Thanks - that was fast!
stephj said:
... I will make the D-PAD respond if it is moved toward a suitable target hole by 'jumping over' it immediately, thereby saving two extra depressions of the D-PAD.
Click to expand...
Click to collapse
Will see how well that works. It still seems to rely on your selection to show possible options for the selection. What I was after is to show ALL possible moves of ALL items - probably only by pressing a special key. So you can decide which item to move.
stephj said:
The demo solution option from each pattern starting position could be added, I can quite easily lift some of the code out of 5x5 to do this, as it is a very similar setup. But first I have got to get the solutions! This may take some time........ I'll create a modified version of Solitaire to write out the Undo array if the solution is completed successfully. Once all patterns have been completed, build the data file to load as a program resource later.
Click to expand...
Click to collapse
No hurry - this is a true nice-to-have only. Hunting for solution patterns may be a tedious task. I wonder if there are generic algorithms to solve these (no?).
stephj said:
Skinning: Looks good but it is a total pain in the butt. It used to have nice 3D rendered marbles and holes, but trying to get it to work and look good on lots of different sized displays turned into a nightmare. Eventually I opted for the vanilla option and dynamically scaled it to fit within 90% of the narrowest side of the display. The code figures this out, and centres the board, having raised it just enough to fit the messages across the bottom.
Click to expand...
Click to collapse
Not needed to beautify on the programming level (3D rendering), but simple skinning? I mean just pick the unscaled (upper left) part of a delivered picture for the items to map. This could be board, marbles, holes and background. No sophisticated scaling or positioning. While scaling could be an easy option to supply similar look on all resolutions.
No hurry here either and also no problem if this is off your list.
stephj said:
Colours from a pick list: I'll have a think about it.
"I'll be back"
Click to expand...
Click to collapse
Thanks for your continued efforts, much appreciated.
Hey all,
Does anyone know whether or not the traditional function keys (F1 - F12) can be supported on the keyboard dock?
What initially brought this up for me was that I'm playing around with a terminal emulator that looks to be a port from the desktop version and some of the commands use the standard Fn keys which don't appear to be present on the keyboard dock. More generally though, with amazing new environments like Ubuntu for Android on the horizon the traditional function keys are going to become more of a requested standard feature on the keyboard dock in order to support programs/apps that rely on them.
If anyone has any suggestions or feedback on this it would be really appreciated
Cheers!
oO_SwooP_Oo said:
Hey all,
Does anyone know whether or not the traditional function keys (F1 - F12) can be supported on the keyboard dock?
What initially brought this up for me was that I'm playing around with a terminal emulator that looks to be a port from the desktop version and some of the commands use the standard Fn keys which don't appear to be present on the keyboard dock. More generally though, with amazing new environments like Ubuntu for Android on the horizon the traditional function keys are going to become more of a requested standard feature on the keyboard dock in order to support programs/apps that rely on them.
If anyone has any suggestions or feedback on this it would be really appreciated
Cheers!
Click to expand...
Click to collapse
it can be, but do apps even support it, as for the commands on Fn keys that may be a little bit harder, as the mapping for Fn is a little funny
oO_SwooP_Oo said:
Hey all,
Does anyone know whether or not the traditional function keys (F1 - F12) can be supported on the keyboard dock?
What initially brought this up for me was that I'm playing around with a terminal emulator that looks to be a port from the desktop version and some of the commands use the standard Fn keys which don't appear to be present on the keyboard dock. More generally though, with amazing new environments like Ubuntu for Android on the horizon the traditional function keys are going to become more of a requested standard feature on the keyboard dock in order to support programs/apps that rely on them.
If anyone has any suggestions or feedback on this it would be really appreciated
Cheers!
Click to expand...
Click to collapse
In ubuntu there is a settings menu that allows you to change most of the shortcuts that require the FN key
Hackers k3yboard on the market has f keys i think. And cursor keys..
Sent from my Transformer Prime TF201 using XDA Premium App
lilstevie said:
it can be, but do apps even support it, as for the commands on Fn keys that may be a little bit harder, as the mapping for Fn is a little funny
Click to expand...
Click to collapse
Do apps even support it? No not generally for Android, however, lets say for argument's sake that TFP is running Ubuntu for Android. It wouldn't be unreasonable to suppose that in that environment you would have a desktop package installed that ran in Ubuntu running on your TFP. In this case, that desktop application may have support for the F1-F12 keys (think of your favorite developer's IDE for example). In this scenario, the current layout and key-mapping of the TFP dock isn't supportive.
doddsie said:
Hackers k3yboard on the market has f keys i think. And cursor keys..
Sent from my Transformer Prime TF201 using XDA Premium App
Click to expand...
Click to collapse
Sorry for not being clear, I'm interested in extending the capabilities of the TFP keyboard dock so that it could be used instead of resorting to a soft keyboard.
mtotho said:
In ubuntu there is a settings menu that allows you to change most of the shortcuts that require the FN key
Click to expand...
Click to collapse
I don't believe that helps with app specific Fn button mappings
oO_SwooP_Oo said:
Do apps even support it? No not generally for Android, however, lets say for argument's sake that TFP is running Ubuntu for Android. It wouldn't be unreasonable to suppose that in that environment you would have a desktop package installed that ran in Ubuntu running on your TFP. In this case, that desktop application may have support for the F1-F12 keys (think of your favorite developer's IDE for example). In this scenario, the current layout and key-mapping of the TFP dock isn't supportive.
Click to expand...
Click to collapse
ubuntu looks at the keymap in terms of a number, with a kernel patch you can make it report the number associated with F1-12, in fact this patch is in place in my upcoming native ubuntu for tfp
lilstevie said:
ubuntu looks at the keymap in terms of a number, with a kernel patch you can make it report the number associated with F1-12, in fact this patch is in place in my upcoming native ubuntu for tfp
Click to expand...
Click to collapse
Really looking forward to this! Even following you on Twitter so I don't miss an announcement
It's the sole reason I bought my Prime.
You can map any of the keys you'd like via /system/usr/keylayout/asusdec.kl
Find a key you want to change, and make its assignment F1 (or whatever Fkey you need). Save, reboot.
Whether or not that keysym gets passed through to your app depends on the app itself.
agentdr8 said:
You can map any of the keys you'd like via /system/usr/keylayout/asusdec.kl
Find a key you want to change, and make its assignment F1 (or whatever Fkey you need). Save, reboot.
Whether or not that keysym gets passed through to your app depends on the app itself.
Click to expand...
Click to collapse
Ya that would work at the cost of losing an existing key due to the re-map. Rather than lose key functionality I think that lilstevie's response above sounds like the way to go. That way the keyboard dock would be able to report a key combination such as Fn + 1 = F1 so that the appropriate key code could be generated and handled. Still though, it leaves us waiting for a baked (or as lilstevie puts it - a patched) kernel with supporting drivers.
lilstevie said:
ubuntu looks at the keymap in terms of a number, with a kernel patch you can make it report the number associated with F1-12, in fact this patch is in place in my upcoming native ubuntu for tfp
Click to expand...
Click to collapse
Looking forward to it's launch *thumbs up*
I'm in the minority that I loved my T9 flip phone - I could text on that thing with one hand blindly with no problems. I've never had much luck with the portrait on-screen keyboard. I have MultiLing keyboard for T9, but since there aren't any real buttons, I can't quite type by feel.
It turns out that there have been at least three flip-style Android phones: the Samsung SCH-W899, SCH-999, and GT-B9120. All of them used 12-key input with T9 prediction for typing. I've tried searching for their *.kcm/*.kl files, but the source downloads didn't include them. They make reference to tuttle2.kcm and mahimahi-keypad.kcm (source can be found with Google), but these didn't seem to perform the T9 predictive text input that these phones are supposed to include.
Google's documentation makes reference to a "type PREDICTIVE" flag for *.kcm files, but I can't find any code that uses this flag:
http://source.android.com/tech/input/key-character-map-files.html
My basic question: does the "type PREDICTIVE" flag allow keymaps to provide T9 prediction? If not, how does this work on the Samsung phones? My REAL question: what if I got a Bluetooth numeric keypad and mapped the keys in Android somehow? Could I then create a physical T9 keypad?
Pretty please - don't tell me I'm stupid for liking T9, suggest another keyboard, or point me to Swype. I'd like to figure out a way to code this if possible since it's been a project I've had in my mind for over 2 years now!
Thanks!