Solved

Chess PGN notation

Posted on 2010-08-27
7
754 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 300 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
Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

 
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 62

Assisted Solution

by:☠ MASQ ☠
☠ MASQ ☠ earned 200 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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Regex golf anyone? 10 504
How do I lock down a trademark? 11 70
Identify the song 15 104
Video Game Storyline Theory and Development 4 51
Artificial Intelligence comes in many forms, and for game developers, Path-Finding is an important ability for making an NPC (Non-Playable Character) maneuver through terrain.  A* is a particularly easy way to approach it.  I’ll start with the algor…
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…
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …

743 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now