# KenKen Cheat Program

December 23, 2009 1 Comment

I’ve now written a general KenKen ‘cheat’ program as an exercise in Haskell, with a Multimedia Fusion front-end.

One thing it required was the ability of the user to specify the shape. Now in essence this reduces down to the ability for numbers to be repeated. For instance, in a straight line of length 3, there must be three unique numbers and so the ‘configuration’ is ‘1,1,1’. (i.e. three numbers appear three times)

A 2-by-2 square on the other hand can have two numbers repeated twice. That is, the configuration can be ‘2,2’. However, you could also have 4 distinct numbers, that is ‘1,1,1,1’ or ‘2,1,1’ as well (one number repeated and then two other numbers). However, the ‘2,1,1’ can be derived from ‘2,2’ others by splitting up one of the twos into ‘1,1’. ‘1,1,1,1’ can be found by applying the same thing to the others.

As another example, ‘2,2,1’ is a derived configuration of ‘4,1’, as the 4 can be split into 2,2.

As an example of two configurations on the same number of squares where one isn’t a derivative of the other, take ‘3,1’ and ‘2,2’. (The latter represents a square and the former does not represent any connected shape.)

You might ask: Given any two configurations of the same shape, will one always be a derivative of the other? The answer is in fact ‘no’. The 6-square ‘U’ shape (with one side a bit longer than the other) for instance can have configuration ‘3,2,1’ or ‘2,2,2’. Note that ‘2,2,2’ is a configuration of a 2-by-3 square (and all others are a derivative of it).

In fact, every shape that has ‘3,2,1’ as a configuration also has ‘2,2,1’ as a configuration. However, I can’t find a more general derivative rule in order to make ‘2,2,2’ a derivative of ‘3,2,1’ (and also ‘2,2,2’ of ‘3,3’ and ‘1,3’ of ‘2,2’). Maybe I will think about that.

Anyway, a program has been made so you can find KenKen combinations. This is actually an easy thing to program on the whole. I’ve also used a slight modification of it to find all unique sums in more types of shapes. (The program works for products and such as well but it is less useful information.)

(The front-end is made in Multimedia Fusion)

And the new cheat sheet is here.

You might appreciate the “cheat sheets” I’ve made up for 4×4 + 6×6, 7×7, 8×8 and 9×9.

If you email me, I’ll attach them to my reply.