Toby Segaran, author of the highly esteemed and good-read Programming Collective Intelligence (published by O'Reilly, so you know it's good), released all of the source code that he talked about in the book. You can find it all here on his blog: http://blog.kiwitobes.com/?p=44.
He talks about hill climbing and variants (random restart, simulated annealing). He does a great job of explaining the algorithm and the math behind the hill climbing decisions. For optimization, something hill climbing is not even the best tool. Look at some of the other optimization strategies he employs (specifically the genetic mutation algorithm).
I highly recommend buying the book, even if only one chapter currently interests you. I bet you the other chapters will too. It's on Amazon, and at B&N if you want it this second.