flash sudoku solver

my latest experiment in flash: an actionscript sudoku solver. given a valid puzzle, it attempts to parse it for its unique solution.

it’s still fairly rudimentary as solver programs go, but it’s getting better as i get better:


share and enjoy.


  1. I am curious how you use ActionScript 3 to retrieve a puzzle from USA Today, etc. I am playing around with ActionScript 3, trying to learn it, and making a Sudoku thingy, but need a source of puzzles.

  2. actually, the piece that’s retreiving the puzzle is doing so through PHP – flash doesn’t allow one to grab data off any site with a “crossdomain.xml” file at the root, thus preventing tricky flash programmers (like myself) from stealing.

    on the other hand, PHP lets you include just about anything from any url you like.

  3. Before finding your reply, I had figured out that I needed to use PHP. I was able to get puzzles from two sites that way, but I still have not found the key to USA Today. You can see my current puzzle at http://www.txbobsc.com/misc/sdk/

  4. in the interest of sharing, here’s what i’ve got pulling in USA today’s xml:

    < ?php
    $today = date("ymd");

    include("http://picayune.uclick.com/comics/ussud/data/ussud" . $today . ".xml");

  5. Thank you! I will give that a try.

  6. I was able to retrieve the puzzle using

    Now I have to see about adding an option to my puzzle to use it.
    Otherwise, I am generating the puzzles offline and populating an xml file full of puzzles on my site. Then for variety, I randomize the puzzle after retrieving one.

  7. $today = date(“ymd”);
    $url = “http://picayune.uclick.com/comics/ussud/data/ussud” . $today . “.xml”;

    $curl = curl_init();
    curl_setopt($curl, CURLOPT_URL, $url);

    # execute and return string

  8. Dear sir,

    I have been struggling with creating a soduko solver in Flash using AS2 for a while now (find it at http://www.newberys.com/sudsolv.zip) – and I’m going slightly mad at it only being able to solve simple puzzles – please excuse the look of mine, I’ve decided to try and get the programming right before dealing with the look) … anyway, yours can solve my “D’s Hard One” which is the most difficult puzzle I ever did, and so I use it as the standard to which I am to achieve – Please please please will you send me your code (I’ll gladly pay) so I can see how you worked it out … before I spend months trying to get mine to work and eventually pull what little of my hair I have left, out! – By the way, to fill in the boxes in mine, just click on a cell and type the number in, then use the arrow keys to move around.

  9. I made one in C. its really fast. less than 4 milliseconds, on almost every puzzle.

    but how do i get the C to communicate with flash. I don’t want to rewrite all the code in AS2.0

  10. @Noj:

    flash is good at reading XML. you might use flash as a front end for feeding the puzzle to your C app, then output the result as XML and feed that into the flash when it’s solved. you won’t be able to do it on the web, but as a standalone app.

    why bother with flash, though, when you can just build an interface onto your C app?

  11. I have found out that playing suduko has helped me become quicker in simple math problems.