Compartilhar via


Sudoku on a non-Tablet PC

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  https://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 https://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 https://msdn.microsoft.com/library/en-us/dntablet/html/tbconSudokuSampleFinal.asp.  Look in the bin\release folder.]

Comments

  • Anonymous
    April 18, 2006
    You probably want to mention that the recognizer pack wont install on XP Home. Been hit a couple of times by that :(

  • Anonymous
    April 18, 2006
    Yes, thanks.  For any interested, the download pages for the recognizer pack and for the SDK list the supported operating systems... neither support XP home edition.

  • Anonymous
    April 18, 2006
    or if you have the code

    comment out the if that comes right after
    // Verify you are running on a Tablet, or that you at least have the Tablet APIs installed

    including the variable declaration.

    this is just above:
    //Run the main app

    using this method you must copy the Microsoft.Ink.dll that comes with the code to where ever the exe is being compiled to and you won't be able to draw numbers, but you can use the numbers that are shown

  • Anonymous
    April 18, 2006
    oops... i forgot.

    the above mentioned code is in the Program.cs file

  • Anonymous
    April 20, 2006
    Hi All,
    Stephen, I made a couple of minor changes and recompiled the app so it now works on any version of Windows.    I created an installer for it as well.   Here is the link to download it.  
    http://smartphonecalc.blogdns.org/files/8/other/entry13.aspx


    Feel free to check out my other free app a calculator for Windows Mobile Smartphones.

  • Anonymous
    August 18, 2006
    You're the MAN!

    Thanks a lot!

  • Anonymous
    January 06, 2008
    hi, does anybody know an input panel equivalent for xp non-tablet ?  

  • Anonymous
    July 13, 2008
    PingBack from http://ultramobilepctips.mobiforumz.com/2006/04/20/all-about-sudoku/

  • Anonymous
    July 23, 2008
    Thanks, but after installing everything, I still get that friendly message about Sudoku hating every OS 'cept Windows XP Tablet Edition 2005...or later... I'm installing sp1 for the .NET framework (v2) so I hope that'll magically fix it. BTW: Running Win2k with a Wacom tablet by my side. Well...on the desk actually, but 'by my side' sounded nicer. Hopes this works, if not I'm going to bed in tears. All that aside; thanks for the workaround! Peace.

  • Anonymous
    October 26, 2008
    hi,Stephen, are there Tablet PC  Recognizer Pack for windows server 2008 ,thanks

  • Anonymous
    June 15, 2009
    PingBack from http://workfromhomecareer.info/story.php?id=15250