Please turn on javascript in your browser to play chess.
Developers Forum

Developers Forum

  1. 23 Jun '07 16:19
    I'm rewriting (because I lost the one I wrote a few years ago) a program to randomly create chess positions. The original plan was to create a random position, copy the FEN, and import that position in Fritz X to play (or kibitz).

    Then it occurred to me that I might just be able to finish the game in my own program - no export or copy or anything like that.

    So the question is (for you fellow programmers) how hard is it to use on of my engines like Fritz, Shredder, Rybka, etc, as a UCI engine in my own program? Does anyone know of a tutorial for this topic online?

    Another question I have: Do you know of an .ocx or a .dll file that might help in the graphical parts of the program? Moving the pieces for example?

    And lastly, creating a "random" position on the board is no problem. But the position is not always a legal one. For example, both kings might be in check at the same time. I could write the code to avoid illegal positions, but if it's already been done in an .ocx or .dll, why rewrite it?

    Any ideas?
  2. Standard member Ragnorak
    For RHP addons...
    24 Jun '07 00:15
    Originally posted by DroopyPawn
    Another question I have: Do you know of an .ocx or a .dll file that might help in the graphical parts of the program? Moving the pieces for example?
    Not sure if this answers your question, but it's very easy to graphically represent the chessboard as a string_grid, using one of the many chess fonts which already exist.

    D
  3. 24 Jun '07 02:36
    Originally posted by Ragnorak
    Not sure if this answers your question, but it's very easy to graphically represent the chessboard as a string_grid, using one of the many chess fonts which already exist.

    D
    Yeah. I'm doing that and that's how I did it last time too. In fact, I created my own font (from some of the others) just for that purpose. In my previous program, I think I used icons when moving the pieces (and maybe even as pictures on the board). I'd like to have a drag-and-drop interface when moving the pieces but I suppose clicking the start square and then clicking the target square would be fine too. I could change the background color (or highlight the edges) of the cell that contains the piece's start position.

    By the way, I did find an .ocx call chesstools.ocx. I haven't messed with it much and I suspect that it's not complete, or at best, buggy.

    My original question about using UCI engines in my program remains. I'd like to create a random position and then let Rybka give it a score. If the score is not "about even" then I could create another position until an "even" position is reached.

    It's interesting to see some of the positions that my program comes up with randomly. I'm working now on eliminating illegal positions.
  4. 24 Jun '07 23:38
    Ok. All the basic stuff is done now. The program will randomly create a LEGAL chess position and put it on the board. I can also copy the FEN and paiste it into Fritz or Chessbase (or any other program that accepts FEN paiste.)

    But I'd like more info on importing/executing a UCI engine in my program.

    Anyone?
  5. 25 Jun '07 03:35 / 3 edits
    Here are a few purely random positions created by my program. Some of them could obviously never occur in a real game but it still looks like it might be fun to play out some of these positions.