<pedrocorreia.net ⁄>
 

<Programming Puzzles, Chess Positions and Huffman Coding ⁄ >




clicks: 136 136 2009-12-08 2009-12-08 goto programacao myNews programacao  Bookmark This Bookmark This


Now I'll admit that I love this kind of question. I'm not really such a big fan of Code Golf as that's an exercise in writing terse, unreadable code (although some of the solutions have been brilliant). But this Chess problem is the sort of thing that will allow a programmer to demonstrate his or her mental acuity and problem solving ability (or the lack thereof).

The Problem

What is the most space-efficient way you can think of to encode the state of a chess game (or subset thereof)? That is, given a chess board with the pieces arranged legally, encode both this initial state and all subsequent legal moves taken by the players in the game.

This image illustrates the starting Chess position. Chess occurs on an 8x8 board with each player starting with an identical set of 16 pieces consisting of 8 pawns, 2 rooks, 2 knights, 2 bishops, 1 queen and 1 king as illustrated here:



este é só um excerto do artigo, para aceder ao artigo completo, clique no link em baixo:
this is just a small excerpt from the article, to access the full article please click in the link below:

http://www.cforcoding.com/2009/12/programming-puzzles-chess-positions-...




Subscribe News RSS  Subscribe News Updates by E-mail





myNews <myNews show="rand" cat="programacao" ⁄>

Creating an Ajax Login Form With jQuery

In this post I want to show you how to use jQuery to create an AJAX login screen (...)

clicks: 351 351 2009-03-24 2009-03-24 goto url (new window) dev102.com/2009... goto myNews programacao


PHP - Creating a Sudoku Generator

Coding this took a little longer than I expected, but it was well worth it. I su (...)

clicks: 718 718 2006-10-12 2006-10-12 goto url (new window) adamrisser.com/... goto myNews programacao


XML for PHP developers, Part 1: The 15-minute PHP-with-XML starter

It's hard to miss the importance of XML in today's application development envir (...)

clicks: 475 475 2007-03-12 2007-03-12 goto url (new window) www-128.ibm.com... goto myNews programacao


What are Hash Tables and how do they work?

As we saw with binary search, certain data structures such as a binary search tr (...)

clicks: 492 492 2008-08-15 2008-08-15 goto url (new window) datastructures.... goto myNews programacao


CSS for Programmers

When used properly CSS can be an elegant and efficient way to express the presen (...)

clicks: 428 428 2007-11-10 2007-11-10 goto url (new window) niqos.com/posts... goto myNews programacao


PHP zipping algorithm

How can we zip two files and save output as output.zip. For example, in gmail yo (...)

clicks: 437 437 2008-06-01 2008-06-01 goto url (new window) sajithmr.com/ph... goto myNews programacao


Use Functional Programming Techniques in the .NET Framework

A recent entry into the Microsoft .NET Framework family, F# provides type safety (...)

clicks: 403 403 2008-03-13 2008-03-13 goto url (new window) msdn2.microsoft... goto myNews programacao


5 HTML elements you probably never use (but perhaps should)

This is a list of HTML elements I've found to be very poorly represented in most (...)

clicks: 477 477 2006-08-16 2006-08-16 goto url (new window) seomoz.org/blog... goto myNews programacao