mliebelt / pgn-viewer

Simple PGN viewer with the necessary features to display chess games
GNU General Public License v3.0
159 stars 44 forks source link

Ugly display of many games #518

Open mliebelt opened 5 months ago

mliebelt commented 5 months ago

When I look at the examples in the documentation, I see the following:

image

This is rendered from the following source, when showing many games:

var pgn = ['[White "Me"][Black "You"] 1. e4 e5 2. Nf3 Nc6  3.Bc4 Bc5 4.b4 Bxb4\n\n
[White "You"][Black "Magnus"] d4 Nf6 c4 e6 Nf3 Be7 g3\n\n
[White "Magnus"][Black "Me"] e4 c5 Nf3 d6 d4 cxd4 Nxd4 Nf6 a3 '].join(" ");

So when some of the (usual) tags are missing, we get an unpleasant rendering of the list of games. Of course, if there is not too much information, it is not so easy to do a nice rendering in the list. The following heuristic could be used in the function printTags:

  1. Use the tags if all are available.
  2. Have useful replacement for missing tags:
    • Date: ??.??.????
    • White: unknown
    • Black: unknown
    • Event: leave empty
  3. If no tags are given at all, replace it by having the first few moves of the mainline.