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

Developers Forum

  1. 04 Feb '04 13:08
    I'm hoping to write a Perl script that will take RHP's PGN and turn it into something more like the standard. (You can install Perl for free onto most computers - certainly any that run one of RHP's supported browsers.)

    The main things I hope to fix are: supply all 7 mandatory tags (values will be ? for some), supply result marker at end, insert line breaks, remove extraneous ! characters, drop redundant ....

    I can't do anything about themed tournaments or set piece games, nor will I try to normalise Ng1f3 to Nf3 - your PGN-aware chess program can probably do that for you.

    Will this be of interest to many people here? I won't be able to do much until next week at the soonest.
  2. Standard member gregoftheweb
    The Great Gonzo
    04 Feb '04 18:44
    Why write it in Perl, you can accomplish all the regex in Javascript and therefore provide a web page interface for people to use. If you develop the regex I can put it on a page for you.

    I was going to do this but for two things. 1) winboard seems to interpret the pgn from RHP fine, and 2) it looked like a lot of regex'ing and I don't have the spare bandwidth to do it right now.
  3. 04 Feb '04 23:27
    Why Perl? Because I know Perl and I don't know Javascript's regex dialect. Can you point me at a really good online reference? Also, Javascript seems to me to be very vulnerable to browser-specific quirks.

    A web page interface would be a good idea, however. Can you host a CGI script?

    SCID, which I have recently started to try out, does not like RHP's style of PGN, so I will certainly want something for my own use.
  4. Standard member gregoftheweb
    The Great Gonzo
    05 Feb '04 00:20
    From what I understand ecmascript (javascript) implements Perl regex to the "t", I may be wrong.

    Regarding cross browser quirks in javascript, well that has primarily to do with the way the various scripting engines interact with the browser DOM. There is some common ground but there will always be non-standard quirks.

    Now working only with the regex engine, on a pgn string, say from one text box and into another, there would be minimal interaction with the DOM. You could access those two text boxes via the universal forms collection and not directly access the DOM at all.

    If you work out the regex to clean the pgn I'll help you get it on a web page. It'll be easy (famous last words of course).

  5. Standard member gregoftheweb
    The Great Gonzo
    05 Feb '04 00:21
    and I googled "javascript regex" and came up with a bunch of candidate links, but this one looked promising.
  6. 05 Feb '04 13:14
    Thire and I have been discussing this via personal messages, he suggested I post my ideas about the missing tags:

    Event - always "RHP Game"
    Date - parse from first move time, if available, else "????.??.??"
    Round - Game ID

    Ideally, for a tournament, Event would be the name of the tournament and Round would be the round number, but that requires external information.
  7. Standard member gregoftheweb
    The Great Gonzo
    05 Feb '04 22:33
    Send me your email addy in a PM and I'll zip up a simple web page with the requisit textarea's buttons and funcitons. You should be able to simple flesh out the string mod function and you'll be golden.

  8. Standard member gregoftheweb
    The Great Gonzo
    11 Feb '04 00:29

    done, thanks to Roland.
  9. 07 Jul '04 20:37
    That's pretty cool.

    I just wanted to let everyone know that I wrote one that takes the email that you with your 1-100 games in it and cleans it up for Loading into CM9000, and I assume other Chess apps as well. It is written in VB 6 and very simple, but it does the job.