Category Archives: General

Easy to construct, 18×18 magic square.

If you take the decimal expansion of 1/19, 2/19… up to 18/19, and write out the first 18 digits of the decimal expansion of each, you get:

 0  5  2  6  3  1  5  7  8  9  4  7  3  6  8  4  2  1 | 81
 1  0  5  2  6  3  1  5  7  8  9  4  7  3  6  8  4  2 | 81
 1  5  7  8  9  4  7  3  6  8  4  2  1  0  5  2  6  3 | 81
 2  1  0  5  2  6  3  1  5  7  8  9  4  7  3  6  8  4 | 81
 2  6  3  1  5  7  8  9  4  7  3  6  8  4  2  1  0  5 | 81
 3  1  5  7  8  9  4  7  3  6  8  4  2  1  0  5  2  6 | 81
 3  6  8  4  2  1  0  5  2  6  3  1  5  7  8  9  4  7 | 81
 4  2  1  0  5  2  6  3  1  5  7  8  9  4  7  3  6  8 | 81
 4  7  3  6  8  4  2  1  0  5  2  6  3  1  5  7  8  9 | 81
 5  2  6  3  1  5  7  8  9  4  7  3  6  8  4  2  1  0 | 81
 5  7  8  9  4  7  3  6  8  4  2  1  0  5  2  6  3  1 | 81
 6  3  1  5  7  8  9  4  7  3  6  8  4  2  1  0  5  2 | 81
 6  8  4  2  1  0  5  2  6  3  1  5  7  8  9  4  7  3 | 81
 7  3  6  8  4  2  1  0  5  2  6  3  1  5  7  8  9  4 | 81
 7  8  9  4  7  3  6  8  4  2  1  0  5  2  6  3  1  5 | 81
 8  4  2  1  0  5  2  6  3  1  5  7  8  9  4  7  3  6 | 81
 8  9  4  7  3  6  8  4  2  1  0  5  2  6  3  1  5  7 | 81
 9  4  7  3  6  8  4  2  1  0  5  2  6  3  1  5  7  8 | 81
------------------------------------------------------+
81 81 81 81 81 81 81 81 81 81 81 81 81 81 81 81 81 81   81

The sum of the rows, colums, and it turns out, the main diagonals is 81, which means that it’s a magic square. It’s not hard to see why the rows and columns are sum to the same, but the diagonals are a bit trickier. Anyway, just something to think about.

25 Cent I2C Adapter

I doubt I’ll ever need this, but I still think it’s kind of neat. I2C is a two wire serial bus that is used in many microcontrollers to access peripheral devices using only a couple of wires. This hack notes that most modern graphics cards communicate with monitors in a similar way using a technology called “DDC”. This allows your graphics card to simply ask the monitor what resolution and scan rates it supports. The hack is to use the DDC stuff to talk to I2C peripherals. I think that’s pretty cool.

25 Cent I2C Adapter

Checker game from the past…

Samuel’s Program v. NealyI dusted off my copy of Schaeffer’s book One Jump Ahead: Challenging Human Supremacy in Checkers and reread the description of the match between Arthur Samuel’s checker playing program and Robert Nealy. Samuel’s program managed to beat Nealy, who advertised himself as a master, but in fact he makes a number of rather questionable (I’m being kind) moves that suggest he wasn’t really all that he said he was.

As part of my testing, I dusted off this particular position from the game as a challenge for milhouse to work through. Nealy is playing white, and moved 32-27. This is widely considered to be a terrible move: Schaeffer claims that the game was a virtual draw to this point, after this move, Chinook was capable of doing an 11 ply search that put it into its end game database and assured a win for Black. Interestingly enough, when confronted with the same position, milhouse made the same choice! It views the scores for all the possible alternatives after an 18 ply search as:

Puzzle Samuel Checkers v. Nealey loaded.
Color is set to white.
        +--------+
        | w - - -|
        |- - w - |
        | - - w w|
        |w r - - |
        | - - r -|
        |- - - - |
        | - r - -|
        |- r r - |
        +--------+

milhouse: annotate
        20-16 : -43
        21-17 : -201
        22-17 : -73
        22-18 : -9985
        26-23 : -193
        32-27 : -5
        32-28 : -116

The move 20-16 is the preferred line. I don’t find this too surprising that milhouse gets this wrong: I don’t have a very strong evaluation function here, and in particular I don’t give any special bonus to protecting the rear ranks. I obviously need some additional work. Playing the game out at 18 ply doesn’t follow the historical line: we end up with a pretty standard draw type situation.

Addendum: Martin Fierz has the entire game online. On move 25, Samuel’s program moves 2-6, and it appears that with an 18 ply search, milhouse greedily takes the same move, which Fierz labels as “awful”. Lots left to do.

Addendum2: In the same position above but with a 22 ply search, milhouse returns the correct 23-18 move, although it still doesn’t see it as a win.

Dusting off Milhouse…

It doesn’t get this one right…Since looking at Olithink a few days ago, I’ve been re-bitten by the “write your own game” bug, and dusted off milhouse, my Checkers program that I started a couple of years ago, but which I abandoned because I felt that it hid some obscure bug. Today, I tried adding some additional code to determine where the bug is hiding (optimistically assuming that there is only one, which frankly, is overly optimistic). In trying to figure it out, I tried it in a simple 2 king versus 1 king endgame. Black here can force a win by driving white into the black corner at 4. If White is allowed to doddle around in the double corner, there is no way for Black to force the win. So, in this situation, with Black to move, the proper move is 14-9 14-18. This forces white to retreat closer to the black corner (2-7) and you can eventually (although, to me, novice that I am, it’s still a bit tricky to work it all the way out) trap him in the corner. White cannot movr back with 2-6 (which loses instantly, so response with 2-7, to which Black response 18-15. Now, White is well and truly screwed. If he returns to 2, then Black responds with 15-11 and wins, or if White retreats to 3, the 15-11 pins him against the wall and White loses again. But stupidly, my program seems to love the 1-5 move, which frees white to move back to the double corner, and while white gains no safety, it doesn’t make any headway to capturing him.

Some bug is hiding in here, to be sure.

Addendum: if I’ve botched the analysis of this, then I am confessing that it is just as likely that bugs remain in my own understanding of the game, and that is as likely to hinder progress as bugs in my program.

Addendum2: The problem appears to lie with my transposition tables. When I disable them, it finds the appropriate moves. I’ll have to think really hard to figure out the bugs.

Addendum3: Here’s another example. It takes way too long to complete without transposition tables, but it does seem to find the right answer.

milhouse: puzzle 80
Puzzle SIMPLE TEST BUG loaded.
Color is set to white.
	+--------+
	| - - - -|
	|- - - - |
	| - - - -|
	|- - - - |
	| - - R -|
	|- - - - |
	| - R - -|
	|- - - W |
	+--------+

milhouse: playout
        1. ... 1-6
	2. 7-2
	2. ... 6-1
	3. 14-10
	3. ... 1-5
	4. 2-6
	4. ... 5-1
	5. 6-9
	5. ... 1-5
	6. 10-14
	6. ... 5-1
	7. 9-5
	7. ... 1-6
	8. 5-1
	8. ... 6-2
	9. 14-18
	9. ... 2-7
	10. 18-15
	10. ... 7-2
	11. 15-11
	11. ... 2-6
	12. 1x10
	+--------+
	| - - - -|
	|- - - - |
	| - - - -|
	|- - - - |
	| - - - -|
	|- R R - |
	| - - - -|
	|- - - - |
	+--------+


You’ll Own “Slaves” by 1965

Robots!   (Picture from Zombies from the Stratosphere)When I was a very young kid, my dad had copies of the old Mechanix Illustrated lying around. I remembered as a kid reading an article called “You’ll Own Robot Slaves by 1965!” which I remember making me think “Heck, it’s 1970, where is my robot slave?” Okay, heck, I was six. But oddly enough, it stuck with me, all these years later. Imagine my surprise to see that very article show up on the modernmechanix.com blog:

You’ll Own “Slaves” by 1965

I just thought it was neat.


Checkerboard…

In reading up about Olithink, I recalled my own not-too-good Checkers program that I called “milhouse”. It doesn’t really work very well, despite all my attempts to make it work. I dusted it off, and was reminded about its many shortcomings. Perhaps some day I’ll fix it. But I did dust off a checkers font I found, and made a nice looking checkerboard image anyway…

The Board.

Addendum: Got the font from here.

Nifty “demo” on an unusual platform

There is a segment of the computer art culture which works on creating “demos”: short bits of combined computer animation and music which play on computers. They are often praised for being clever and short. They seemed to start back during the time of the Commodore 64 and other 8 bit computers. But check out this demo to see what’s possible using an 8 bit computer today, without any dedicated sound or video chips at all.

Addendum: Dan pointed me at the full write up on the project, which includes a fairly basic schematic.

I’m genuinely sad….

I must admit, part of my fascination with computers and mathematics has to do with my early exposure to Martin Gardner’s absolutely fantastic Mathematical Games columns in Scientific American. As a grade school student, I remember reading these columns and through them, discovering for the first time the actual excitement of mathematics. It’s hard to explain to people who don’t share this particular penchant for mathematics, but there it is. Mathematical Games was important.

When Gardner finally retired from Scientific American, one of his eventual replacements was A.K. Dewdney, who renamed the column to Computer Recreations. While no one could replace Gardner, I found Dewdney’s columns to be fun and thought provoking. I have several of his books.

And here’s what’s sad: Dewdney is apparently has decided to become a 9/11 denier.

Jeffrey Shallit attended a “debate” where Dewdney was a speaker. He wrote it up in two parts: Part 1 Part 2. It’s sad. Really, really sad when someone you respect shows that they don’t deserve it.