Archive for November, 2005

Sudoku Kit

Monday, November 14th, 2005

I’ve started putting together a little app for solving Sudoku puzzles. Sudoku is the logic puzzle game that is supposedly sweeping Japan (though the two people from Japan that I’ve asked had never heard of Sudoku) and is now common is US and UK newspapers. I’m not sure what the appeal is, but some people are really into it. After solving a few myself, it seems that one hook is the aha sensation of discovering a new technique for filling in the puzzle, but how long can that go on?

The goal of the app, “Sudokit”, is to explore different puzzle-solving techniques that a human solver might use. Sudoku puzzles come with difficulty ratings, and, presumably, more difficult puzzles require more advanced techniques. The last resort technique is trial-and-error.


Sudoku Step


In the screenshot shown, the app is in “step” mode, highlighting each cell before it simplifies it, and the yellow cell is about to be converted to a 3 since that’s the only cell in its row that allows a 3. Large black numbers show known cell values, and small gray numbers show possible values for that cell. (I know, it looks ugly now.) The app knows three solving techniques so far.

Find By Value
For a given value, look through each group (a row, column, or 3×3 block) that doesn’t already contain the value and see if there is only one cell that can contain it.
Find By Cell
For a given cell, see if there is only one value that are not already in the combined 3 groups that contain that cell.
Find By Subsets
For each group, look for subsets of N cells whose members are among the same N values. If found, then those values can be eliminated from other cells in the group. For instance, consider the first column of the shown puzzle. Two cells can contain either a 4 or a 6. That’s 2 cells with members among 2 values. So 4 and 6 must each be in one of those cells, and so cannot be in other cells in that column. As a consequence, the cell allowing 4, 6 and 9 is now known to be 9.

Find By Value and Find By Cell are probably common techniques for human solvers since they are very local: you don’t have to keep information about any cells except the one you’re looking at. Find By Subsets is tougher: you need to keep information about an entire group at a time, but not the entire puzzle, so it’s still possible to do it in your head.

I don’t have an automatic source of puzzles, so I hand-entered a few from WebSudoku, with difficulty levels Easy, Medium, Hard, and Evil. Interestingly, the Easy, Medium, and Hard puzzles were solvable by using the Find By Value method only. I guess I need to find a dumber variant if I want to differentiate among those puzzle difficulties. The Evil puzzles did require Find By Subsets to solve.

I also tried a couple puzzles from a book. There, Find By Value was enough to solve the Introductory and Medium puzzles, but not the Difficult ones. And not even adding in Find By Cell and Find By Subset were enough to solve the Difficult puzzles from the book. I need to try more puzzles from more sources before I can compare difficultly levels meaningfully, but it looks like the difficulty ratings are not universal.

And I need to find another solving technique for those Difficult puzzles — I’m trying to avoid adding trial-and-error.

Unsophisticated Art Review : Youssou N’Dour and Cairo Orchestra

Monday, November 14th, 2005

The acoustics of Memorial Hall have been perfect all season, but they really shined in this performance. Youssour N’Dour’s powerful vocals would have overwhelmed many venues, I think. Instead, even I got the sense of being out in the desert from this performance. N’Dour had his own supporting musicians, and they combined well with the those of the Cairo orchestra. The orchestra featured what I think was a kora, a kind of African harp with a large drum-like chamber.

More descriptive information about the performance is available at the Carnegie Hall site, where they performed a few days earlier. The only negative from the Memorial Hall performance was the frequent flashes from audience photography. Photography is usually disallowed for performances, but maybe this was an exception.

During the last song, N’Dour pulled a swaying 3-year-old from the audience onto the stage to demonstrate the natural and universal appeal of the music.

More Election Graphs

Saturday, November 12th, 2005

Following up on my instant fame as an OrangePolitics.org guest author, here are two more graphs from the Chapel Hill Town Council election results. The first is a mosaic plot, which is close to what Mark Chilton was suggesting, I think. For each cell, the width represents the votes in that precinct, and the height represents the percentage in that precinct that voted for the candidate, so the area shows the number of votes for that candidate in that precinct. Precincts are alphabetical; candidates are in order of overall finish. Unfortunately, I couldn’t sort each column differently, as Mark suggested, so it’s not clear who “won” each precinct. Click graph for larger version.

Chapel Hill Town Council Results by Candidate

The second graph is more statistically relevant (ignoring the fact that the “Absentee” early voting precinct is not really comparable to the other geographical precincts). Each box plot summarizes the percentage outcomes for a given candidate in all the precincts. Assuming a normal (bell-curve) distribution, points outside the “whiskers” of the box plot are likely to be outliers affected by factors other than random variation. (Testing for normality indicates that only the Cutson and Baker results do not follow a normal distribution.)

Chapel Hill Town Council Results by Candidate

I labeled the outliers, though the Northside and Lincoln labels overwrite each other in the Thorpe column. The box plot outliers show Mason Farm as significant for Raymond, though it was not noticeable from the overlay line plot since that precinct had so few votes.

Election Results Graph

Wednesday, November 9th, 2005

Orange Country provides timely online election results, and their HTML is friendly enough that is can be imported into JMP. Below is a graph I came up to show the Chapel Hill town council results by precinct. Precincts, along the horizontal axis, are sorted by number of total votes. [Click graph to see full resolution version.]



Chapel Hill 2005 Election Results by Precinct


I’m thinking there’s a better graph using area, but this overlay is the best I can do easily. At least it shows a few interesting pieces of information:

  • In general, not much variation among precincts.
  • A few significant-looking exceptions to the general case: Cutson in Cedar Falls, Easthom in Patterson, Thorpe in Northside and Lincoln, Baker in Absentee, Harrison in Durham.
  • Absentee was by far the largest “precinct”. [Sorry for chopping off the top of the graph, but otherwise there's too much unused space in the graph; Easthom and Kleinschmidt got over 500 there.]
  • There is a significant difference in votes per precinct. Is it worth campaigning in Battle Creek and Country Club?

Looking at the voter turn out statistics, it’s clear the main factor in the votes per precinct is just that some precincts have more registered voters than others (I don’t know how registered voters correlates to population, though). However, there are exceptions. The smallest (in registered voters, that is) precinct, Weaver Dairy Sat. (is that Carol Woods?) had the fifth highest voter turn out with over 68% voting. And two of the largest precincts, Battle Creek and Country Club (are those UNC?), brought up the rear, due to a measly 2.4% turn out. So the graph doesn’t tell enough of the story there; those precincts are worth campaigning in if one can increase the voter turn out.

Election Day

Tuesday, November 8th, 2005

Everybody Votes Will Raymond


Everybody votes for Will Raymond for Chapel Hill town council!

Fall Chess Round 2

Monday, November 7th, 2005

White to move Round 2 brought my first (and probably only) wins in the tournament. We played these games on Yahoo, which worked out well. (Not only does is keep time and record the game, but it also prevents me from making an illegal move, like moving into check.) I was White in the first game. Computer analysis questions almost every move on both sides, but I managed to go up a couple of pawns only to soon gave them back trying to simplify into an ending with strong central pawns. I didn’t go about it the best way, but the position shown is still winning with a nice passed pawn. Unfortunately, I goofed with e4, giving Black a chance to equalize with Ra3+, but he missed it, too, and I survived.

Black to Move In the second game, I got off to an comfortable lead by winning a pawn and the exchange (my bishop for his rook), but I panicked a little in the given position. I suddenly saw the mate threat with bishop at h6 and queen at g7. The only way out I could see was to give back the exchange by Re6 (my rook for his knight). Turns out I had time to take the knight with the pawn and still meet Bh6 with Bf8. For some reason, he didn’t take the rook, though I still would have been up three pawns. I was eventually able to simplify the position and use my material advantage to win.

In the Round 1 notes, I mentioned I was working on using a JavaScript game viewer. LT-PGN-VIEWER looked promising, but I decided it wasn’t as good as the older Java applet. So the round 1 games are now available with the Java applet viewer: Game 1, Game 2.