Parsing PGN file

Sort:
Very_Chessy_Joke

I'm writing some software (a personal hobby project) that, amongst other things, can parse PGN files. I can see how the board layout works and have written that part of the code, but can somebody tell me what the data to the right of it represents? Thanks.

[CurrentPosition "8/6B1/2K5/8/8/4k3/6B1/8 w - - 10 6"]

BTW In case anybody wants some chessboard graphics and my code I'll release it into the public domain. Shame to let it go to waste as I'm not really making use of it. Like I said it's a hobby project I'm still working on, so if you want to improve the code or use the graphics (in the resource zip) it's up to you.

https://app.box.com/s/yo6zp4lhmxu3lkfnmwamr92zhxlk81ts  

KiwiTai

I think what you have typed above is FEN notation, but anyway is is a link - https://en.wikipedia.org/wiki/Forsyth%E2%80%93Edwards_Notation

I got interested in the makeup of FEN a while ago, so I decided to have a look at it. I moved the pieces around on the analysis board to see how it would effect FEN.

You'll see this on the link, 

  • the w means it is White to move
  • the next refers to whether anyone can castle - in your case no one can castle
  • the third refers to whether en passant is possible
  • 10 refers to how many moves it has been since either a pawn move or a capture (useful for 50 move rule)
  • and the last refers to the number of moves

For example here is one that white has the option to capture en passant on f6

rnbqkbnr/p1ppp1pp/1p6/4Pp2/8/8/PPPP1PPP/RNBQKBNR w KQkq f6 0 3

All the best with your software writing!

mgx9600

The "10" is in ply; "6" is in turn count (2 plys per turn).

 

NichtGut

Your link is broken.

If you look for "FEN parser" you will get code that already does it. If you want to do it yourself here is the meaning of each character:

https://en.wikipedia.org/wiki/Forsyth%E2%80%93Edwards_Notation

Very_Chessy_Joke

Thanks, I thought that's what each represented, but that was a 22 move game, so I was wondering why it ended in 10 6. 

For some reason "%C2%A0%C2%A0" is added to the end of the link, if you delete that it should work.

NichtGut

The link works for me. I noticed that but I thought it would work for anyone. I guess it has to do with the hyphen.

https://en.wikipedia.org/wiki/Forsyth–Edwards_Notation

 

Chess.com formats it and adds those weird characters. Weird