[Skip top navbar]

Andrew Gregory's Web Pages

View of Perth city from Kings Park, 31°57'19"S 115°51'2"E



Version: 1.32, 2010-03-16


Play Sudoku on the go! Features:

Annotated screenshot


Sudoku screenshot Sudoku screenshot



PalmOS 2.0

PalmOS 2.0 doesn't support all the required display characters, so in places there will be squares. I have no intention of doing anything about that.


If you're using StyleTap, make sure you're using v0.9.070 or later, otherwise it will crash with the message "Unsupported system trap (0xA3AD) called".


If you're using Watchmaker, make sure you're using v1.3.2 or later, as earlier versions blank the screen when the Palm switches off.

The Game Generator

The random game generator is very primitive. It tends to generate simple games, but occasionally jags a puzzle that requires advanced techniques. There is no difficulty categorization (yet!) - that tends to be extremely subjective, plus it would require implementation of many redundant solving strategies to determine the simplest techniques that could solve a puzzle (eg the Colouring strategy is very advanced, and special cases of it can be performed using different strategies). Think positively - every game will be a surprise!

The other problem with the generator is that it (unsurprisingly) takes a random amount of time to complete. It usually takes less than a minute, but on one occasion it took nearly half an hour!


v1.11 and later have been changed to avoid conflicting with Teal Point's Sudoku Addict application. That change will result in two Sudoku icons appearing in the Launcher. The only way of deleting the duplicate icon is to manually delete the old copy of my Sudoku program. Use a utility such as Filez to list the internal databases and delete the database called "Sudoku". Don't delete "SudokuAGsu" (the new version of my Sudoku app) or "SudokuDB-AGsu" (your Sudoku games database). [Also, I now understand why I've been getting comments on the small size of my app!]

sudoku.zip (53771) Sudoku program (zipped)

Sudoku.prc (115028) Sudoku program (uncompressed PRC)

My Sudoku program is totally free. However, it is made largely of coffee and beer, which aren't free! The button below allows you to add to the coffee and beer fund (OK, it's really my slush fund). If you don't feel like donating, you can show your appreciation by sending comments via email or in my guestbook.

Third Party Downloads

Sudoku Importer by Blake Winton

The Sudoku Importer is a program which takes a set of Sudoku puzzles in a memo, and imports them all into my Sudoku application's game database.

Blake has also developed a Python script to download games from the web and output them in a text file.

Web Ring

Web Ring

Future Plans


Some of the suggestions I've received:


Some of the solver strategies in my Sudoku application I figured out myself. The rest I obtained from other people via their web pages.

Basic Rules

This eliminates solved digits from candidates in the same row, column or box.

Number Sets

I created this strategy after realizing that the Scanraid Pairs Test could be generalized to any number of digits, not just two.

This was then replaced with an even more generalized strategy, Naked Number Sets, derived directly from the Naked Pairs, Naked Triples, and Naked Quads strategies, but applied to all possible sets of digits.

This strategy also includes the closely related Hidden Number Sets, again, directly derived from the Hidden Pairs, Hidden Triples, and Hidden Quads strategies.

Box/Line Reduction

This one was obtained from the Scanraid Box Line Reduction page.


Based on X-Wing and Swordfish, and tested using some games found on another site.

Linked Pairs

My name for the XY-Wing strategy, renamed because I haven't strictly implemented the "X-Wing" strategy, rather I've done a more general Swordfish strategy (see above).


This one was obtained from this post and this post on the Sudoku Programmers Forum. It is a superset of, and therefore replaces, the Scanraid Remote Pairs strategy I had implemented before.

Almost Locked Sets

Detailed in this post. So far, only a subset called ALS-XZ has been implemented. The more general "ALS-Chain" has proved to be very complicated.


As described in this post on the Sudoku Programmers Forum. It's a trial-and-error strategy, not a logical one. However, it's apparently one people can do fairly easily.


Sudoku v1.9 and later support the above launch code. The cmdPBP parameter points to a structure of SudokuAddRecordParamsType.

Cast the UInt32 result after calling SysAppLaunch to a UInt16 value. That value will be the record index in the database of the added record, or dmMaxRecordIndex if the add failed.

/* Cell state bitmap (UInt16) Bits 0..8 : correspond to the digits 1..9 Bit 9 : locked, if 1, indicates a set digit and only one of bits 0..8 must be set, otherwise any number of bits 0..8 may be set Bit 10 : cell is in conflict with another (a mistake) Bit 11 : cell is one of the initial starting cells Bits 12..13: colouring (00=none,01=red,10=blue,11=reserved) Bits 14..15: reserved */ typedef UInt16 CellType; /* 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 */ typedef CellType GridType[81]; // 162 bytes #define GAME_NAME_LEN 22 typedef struct { Char name[GAME_NAME_LEN]; // 22 bytes, must be zero terminated GridType game; // 162 bytes UInt32 time; // 4 bytes, time taken to play } SudokuAddRecordParamsType; // 188 bytes


  1. time==0: in game setup state (a maximum of one digit may be set per cell, cells with a digit should be locked, but not marked as starting), time!=0: playing game (all cells marked as starting must also be locked, all locked cells must have only one digit set).
  2. It is not possible to pass save states via this launch code.


Sudoku v1.2 and later support the above launch code. See the PalmOS documentation for how to use this standard launch code. Since Sudoku does not support searching the game database, only the recordNum field of the GoToParamsType structure is used.

Database Record Format

NOTE: The SudokuGameType structure referred to below is the same as the SudokuAddRecordParamsType described above.

If you're going to access my game database directly, please check the version and bail out if you don't support it! Sudoku versions 1.26 and later will always upgrade the entire database to the latest version on opening.

Version 1 (Sudoku v1.26 and later)

Each database record consists of one or more generic blocks of data.

Example record:

0192Type 1 block, length 188 (total 4+188 bytes)
1928Type 3 block, length 1 (total 4+1+3 bytes)

Version 0 (up to Sudoku v1.25)

Each database record is a SudokuGameType structure, followed by zero or more GridType structures for the save points (from newest to oldest).


Sudoku Version History
  • Fixed bug where asking for a hint would always result in an undeserved "bad pencilmarks" error.
  • Fixed a problem where an empty solver log would be shown.
  • Enhanced the Hint button to perform a grid check during game entry (check for no or multiple solutions without tapping Go).
  • Enhanced the Solve Log function to provide the options of giving a hint or solving the game when the log is empty.
  • Enhanced the Fast Digit list with a 'C' - it operates the same as entering a zero - any existing pencilmarks are cleared, or if there are no pencilmarks, all pencilmarks 1 through 9 are added.
  • Fixed a crash saving games (one part of the saving was locking the record for writing, another part was subsequently trying to resize the record, which doesn't work when it's locked!).
  • Fixed problem entering digits when setting up games with the "auto set digit" preference turned off.
  • Added checks before the Solve and Hint functions to check the game for mistakes, otherwise the solver algorithms will only provide more wrong answers!
  • Removed 1½-density support - it turns out the double-density font corruption seen on Zire 71/72 devices actually applies to all PalmOS 5.0 through 5.2 (and maybe 5.3) devices and is due to the presence of 1½-density fonts in the application, even though the affected devices aren't using those fonts.
  • Fixed soft reset after HotSync.
  • Fixed data loss bug changing game details in game select form.
  • Fixed lockup exiting cell edit form.
  • New database format to allow storage of extra data related to each game - WARNING: the database will be upgraded when you first run Sudoku after installing the application; if you have many games the upgrade could take a minute or two; the database will typically expand by about 6% (this does not affect beaming, ExchangeManager, or sysAppLaunchCmdAddRecord).
  • Fixed slow performance of the solved/unsolved filter in the game select form.
  • Obtain ROM version just once at startup, rather than querying the OS each time - fixes performance issue with X-Master and MultiUserHack.
  • Disabled double-density fonts on Zire 71/72 devices - to work around apparent custom font glyph corruption.
  • Re-arranged preferences - split out solver related preferences from the general preferences.
  • Added a new pencilmark preference "Auto set single digits" to control if cells with a single pencilmark have that digit automatically set as the solution.
  • Even when the above "auto set" preference is turned off, the digit will still auto set when the last pencilmark in the cell is tapped in the cell edit form.
  • Added new general preference "Hide illegal digits in cell edit form" to separate that function from the "Auto erase" pencilmark preference.
  • Fixed so that background processing (such as PocketTunes) doesn't keep the clock running.
  • Fixed a bug during hint entry that may have corrupted memory and caused some crashes.
  • Improved operation on the Handera 330 - shouldn't hang on start and pencilmarks are a nearly unreadable non-bold font instead of a totally unreadable bold font.
  • Enhanced display so that when all 9 instances of a digit are "locked in", they are all grayed out (can be turned off via preferences).
  • Added new Almost Locked Sets strategy (ALS-XZ variant).
  • Split Hidden/Naked number set strategies into simple (1 to 3 digits in a set) and complex (4 or more digits in a set).
  • Tweaked Linked Pairs strategy to stop as soon as it finds a hint so simpler strategies can be immediately tried.
  • Restored previous Linked Pairs strategy as a simple strategy, retaining the new Linked Pairs strategy as a complex strategy.
  • Split Swordfish into simple (2 or 3 areas) and complex (4 or more areas) strategies.
  • All simple strategies are tried before any complex strategy - pointing pairs/triples and box/line reduction are considered simple, colouring is complex.
  • Enhanced the Show Hint form to indicate the type of strategy used for the hint.
  • Enhanced the Pencil Legal Moves/Clear Pencilmarks so that if any pencilmarks are hidden, then the game will ask if only the visible pencilmarks should be affected, or all pencilmarks.
  • Cell editor now correctly sets the cell if there is only one digit in the cell.
  • A hyphen (minus) is now treated the same as a space (skip a cell when entering, redo).
  • Altered calls to the PalmOS random number generator, to start with a better seed, and to hopefully improve the distribution of the random numbers, and thereby improve the random games.
  • Added support for Garnet 1½-density displays - this might make it look better on StyleTap type 240×240 (WindowsCE) displays.
  • Added support for 65536-colour mode: previously if the device supported 256-colours or more, the 256-colour mode would be forced on, causing some ugliness when using UI skinning tools.
  • Changed the convention of referring to cells from "(row,column)" to "r<row>c<column>".
  • Fixed bug in Colouring strategy.
  • Fixed bug where wrong minimum auto power off setting was saved and used.
  • Fixed the auto-power-off timer reset to only trigger on events actually processed by Sudoku; this may help prevent the Palm from switching on by itself when background processes (for example, Chatter Email) wake up to do things.
  • New "Solve to" button for the Solve Log that applies all the log entries up to and including the selected entry.
  • Manually entering hints given in the solver log entry no longer wipes out the log, instead just removes the entries.
  • Improved some event handling to maybe lower power consumption a little.
  • Automatically generated numbers to make game names unique are now at least two digits long.
  • The "Cannot edit starting digit" message now takes two taps in the same cell to appear; the first tap just beeps.
  • New preference to have the Show pencilmarks filter stay synchronised with the selected fast digit entry - allows for much easier pencilmarking.
  • Rearranged the Edit menu options slightly.
  • Fixed pencilmark preferences button to respect the Palm theme colours.
  • Fixed Colouring strategy (I've nailed it this time for sure!).
  • Fixed bug where the Edit > Check function wouldn't detect conflicting digits.
  • Strengthened the "Linked Pairs" strategy by incorporating Y-Wing Chains.
  • Improved the hint system so that when a hint is entered, it doesn't wipe out the solve log.
  • Added general descriptions of the solving strategies, accessible from the solver log hints.
  • When backlight dimming is disabled, don't even read the backlight state: some Clié devices were complaining.
  • Darkened red/blue colouring slightly.
  • Tap-and-hold-down now un-sets a set cell.
  • Fixed bug that saved games out of sorted order in the database, breaking auto game numbering.
  • Fixed bug that resulted in the pencilmark preferences button flashing rapidly when background processing (such as playing music in RealPlayer or Pocket Tunes) was taking place.
  • Fixed several bugs relating to game pausing not being properly cleared.
  • Fixed bug where the Check function would circle correct digits.
  • Fixed bug in Colouring strategy.
  • Fixed bug where pausing the game turned the Palm off if the usual auto off time had already expired.
  • Fixed bug which had the Palm produce an error beep after selecting menu items.
  • Check function now allows incorrect cells to be either erased, or moves undone until the game is correct.
  • Red/blue colouring now supported on grayscale devices via light and dark gray respectively.
  • Reduced stack memory requirements of Colouring strategy - should help on stack limited devices (eg Palm OS 2.0 and earlier).
  • Tweaked number sets strategies to only try big sets of four digits or more as a last resort.
  • Ensured the game name has a zero terminator - stop some crashing.
  • Changed backlight dimming to ensure it never makes things brighter.
  • Made backlight dimming a preference.
  • Can cancel copying to clipboard.
  • New Game form remembers which checkbox was last selected.
  • Bolded form labels (where practical).
  • Added support for categories.
  • Fixed bug where undo/redo history wasn't always being cleared at appropriate times.
  • Fixed "setup game" animation so it doesn't race away.
  • Redesigned the Pencil Preferences form, and moved some pencilmark-related preferences from the general Preferences form to the Pencilmark Preferences form.
  • Preliminary localization work - moved hard-coded strings into resource records.
  • Beaming just the starting digits of a game now resets the game timer for the destination machine.
  • Added a special message to show if "Go" is tapped on a blank grid.
  • Changed the highlight moving by the 5-way navigator so it no longer skips over starting digits.
  • Fixed the cell editor so it doesn't hide digits that are already pencilled in so they can be unselected.
  • Fixed bug in the "basic rules" strategy that caused the "auto erase pencilmarks" function to sometimes not work.
  • Changed the auto-off timeout to not use the forced extended timeout when the game is complete, or when setting up the game.
  • Fixed bug where beaming a game wouldn't start/stop the timer on the destination device.
  • Fixed some bugs in the Colouring strategy.
  • Fixed bug where Solve would stop before it had exhausted all possible eliminations.
  • Replaced memory-based undo history with a database-based one, this should resolve problems with the undo history not saving more than about 200 undos (it would just stop adding undo entries, resulting in big undos), plus improve operation (not crash!) on devices with limited heap memory (eg Palm OS 2.0).
  • Changes made by Pencil Legal Moves, Erase Pencilmarks, Erase Colourings and Solve now go into the undo history.
  • Improved handling of game timer to ensure it stays running.
  • Improved game generation to handle system events (such as phone ringing, Home button, and other application switching events) and to dim the backlight (where possible).
  • Changed the cell editor to hide digits that are illegal if the "Auto erase pencilmarks" preference is ticked.
  • Made game name generation always use two digits for the date numbers, and add a "#number" at the end to ensure new names are unique.
  • Fixed bug where the game generator would generate games requiring guessing.
  • Fixed bug where the game generator would generate the same sequence of games (wasn't seeding the random number generator).
  • Fixed bug where pressing and holding the select button on Tungsten T devices (and maybe others) wouldn't go to the Applications Launcher.
  • Fixed the cell edit form to allow the Graffiti area to work correctly.
  • Fixed a potential lock-up in the fast solver.
  • Reduced the memory requirements of the fast solver.
  • Made auto-generated date always in year-month-day order, for better sorting in the game list.
  • Cell edit form now responds to digit input via Graffiti or keyboard to simulate tapping the digit buttons.
  • Entering a zero turns all pencilmarks in the current cell or in the cell edit form on or off.
  • Increased the requested stack size from 4KB to 6KB, which should improve stability on older devices.
  • Fixed bug introduced in v1.15 where the pencilmarks font would be continually redefined, eventually swallowing up all memory and causing game grid drawing and exiting of game to slow down considerably.
  • Backspace/Space (via either Graffiti or keyboard) now function as Undo/Redo respectively during game play.
  • Enhanced the clipboard copy function to allow copying of either all the digits, or just the starting digits.
  • The auto-setting of digits while editing cells can now be undone.
  • Added scrollbar to game selection form.
  • Fixed some game timer bugs.
  • Can no longer pause a completed game.
  • Fixed problem where the drawing of pencilmarks would be corrupted (apps using custom fonts, like Sudoku, must check every time they use such a font, in case a background Palm app has redefined it behind their back!).
  • Fixed an infinite loop in the colouring strategy.
  • Fixed problem where hint/solver strategies would miss simpler plays.
  • Fixed bug where fast digit entries weren't being added to the undo/redo history.
  • Completely re-worked the hint/solver code, hints now step through all the eliminations instead of going straight to the solved cell, plus they allow the more complicated strategies, especially Colouring, to complete their eliminations.
  • Hint confirmation now allows the hint to be explained.
  • Sped up animation of game setup "tap to go" message.
  • Optimised idle event handling to reduce power consumption.
  • Improved the fast digit entry button by having it reset to '#' if the digit list is dismissed by tapping outside the list - it allows the normal digit entry mode to be selected simply by double-tapping the button.
  • Improved fast digit entry by having tap-and-hold force the selected digit to be locked into the cell.
  • Improved the time display to distinguish between minutes:seconds (now separated by a ') and hours:minutes (separator unchanged, it's still a :).
  • Highlighting reverted to something more like the pre-v1.13 behavior.
  • Added pencilmark counts to the pencilmark preferences form.
  • Replaced the old and slow brute force strategy with the new fast solver algorithm.
  • Fixed display corruption if a reminder popped up while the cell edit form was open.
  • Fixed sysAppLaunchCmdAddRecord bug where it would sometimes return zero if the record had not been added.
  • Fixed the clock stopping after a solve or a game check.
  • Fixed the basic rules solver to stop as soon as it notices a solitary digit in a cell.
  • Fixed "Select Game" list highlighting - highlight now sticks to a renamed game.
  • Fixed the pointing pairs/triples strategy to use game row/column numbers instead of box row/column numbers.
  • Fixed game generation drawing on grayscale devices.
  • Fixed game saving to synchronize with the NVFS, if present.
  • Added X-Wing and Swordfish strategies (generalised Swordfish).
  • Added "Fast Digit Entry" - select a digit that will be immediately toggled into every subsequent cell that is tapped (particularly good for quickly filling in or clearing out pencilmarks).
  • Added colour support for PalmOS 3.5.
  • Added shortcut support for pencilmark filters (the Shortcut stroke, followed by a digit 1-9).
  • Added colouring for undetermined cells; intended for manually working out the Colouring strategy.
  • Added preference to stop the cell edit form opening on every cell tap; this is to allow for tapping a cell to select it, then being able to use Graffiti to immediately edit the cell digits.
  • Enhanced the Go menu item to Go/Pause, to allow pausing the game via Graffiti shortcut or keyboard.
  • Improved the decoded descriptions of the box/line reduction and pointing pairs/triples strategies.
  • Improved the "Pencil Legal Moves" and "Erase Pencilmarks" functions to respect the show/hide pencilmark preferences.
  • Improved the dpad/5-way behaviour during game entry to wrap to the next/previous lines when moving right/left; the no wrapping during game play is unchanged.
  • Prevented "Pencil Legal Moves" from working while setting up the game.
  • Made the Pencilmark Preferences button blink when any pencilmarks are set to be hidden, as a reminder.
  • Made the game editing mode a little more obvious.
  • Mistakes are no longer highlighted exactly like the currently selected cell, instead the digits are circled.
  • Slightly sped up the number set solvers.
  • Fixed bug where incorrect brute force guesses appeared in the solver log.
  • Fixed bug where the pointing pairs/triples solver log entry had the box and row/column numbers swapped.
  • Fixed bug where decoding solver log entries crashed the emulator (although no crashes on devices were reported).
  • Made the "fast solver" (used by the Check and Go functions) much faster.
  • Fixed Check and Go solving to not exhaustively search for every possible game solution, but stop at the first and second solutions respectively.
  • Fixed naming conflict with TealPoint Sudoku Addict.
  • Improved tap and hold usability by ignoring pen moves and shortening the hold time to half a second.
  • Added pause function - tap clock.
  • Added pencilmark drawing preferences - they can be selectively coloured or hidden.
  • Added an experimental (very poor) game generator.
  • Fixed Tungsten T3 5-way navigation control support (may also apply to other devices).
  • Fixed bugs where if "auto erase pencilmarks" was enabled, pencilmarks would be automatically filled in when tapping "Go" or rewinding.
  • Attempted fix for some colouring problems (conflicts with system colour themes).
  • Added fine-grained undo/redo functionality.
  • Added new strategies: Nishio and Linked Pairs.
  • Added option to capture hardkeys for left/right control.
  • Added "Check" functionality - solves the game from scratch then highlights solved cells that are different from the calculated solution.
  • Added "Solvers ignore pencilmarks" preference - will result in extraneous log entries, but allows the hint and solver features to ignore any erroneous or incomplete pencilmarks.
  • Added a new preference to enable/disable Nishio-like strategies (Allow shallow look-ahead).
  • Changed the Preferences shortcut from the non-standard "F" to the standard "R"; that has necessitated changing the Rewind shortcut from "R" to "W".
  • Tapping and holding on a cell with a single pencilled digit will lock-in that digit.
  • Enhanced New Game function to allow copying of the current game (starting digits only, or the whole lot).
  • Enhanced Go button now checks the entered game for none or multiple solutions.
  • Enhanced game selection form now shows the game time.
  • Fixed Go button painting bug when entering new games.
  • Fixed Rewind to edit game not clearing pencilmarks.
  • Fixed crash drawing cell background colours (reported against the Clié emulator).
  • Clipboard pasting has been changed to paste the game into the database and switch to it, instead of replacing the existing game; now supports an optional game title as the first line of the clipboard data.
  • Added "doesn't crash" support for PalmOS 1.0 and 2.0.
  • Added support for sysAppLaunchCmdAddRecord.
  • Added an option to disable the colours.
  • Improved the Colouring strategy.
  • Locked cells are now shown in a non-bold blue, starting cells are still shown in bold black.
  • Streamlined initial game entry.
  • Added a hint button.
  • Changed "auto pencil legal moves" to "auto erase illegal moves".
  • Hints/solving no longer internally reset pencilmarks before starting, now they only do that for cells with no pencilmarks; this removes the confusing solver log entries indicating elimination of digits that aren't there.
  • Reworked preference loading/saving so new preferences don't require wiping out the old preferences.
  • Improved the positioning of the cell edit form so it does not obscure the row, column, or box of the cell being edited.
  • Fixed bug that put garbage into the solver log.
  • Added a Solver Log - see the reasoning behind the hint or solution.
  • Fixed bug where renaming a game would sometimes get the new position out of order.
  • Removed the Remote Pairs strategy - the Colouring strategy is a superset of it.
  • Removed a simple "eliminate single digit" strategy - the more general Naked Pairs strategy was doing the same thing (and more).
  • Fixed bug that caused hint/solve searches to finish too soon.
  • New strategy implemented - Colouring!
  • The Solve function now fills in pencilmarks.
  • Digits now shade cells with specific colours, making it easier to see sets of digits.
  • Improved appearance of cell inverting/highlighting.
  • New application icons - colour and high-res.
  • Added some colour support.
  • Fixed crash in game selection form.
  • Added high density display support (the app icons still suck).
  • Added 5-way rocker support.
  • Added keyboard support.
  • Added help icon to main form.
  • Added minimum auto-off timeout.
  • Added game beaming support.
  • Fixed bug erasing pencilmarks while editing game.
  • Blocked saving state while editing game.
  • Other usability tweaks and minor bug fixes.
  • Added brute force hints (optional).
  • Added clipboard copy/paste.
  • Added game solver (applies hints until game is complete).
  • Added two new solver strategies.
  • Fixed a strategy (remote pairs) bug.
  • Fixed new game bug.
  • Fixed rename game bug.
  • Initial release.