Opening names

Opening names

Help

Cookies help us deliver our Services. By using our Services or clicking I agree, you agree to our use of cookies. Learn More.

Wang Leader

Tower of Wang

Joined
12 Dec 02
Moves
29286
10 Jul 04

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.🙂

E
Damn fine Clan!

The Double R Diner

Joined
03 Sep 03
Moves
72459
10 Jul 04

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.

R

London

Joined
05 Mar 03
Moves
6047
10 Jul 04

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.

D

Wellington, NZ

Joined
08 Jan 04
Moves
4274
12 Jul 04
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.

k

Joined
15 Apr 04
Moves
10409
12 Jul 04

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...

RHP Code Monkey

RHP HQ

Joined
21 Feb 01
Moves
2419
12 Jul 04
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

R

London

Joined
05 Mar 03
Moves
6047
12 Jul 04

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.