Thursday, 13 August 2009

Sudoku

Whilst checking out the new programming language Scala I suddenly had this strange urge to write a program to solve Sudoku problems. It occurred to me that the solutions to Sudoku could be found fairly easily using a recursive brute force algorithm. Anyway I put the Scala stuff to one side and reverted back to my old favorite Groovy.
Writing the code was fairly simple - the algorithm is rather straighforward...

solve( board )
foreach blank space on the board
for the numbers i = 1 to 9
if i is eligible (meets the row/col criteria)
set the blank space to i
if solve(board) returns true then return true
else
try the next number
if all numbers tried return false
if all spaces tried return true

The funky thing is that given a blank board the program will generate an entire Sudoku number set for you. Alternatively you can place numbers at random places on the board and then get the program to fill in the rest. An interesting thing to try is to attempt to find a pattern on numbers which takes the longest number of iterations to solve. Naturally, if the initial pattern fails the essential Sudoku criteria then no solution will be found by the algorithm and you will end up with the program making something in the order of 9^81 attempts before failing.

You can download my completed version from here.

Ortlieb

Finally, my old Vaude panniers gave up the ghost so I decided that now is the time to splash out on a new set just before our (not so epic) Dorset holiday.

Though the Vaudes have been good they do have a few niggling design flaws (Vaude, are you listening?)

  • The side pockets are so tight as to be practically useless for stowing anything but the thinnest maps in them.
  • The zips on said pockets are quite flimsy.
  • The strap lengths that fasten down the top covers are short and poorly fitted to the pannier body.
  • And, finally - my biggest gripe - the hook mechanism that attaches the pannier to the bicycle makes the pannier very difficult to remove. The only way I ever found to remove a pannier from my bike was to give the handle a really rather violent tug. Similarity re-attaching the said pannier was difficult as the mechanism and claws are so tight.
Anyway - Evans Cycles managed to provide me with a lovely set of Ortlieb panniers (Ortlieb have been referred to as the 'Rolls Royce' of pannier makers). I must say I really am impressed with these panniers so far (1 Dorset holiday and 2 weeks of cycle commuting later). They address all of the niggles listed above. I particularly like the mechanism for attaching to the bicycle rear rack - it is designed to be robust yet easily adjustable without requiring any spanners or keys of any sort. The detach-attach mechanism is so smooth as to leave you wondering whether the bags really are firmly attached to the rack. Needless to say , all the time I have been using them, and that's over some rather rough terrain at times, I have never dropped an Ortlieb pannier. On top of this there is the legendary Ortlieb waterproofability and a set of carrier straps which can be hooked onto the pannier so one can carry around as a shoulder bag.

Of course - I've not had these panniers too long to make a decision about their durability, but I'll keep this blog informed as to how they are getting on.