Scott's Chess Programming

From GodOfDarkness

Jump to: navigation, search

I'm going to start a programming project (probably from scratch, since sourceforge didn't come up with precisely what I was looking for, and it'll be a good exercise in writing something useful). Rather than put documentation and whatnot on a wiki at scottcaplan.com, I thought I'd put it in a place where people will actually look!

Kidding aside, though, I'd like to enlist as much help as I can get from GodofDarkness denizens. Any help, even if just in commentary or guidance on the programming process (since programming in Scheme does not really qualify me as a codemonkey) is greatly appreciated.

So, what would I like to do?

I have to go pick up pizza now, so I'll write this part after dinner.--Scottc229 15:22, 25 June 2006 (PDT) Dinner's over. So what would I like to do? Well, there's two things I'm currently interested in writing:

1) A method for broadcasting games, preferably written in Ruby (since I want to learn Ruby). 2) A method for displaying games, given a PGN file, preferably written in PHP so that I can turn it into a Wordpress plugin.

I think I"m going to work on (1) first, since (2) will probably be a little bit tougher (if I'm wrong about this, please correct me).

If you're interested in helping to code this, you should check out the PGN specification. Another live broadcasting software (PALive) has suggested an addition for timestamping moves, which could be a neat idea, but first I'm interested in a really barebones implementation of PGN. For (1), I should be able to play out a game on a board, and output a PGN or a position representation (the PGN representation would ideally contain the ECO code for the opening). For (2), I should be able to upload a PGN game. For (2) it would be nice to be able to make use of PGN's extra features (like names of players, location of event, countries and ELOs, ECO codes, etc.)

Lastly, I would really like for (1) to input moves the same way ChessBase does (click on a square, it highlights the pieces that can go there, etc.). (2) to have keyboard shortcuts to move throughout the game, such as the arrow keys, or because I'd like to think that Google brought back a trend, the j and k keys.

Machinery for (1)

Some of this may or may not be ported to (2), but for the time being, I'd like to have the following objects:

Note: Initially, I will localize the software, but I'm only providing settings for PGN in English.

Position. Positions should contain the data element of an array roughly being equal to the FEN standard described in the above link to the PGN spec. If somebody else wants to extend capabilities to include EPD, they're more than welcome, but I'm not interested right now. However, instead of using text, since I can, I'll use arrays. Import and Export (if I ever decide to put an import position feature), should input from and output to FEN format.

The first element in the array is the piece arrangement, which should be an 8 x 8 matrix. Doing this, of course, requires functions which will convert to and from the FEN format. However, for internal coding purposes, it should be easier to deal with such a matrix.

Note: Unless somebody can give me a good reason to do so, elements in the array will not be square objects. Square objects will contain pieces or be Empty (ie, Square.Empty?() should give 1 if the square is empty, 0 otherwise).

All this said, the barebones of what I need, besides the two functions for FEN conversion, I need:

  • A method for a board that displays the position of the given (this will be the hardest part for me).
  • A method for a position that takes a move in internal format and makes the move on the position, if legal, and returns an error message otherwise.
    • A method to take an input move in algebraic notation and convert it into internal format.
    • (to be developed later) An event handler for the board object to pass a move in algebraic notation to the board's current position. This step should be localized so that a global variable determines the language of the notation. (I don't want to go directly to the internal format because ideally I'd be able to print games or export them to PGN when I'm done).
  • A method for the board that publishes the current version of the game to a given site (the path to the site is stored by the board object).


Final note: thoughts and comments (especially from Dan) would be welcome.

Personal tools