Onwards and upwards! For today’s chess puzzle, let’s take a first crack at the Knight's Tour^{1}

Onwards and upwards! For today’s chess puzzle, let’s take a first crack at the Knight's Tour^{1}

After two weeks, it seems only right that we actually get around to a real chess puzzle. First on the list: Eight queens puzzle.

Specifically, how do you place n queens on an n by n chess board such that no pair of queens can attack one another?

Now that we’ve got Ludum Dare out of the way, back to chess! Last time, we defined all of the pieces, which is all well and good, but what we really need is a board. More specifically, we want something that can:

- Represent an 8x8 chess board, storing the location of pieces (including the owner of each)
- Add logic for collisions, so that when moving a piece, you cannot move through others or capture allies
^{1} - Add rendering code to display the current chess board (must be flexible enough to handle arbitrary glyphs for fairy chess pieces)

I think that’s about enough for the moment. Let’s do it!

Here’s something I haven’t done much^{1}: chess puzzles! I’m still not sure entirely what I think about the game in general. There is certainly quite a lot of strategy, which I like, but to really get good at chess, there’s also some amount of memorizing openings and closings. That’s something I’m a little less thrilled with.

Still, it’s the perfect sort of came to work out programming exercises with. It’s a game of perfect information, so you don’t have to deal with what a player knows and doesn’t. The pieces have well defined, regular moves^{2} There’s a fairly intense branching factor, but not insurmountable–Deep Blue (chess computer) proved that.

Anyways, enough chatter. Let’s play some chess!

How many ways are there for a knight in chess from the top left to the bottom right of a chess board in exactly *n=6* moves?

Well there you have it. Three days to a feature complete game.

I ended cutting one of the kinds of levels, but other than that I got everything that I wanted in the game. It’s got 10 different kinds of pieces, 8 different kinds of levels (most procedurally generated), and statistics galore. It actually turned out to be kind of fun, although it’s a bit slower than I’d like. Not much I can do about that though without implementing a mouse interface (which I’ll probably do some day).

Here’s another day’s work on ChessLike. It’s actually a bit less full featured than yesterday, but I’ve made a lot of progress towards the dungeon framework that I’m going for.

Back around the last Ludum Dare, I decided to try out One Game A Month. Basically, the goal is to write one complete game per month, every month in 2013. Of course I’m great at putting things off until the very last minute–I finally started yesterday. So it goes.