I’ve received a bunch of emails over the past week from people asking if I have a version of Sudoku.exe that runs on non-Tablet PCs. I tell them yes, and I tell them that they do, too
Sudoku.exe references and uses types from Microsoft.Ink.dll, a .NET assembly included as part of Windows XP Tablet PC Edition 2005. When Sudoku starts up, it checks to make sure that this assembly is available, and if it isn’t, it presents a “friendly” error message and exits (“friendly” if you consider an application telling you that it won’t run a friendly action, but it’s much better than crashing). If this test weren’t in place and Sudoku were run on a machine without Microsoft.Ink.dll, Sudoku would blow up when it tried to consume types from that assembly. Sudoku.exe has another startup test in place, checking to see whether any valid handwriting recognizers are installed.
So how do you get Sudoku.exe to run on a non-Tablet? Install the required dependencies. First, install the Microsoft Windows XP Tablet PC Edition Software Development Kit 1.7, available at http://www.microsoft.com/downloads/details.aspx?FamilyId=B46D4B83-A821-40BC-AA85-C9EE3D6E9699. The Tablet SDK installs the Microsoft.Ink.dll assembly into the Global Assembly Cache, making it available for Sudoku.exe to load. Second, install the Microsoft Windows XP Tablet PC Edition 2005 Recognizer Pack, available at http://www.microsoft.com/downloads/details.aspx?FamilyID=080184dd-5e92-4464-b907-10762e9f918b (note that this download includes recognizers for several languages, but Sudoku.exe should run fine with just the U.S. English recognizer installed).
That’s it (though, of course, you’ll also need the .NET Framework). With those two installs (no restarts necessary), Sudoku.exe should run fine. You’ll even be able to write numbers in with the mouse as if you were writing with a pen; however, unless you’re really adept at drawing with a mouse, you’ll probably have an easier time sticking with the arrow keys for navigation around the Sudoku grid and the number keys for setting values into cells. I have Sudoku.exe installed on my Media Center at home, and we use the remote control to navigate around the grid and enter numbers; playing sudoku with a 10′ interface is quite relaxing.
Note that it would be possible to modify the Sudoku code to support execution on non-Tablets without the above installs. The code would need to be changed such that no methods that touch types from the Microsoft.Ink.dll assembly are ever JIT compiled (and NGEN’ing wouldn’t be out of the question) if the dependencies are not installed. Such changes wouldn’t require too much work: they’d involve use of intermediary methods that check the results from properties in the PlatformDetection class and decide whether or not to delegate to methods that make use of the Tablet APIs; you’d also want to investigate using a MethodImplAttribute with a NoInlining value on those target methods. Most, if not all, of the necessary changes would be in the PuzzleGrid.cs file. Of course, if you didn’t care about Tablet support at all, you could simply rip out all that code and be good to go. But it’d be a shame… you’d be doing yourself a disservice if you chose that route rather than getting your hands on a Tablet or an Ultra-mobile PC and experiencing the pleasure of Sudoku on such a device.
[ps For those who have asked me where you can get the compiled Sudoku.exe application, it’s included in the source code download from the article at http://msdn.microsoft.com/library/en-us/dntablet/html/tbconSudokuSampleFinal.asp. Look in the bin\release folder.]