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

Help Forum

  1. Standard member Mrbobs
    Wang Leader
    10 Jul '04 11:43
    Just an idea, but how about showing the name of the opening that is being played on the game board page. That way, over time, i may be able to sound a little smarter when playing OTB chess.
  2. Standard member Exy
    Damn fine Clan!
    10 Jul '04 11:54
    I would imagine this might be a bit tricky as you would have to write a routine that analysed each game and identify it from an opening book database. I can see some merit in the idea but I think it would be very time cosuming to code and may well put a strain on the speed of the games database.
  3. 10 Jul '04 13:10
    Difficult to implement, yes. Compute intensive - not necessariiy! There are some very efficient chess database programs out there, most of which are able to identify a chess opening very quickly.

    Once the game's moves have been turned into text string in a standard notation, a simple search is all that's needed to find the opening whose representation in the same format is the longest exact match for the first part of the game. Whatever representation this site uses for a game in its database, it should not be too tricky to convert a reasonable-sized database of openings to the same format.
  4. 12 Jul '04 10:16 / 1 edit
    All you'd need is a database table containing both FEN values, and the opening names.

    Then you can use the SQL statement:
    PARAMETERS GameID LONG;
    SELECT OpeningName FROM Openings WHERE (Openings.FENValue = Games.FENValue) AND (Games.ID = GameID);

    Or something very similar.
  5. 12 Jul '04 10:53
    Rather than having it automatically displayed, it may be better as a link on each game then it wouldn't affect the speed of the games database so much...
  6. Subscriber Russ
    RHP Code Monkey
    12 Jul '04 12:30 / 1 edit
    Originally posted by kw72uk
    Rather than having it automatically displayed, it may be better as a link on each game then it wouldn't affect the speed of the games database so much...
    This is true. It could exist on the analyse game page, but not on the regular board view.

    -Russ
  7. 12 Jul '04 22:37
    I had envisaged storing the standard chess opening code (D01 or whatever) as part of the game record. That way there is a small storage cost, but very small processing cost (similar to computing the FEN, less than checking for legality, I would imagine.) The opening code could be displayed in games lists at a modest bandwidth cost.

    I am not sure whether using the FEN or the move list is better. After a few moves, the FENs would no longer appear in a list of openings, but all move lists must have a leading string that will match. On the other hand, using the move list would fail for unusual transpositions. Whenever you have a FEN that doesn't match or a move list that is not an exact match, you stick with the previously computed opening code, so maybe it's down to the size of the representation of an opening: a move list will be more compact than a FEN for the first few moves.