Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Chess PGN notation

Posted on 2010-08-27
7
Medium Priority
?
772 Views
Last Modified: 2012-05-10
Hey everybody, I'm making a chess AI. I have most of the internals working, but now I need to get it to recognize PGN notation and store move combinations.

I had a question that I still cannot figure out about PGN (Portable Game Notation).

For instance, a move: Nxd6

With these moves, say you have both of your Knights, and they could both capture the piece on d6. How would you specify this?

This could also be an issue with Rooks.

Also, for extra credit, what does the + mean? And is there a special notation for au pasaunt?

Thanks guys!

-Jeff
0
Comment
Question by:jeffiepoo
  • 3
  • 3
7 Comments
 
LVL 6

Author Comment

by:jeffiepoo
ID: 33546642
** how would you specify which Knight took the piece on d6?
0
 
LVL 8

Expert Comment

by:jimmyray7
ID: 33546821
+ means the move put the opponent in check.  No notation for en passant, the move is just noted.
0
 
LVL 8

Accepted Solution

by:
jimmyray7 earned 900 total points
ID: 33546838
regarding the Knight issue:
------------------------------------------
Disambiguating moves

If two (or more) identical pieces can move to the same square, the piece's initial is followed by (in descending order of preference):

   1. the file of departure if they differ;
   2. the rank of departure if the files are the same but the ranks differ;
   3. Both the rank and file if neither alone uniquely defines the piece (after a pawn promotion, if three or more of the same piece are able to reach the square).

For example, with two knights on g1 and d2, either of which might move to f3, the move is indicated as Ngf3 or Ndf3, as appropriate. With two knights on g5 and g1, the moves are N5f3 or N1f3. As above, an x may be used to indicate a capture: for example, N5xf3.
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 6

Author Comment

by:jeffiepoo
ID: 33547046
Excellent, this may be interesting to parse, but it is doable. Will pawns have a similar story?

This is my understanding of pawns.

A capture is not explicity illustrated by an x, the PGN representation like c5 just means a pawn moved to this position or captured a piece at this position. Say, if two pawns could both move to the same square, i.e. - can capture the same piece, it would be represented as:

cge5   ???

also from what you described, it seems that the longest move string could be 6 characters long. Ex: "Ng5xe4"  correct?
0
 
LVL 8

Expert Comment

by:jimmyray7
ID: 33547127
I'm not 100% sure that my second comment is strict PGN.  It's "normal" chess notation, but I couldn't find anything specifically stating it was valid PGN.

Pawns should work the same.  I hope that helps!
0
 
LVL 63

Assisted Solution

by:☠ MASQ ☠
☠ MASQ ☠ earned 600 total points
ID: 33549009
For disambiguation usually PGN defaults to the originating square in SAN (i.e. Nc4xd6) SAN in PGN allows up to seven characters so you could simply code using origin by default.
en passant is indicated as a capture but the destination SAN is the actual square the pawn moves to & not the reference to the actual captured piece's location. Although algebraic notation uses "ep" to record this "ep" is not used in PGN.
I guess you already have this http://www.saremba.de/chessgml/standards/pgn/pgn-complete.htm
 
0
 
LVL 6

Author Closing Comment

by:jeffiepoo
ID: 33553336
Thanks guys
0

Featured Post

Ask an Anonymous Question!

Don't feel intimidated by what you don't know. Ask your question anonymously. It's easy! Learn more and upgrade.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

As game developers, we quickly learn that Artificial Intelligence (AI) doesn’t need to be so tough.  To reference Space Ghost: “Moltar, I have a giant brain that is able to reduce any complex machine into a simple yes or no answer. (http://www.youtu…
Recently, in one of the tech-blogs I usually read, I saw a post about the best-selling video games through history. The first place in the list is for the classic, extremely addictive Tetris. Well, a long time ago, in a galaxy far far away, I was…
Want to learn how to record your desktop screen without having to use an outside camera. Click on this video and learn how to use the cool google extension called "Screencastify"! Step 1: Open a new google tab Step 2: Go to the left hand upper corn…
In a question here at Experts Exchange (https://www.experts-exchange.com/questions/29062564/Adobe-acrobat-reader-DC.html), a member asked how to create a signature in Adobe Acrobat Reader DC (the free Reader product, not the paid, full Acrobat produ…
Suggested Courses
Course of the Month12 days, 5 hours left to enroll

916 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question