Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.javascript > #38882

Re: Reading in PGN file

Newsgroups comp.lang.javascript
Date 2020-09-26 19:01 -0700
References <7d5e238c-921b-4db7-bb2a-870b49a237e0o@googlegroups.com>
Message-ID <7f2eebf2-d9a3-41f3-9140-2a8ff4ccb441o@googlegroups.com> (permalink)
Subject Re: Reading in PGN file
From luserdroog <luser.droog@gmail.com>

Show all headers | View raw


On Saturday, September 26, 2020 at 7:14:37 PM UTC-5, Jonas Thörnvall wrote:
> In practice it should be simple in reality to many monkeys at work.
> Any sain person would for the gameplay either use a "linebreak" always.
> 
> Or simply use space between the   ev - to - from, but the monkey just can't help themself.
> 
> Some think that randomly glue together moves a good idea. If you try to exchange the "most usual banana" the space to a linebreak. They present you with this. Is this kind of encoding really built in to the format or is the programmers that try to trip eachother, it seem random to me?
> 
> Since i am not clairvoyant enough to know where they put in the linebreaks, i simply tried to replace every space with a line break thinking i could read them in three by three. But since they work in mysterious ways i am not able...Event->From->To
> 
> Anyone have a better idea to group them 3 by 3 for easy use?
> gameString = gameString.split(" ").join('\r\n');
> One just wonder why they could not done something like
> 1. To From
> 2. To From
> 3....
> Or skipped the fucking linebreaks altogheter, gone for just spaces? But not randomly together with the three properties, its absurd at best but more probably programmer humor...
> 
> 1.
> e4
> c5
> 2.
> Nf3
> e6

I would start by replacing all linebreaks with spaces. Then go through
and add a linebreak just before any number followed by a digit (/[0-9]+\./).
Then maybe add a 'p' to all pawn moves. Adding the origin for each move
probably cannot be done automatically from the start. It depends on
where the relevant pieces are at any given time.

Back to comp.lang.javascript | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

Reading in PGN file Jonas Thörnvall <jonas.thornvall@gmail.com> - 2020-09-26 17:14 -0700
  Re: Reading in PGN file Jonas Thörnvall <jonas.thornvall@gmail.com> - 2020-09-26 17:29 -0700
  Re: Reading in PGN file luserdroog <luser.droog@gmail.com> - 2020-09-26 19:01 -0700
    Re: Reading in PGN file Jonas Thörnvall <jonas.thornvall@gmail.com> - 2020-09-26 19:17 -0700
      Re: Reading in PGN file Jonas Thörnvall <jonas.thornvall@gmail.com> - 2020-09-27 06:11 -0700
    Re: Reading in PGN file Jonas Thörnvall <jonas.thornvall@gmail.com> - 2020-09-27 05:10 -0700
      Re: Reading in PGN file Jonas Thörnvall <jonas.thornvall@gmail.com> - 2020-09-27 05:54 -0700
  Re: Reading in PGN file Scott Sauyet <scott.sauyet@gmail.com> - 2020-09-27 09:41 -0700
    Re: Reading in PGN file Jonas Thörnvall <jonas.thornvall@gmail.com> - 2020-09-27 10:57 -0700
      Re: Reading in PGN file Jonas Thörnvall <jonas.thornvall@gmail.com> - 2020-09-27 11:02 -0700
      Re: Reading in PGN file Scott Sauyet <scott@sauyet.com> - 2020-09-28 14:11 -0700
    Re: Reading in PGN file Jonas Thörnvall <jonas.thornvall@gmail.com> - 2020-09-27 11:00 -0700
      Re: Reading in PGN file Scott Sauyet <scott@sauyet.com> - 2020-09-28 14:14 -0700
    Re: Reading in PGN file Jonas Thörnvall <jonas.thornvall@gmail.com> - 2020-09-27 11:45 -0700
      Re: Reading in PGN file Jonas Thörnvall <jonas.thornvall@gmail.com> - 2020-09-27 13:29 -0700
        Re: Reading in PGN file Jonas Thörnvall <jonas.thornvall@gmail.com> - 2020-09-27 19:38 -0700
  Re: Reading in PGN file Jonas Thörnvall <jonas.thornvall@gmail.com> - 2020-09-28 04:30 -0700
    Re: Reading in PGN file Scott Sauyet <scott@sauyet.com> - 2020-09-28 14:25 -0700
      Re: Reading in PGN file Jonas Thörnvall <jonas.thornvall@gmail.com> - 2020-09-28 14:42 -0700
        Re: Reading in PGN file Scott Sauyet <scott@sauyet.com> - 2020-09-30 14:00 -0700
          Re: Reading in PGN file Jonas Thörnvall <jonas.thornvall@gmail.com> - 2020-10-07 00:59 -0700

csiph-web