Forum Rules

Forum rules

(1) Posts are to be made in the relevant forum. Users are asked to read the forum descriptions before posting.
(2) Off topic posts are limited to active members who have actually posted on-topic in one of the chess-oriented sections in the past. Any user whose first post does not relate to chess will be banned permanently. Posts in the Introduction section do not count.
(3) Members should post in a way that is respectful of other users. Be tolerant at any time. Flaming or abusing users in any way will not be tolerated.
(4) Discussions on political and religious topics are not allowed. Posts containing elements thereof will be redacted or deleted and a temporary or permanent ban may be placed upon the user.
Discussions on politics in chess organisations and the way politics affect chess are allowed.
(4a) Drug use references are not allowed and discussions on drugs are not allowed.
(5) Members are asked to not act as "back seat moderators". If members have something to report they are welcome to bring it to the attention of moderator either by a PM or in this thread:
(6) If you wish to report a PM please forward the PM to a moderator and leave a post here: Don't hesitate to report a PM if you believe it violates the forum rules, even if someone else has already reported a (similar) PM by the same user; having more reports makes it easier for the moderators to take action.
(7) These rules apply to forum posts as well as private messages (PMs).
(8) Members should post in a way which is consistent with "normal writing". That is users should not post excessive numbers of emoticons (smilies), large, small or coloured text, etc. Similarly users should not SHOUT or use excessive punctuation (e.g. ! and ?) in topic titles or posts.
(9) Members should use an appropriate, descriptive title when posting a new topic. Examples of bad titles include; "Help me!", "I'm stuck!", "I've got an error!", etc. Examples of good titles include; "New Game: Perseus - SomeOtherPlayer", "Two Knights Defense: Fritz Variation and sidelines", etc.
(10) Spam is not tolerated here under any circumstance.
(11) Continuously linking your own website to promote it is not allowed. You may use your signature (which will come up beneath all your posts) for this purpose.
(12) Members should refrain from posting without adding to the discussion. Posting just to increase postcount is not allowed.
(13) Combine your comments into one post rather than making many consecutive posts to a thread within a short period of time. This can be done by clicking the 'edit' button next to your post.
If your last post, which is the last in the thread, is very old you may use the following trick to make sure it's bumped up to the new posts. Click on the 'edit' button of your last post. Copy the content of the post. Click delete and delete your last post. Paste the content of the now-deleted post in a new post, add what you will and click 'submit reply'.
(13a) You are not allowed to make consecutive posts. If you post more than once without a reply from another user, all posts after the first will be deleted.
(13b) Exceptions may be made for specific types of threads.
(14) Warez are intellectual property (software/music/movies/tv-series/tv-shows/etc) either through download, serial, or crack in a manner that breaks its copyright and/or license. You are not allowed to give/link to/ask for/advocate/provide information for obtaining and the use of warez.
Bittorrent links are not allowed.
(14a) The following international treaties apply:
-Berne Convention for the Protection of Literary and Artistic Works (Berne Convention) (Berne, 1886)
-Universal Copyright Convention (UCC) (Geneva, 1952)
-Agreement on Trade-Related Aspects of Intellectual Property Rights (TRIPS) (Marrakesh, 1994)
-World Intellectual Property Organization Copyright Treaty (WIPO Copyright Treaty) (Geneva, 1996)
(15) Books published before 1920 are considered free of copyright and e-books thereof are not warez. Books published after 1920 with permission from the author are considered free of copyright and e-books thereof are not warez provided it can within reason be established that permission has been given. All other books are considered copyrighted and e-books thereof are considered warez.
(16) Usernames that contain obscene or vulgar language or denigrate individuals and/or organisations are not allowed.
(17) Users may only delete their own posts on the grounds that they constitute a severe breach of these rules. Even when this is the case, the editing of the post to effect repairs must at all times be considered first.
The emptying of posts (substituting the content by non-content) is explicitely considered a breach of this rule.
Deletion of whole batches of posts harms thread continuity and the forum as a whole and the Moderation team will take action; in the most extreme case an account may be permanently banned to preserve the posted.
(18) Administrators (Admins) and Moderators (Mods) reserve the right to edit or remove any post at any time. The determination of what is construed as indecent, vulgar, spam, etc. is up to them and not to forum members.
(19) Aforementioned Admins and Mods reserve the right to edit this list of rules at anytime.
See more
See less

Creating PGN files (with notepad)

This topic is closed.
This is a sticky topic.
  • Filter
  • Time
  • Show
Clear All
new posts

  • Creating PGN files (with notepad)

    //Creating and editing PGN files with notepad.//
    This tutorial was created as an answer to a number of questions by forum users in the past and present. It is my hope that it will serve as an answer for such questions in te future. In the process, it's my personal hope to become more adapt at editing PGN files myself.

    //Some basic information on PGN files//
    We all know about PGN files. It's short for: "Portable Game Notation file"; note the words "game" and "file". The name indicates that it is a digital (portable) way to write down (notation) a game in a file. PGN files end in the extension ".pgn", but are basically just simple text files (.txt) in the PGN format and with a different extension.
    "Why is any of this important?" you wonder. Well, in answer, it makes thinking about how to create and edit them a lot simpler.

    //Creating PGN files with Notepad//

    //1. Tag!//
    Any PGN file starts with the game's specifics, written down in tags. Tagged information is put in [brackets]. There are 7 tags that should be used in order: (1) Event, (2) Site, (3) Date, (4) Round, (5) White, (6) Black, (7) Result. These seven combined are called the "seven tag roster". So if you receive a warning message "This game's PGN data does not meet the Seven Tag Roster requirement for mandatory set of tags", you've not correctly set up your tags.
    Another important point about tags is the format in which they should be used. It's always the same. I will describe the process and give an example. Do not use the spacebar or quotation marks unless explicitly indicated.
    After these 7 tags, you can add more as you please; among the other common tags are Annotator, PlyCount, TimeControl, Time, Termination, Mode and FEN. ECO, WhiteElo and BlackElo
    You open with a left bracket [ then you type the tag's name, for example Event followed by a single space, next you use the double quotation mark " and type the value you wish to enter for that tage, for example Some match I've played online, you follow with another double quotation mark " and end with a right bracket ].
    Example based on the values I've used in the text above:
    [Event "Christiansen vs Chessmaster 9K"]
    If it looks simple, that's because it is. It's worth noting that all sorts of chess-related software can be an amazing nitpicker about these things if you mess up the format; if for example you forget brackets, spaces, quotation marks, use the wrong kind of quotation marks (two singles '' instead of one double "). In that light, I recommend sticking strictly to the correct format on all things in a PGN file.
    If you don't know all the specifics about a game, use question marks in your tags.
    [Event "?"]

    --1.1 Event--

    This is going to be the first line of any PGN file. In it, you should put the setting it was played in; the tournament's name, that it was a correspondence game, a friendly game, a consultation game, or whatever other name you wish to describe it with. I've used Event in my example before, but I'll give some others. The first is used by FICS for unrated blitz games for instance:
    [Event "unrated blitz match"]
    [Event "25th olm final"]
    [Event "Corus Chess Tournament"]
    [Event "Correspondence Match"]

    --1.2 Site--
    Site is a bit of a misnomer as it doesn't (always) mean "website" it may stand for the physical "location". If the game is played on a website, you can use the URL, or a description of the server. When played over the board, it's customary to name the city/town/village as well as the country's international code. This is the most important in (historical) master games.
    It works pretty much the same as Event. Let's say the online game I've used as an example before was played on the Internet Chess Club, that would give:
    [Site "ICC"]
    You could swap out "ICC" for "" if you want to, that's pretty much synonymous. Using the previously used examples (FICS blitz game, Korchnoi-Kasparov, game from Corus and correspondence game)we might get the following for the site tag:
    [Site "FICS"]
    [Site "Lucerne SUI"]
    [Site "Wijk aan Zee NED"]
    [Site ""]

    --1.3 Date--
    Date is a simple one. The format is YYYY.MM.DD. The year in four numbers, month and day in two. If the day or month number is lower than 10, you have to "zero-pad" it, eg: 09 for Septembre. Some examples:
    [Date "2012.10.11"]
    [Date "1998.01.29"]
    [Date "1982.10.29"]
    [Date "2007.01.28"]

    [Date "2011.??.??"]

    --1.4 Round--
    The round value is mostly relevant for tournaments, but you can use it for matches with multiple games as well. You just enter a number for whatever round the game was played in, simple enough.
    [Round "3"]
    [Round "7"]
    [Round "10"]
    [Round "13"]
    [Round "28"]

    --1.5 White--
    Another simple value; the name of the white player or (if playing online) his handle/account name.
    [White "Chessmaster 9000"]
    [White "RecentlyRegisteredUser"]
    [White "Kortschnoj, Viktor SUI"]
    [White "Magnus Carlsen"]
    [White "Perseus"]

    --1.6 Black--
    Nearly exactly the same as the "White" value, except for the black player.
    [Black "LarryC"]
    [Black "GuestVXYZ"]
    [Black "Kasparov, Garry URS"]
    [Black "Alexei Shirov"]
    [Black "Celadonite"]

    --1.7 Result--
    This is the last of the "required" tags and slightly less simple than one might think. If white has won, the value is "1-0", if black did it's "0-1", as is common knowledge. If it's a draw then either "1/2-1/2" or "-" will work; 3 characters or just the 1 makes little difference. However, in our PGN viewer, "-" is displayed as "-", whereas "1/2-1/2" becomes "1/2". For this reaon, I prefer "-" myself.
    If the game was not concluded, but is ongoing it is customary to leave "*" as result.
    Some examples:
    [Result "1-0"]
    [Result "1/2-1/2"]
    [Result "0-1"]
    [Result "-"]
    [Result "*"]

    --1.8 WhiteElo--
    The above 7 are needed to complete the 7 tag roster, if you've entered them correctly, you'll not receive a warning on that subject. This value is used to indicate white's rating. It's customary to use FIDE ratings as much as possible or national ratings (when both are of the same country). It works the same for BlackElo.
    Note: the PGN viewer on the forum will use both WhiteElo and BlackElo.
    [WhiteElo "2718"]
    [WhiteElo "1678E"]
    [WhiteElo "2535"]
    [WhiteElo "2690"]
    [WhiteElo "1964"]

    --1.9 ECO--

    You can include an ECO code of the opening used, like the ratings, this isn't necessary to avoid warnings, but when you fill it out, it will be used in the PGN viewer. You can find a table of codes here: List of chess openings - Wikipedia, the free encyclopedia
    [ECO "A28"]
    [ECO "C55"]
    [ECO "A64"]
    [ECO "C90"]
    [ECO "D74"]

    --1.10 TimeControl--

    For game analysis, the time controls are reasonably important and I would recommend they be included in PGNs when possible. The time controls are expressed in seconds in general. There are different rules for increments and games with added time after a certain number of moves. Let's say the ICC game was 2 hours without increment; that makes 2 x 60 (minutes) x 60 (seconds) = 7200 seconds.
    [TimeControl "7200"]
    The actual time control in that game had a 2 minute increment per move however.
    Time controls with increments and a certain number of moves in a certain ammount of time are tagged differently. The FICS game was 5 minutes with 3 seconds increment per move. Incremental is written with a plus sign between time and increment.
    [TimeControl "300+3"]
    The Kasparov game had a complicated 40 moves in 2 hours 30 minutes, then 1 hour for each next 16 moves. To keep it simple, I will use just the 40 moves in 2 hours. Moves per time are written with a forward slash /. The Carlsen game I'll give as the same time control.
    [TimeControl "40/9000"]
    [TimeControl "40/9000"]

    Now, for the correspondence game example, no time control was set. If there is no time control, use the "-" to indicate thus.
    [TimeControl "-"]
    Again, this one's not necessary to avoid the seven tag warning, but it will be displayed when added.

    //2. Movelist//
    Tags are well and good, but moves are where chess is at. Making a movelist is exceedingly simple, but there are a few pitfalls to beware.

    Start with a number, then place a dot "." then a single space, then white's move in algebraic notation, then a space, then black's move. After this, you follow with a space, number-dot-space-white's move-space-black's move etcetera. You can leave out the space after the dot if you wish; I prefer this myself.
    This will work:
    1. e4 e5 2. Nf3 Nc6 3. Bc4 Nf6 4. O-O Nxe4 5. d4 d5 6. Bb5
    But so will this:
    1.e4 e5 2.Nf3 Nc6 3.Bb5 a6 4.Ba4 Nf6 5.0-0 Be7 6.Re1 b5 7.Bb3

    --2.1 Game's end--
    Every game that has a beginning has an end. White wins "1-0", black wins "0-1", it's a draw "1/2-1/2" (don't use - in the movelist), the game is ongoing "*"(compare 1.7). Some examples:
    59.Ra6+ Kf7 60.Rc6 1/2-1/2
    71.Rh1 Ng6 72.Rh7 1-0[/code]18. Kg2 Qg4+ 19. Kf1 Qh3# 0-1
    4.Ba4 Nf6 *

    --2.2 Annotation: Symbols--
    You can use six different combinations of the question and explanation marks ?? (blunder), ? (mistake), ?! (dubious), !? (interesting), ! (good), !! (brilliant) to note a move's quality. The seventh is the one you should use the most; that is none at all. There are different uses and explanations for these as there is no iron law for them. For some additional information, look at the wikipedia article: Chess annotation symbols - Wikipedia, the free encyclopedia.
    Just stick them in right after the move
    1.a4?! e5 2.h4? d5 3.h5? Nf6

    --2.3 Annotation: Positional evaluation--
    There are seven evaluation symbols that are used mostly; = (even position/even chances), +/= (white has a slight edge), =/+ (black has a slight edge), +/- or (white has the advantage), -/+ (black has the advantage), +- (white is winning) and -+ (black is winning).
    One cute example:
    1.e4 +/= 1... c5 +/- 2.Nf3 +-
    Note: the PGN viewer on the forum will ignore these at best. I would recommend against using these.

    --2.4 Commentary--
    The best part of a PGN is usually the commentary. What was the player thinking? What were the plans? Commentary is easy to do; after any given move, put in a single space then a curly bracket "{" followed by the commentary to be attached to the move, then the other curly bracket "}" and another space to separate it from the next move. You can add commentary to every move, but that's usually not necessary. Example:
    1.e4 e5 2.f4 exf4 {This is the King's Gambit Accepted. It's a rather double-edged opening where both sides take a big risk trying to obtain an advantage. If black gets greedy, he may suffer for it.} 3.Nf3 g5 {This is start of the main line.}
    If you add commentary to white's moves, you should add a number to the first black move after your commentary. There are two standard ways to do it; } followed by a space, then the move number followed by 3 dots and a space, then black's move. Or: } followed by a space, then the move's number followed by a dot, a space and 3 dots. For example:
    1.e4 e5 2.f4 {This is the King's Gambit} 2... exf4
    1. e4 e5 2. f4 {This is the King's Gambit} 2. ... exf4

    It doesn't really matter how long the commentary is, as long as you keep it between the brackets, it should work.

    --2.5 Variations--
    We all have post-mortem insights where we see what we should have played. That's what variations are for generally. Variations are branches off the main line. They work just like commentary, with a slight twist. You open with a left parenthesis "(" put in the variation and end with a right parenthesis ")". Always place the original move before the (variation's move).
    1.e4 c5 2.Nf3 (2.c3 d5 3.exd5) 2... d6 3.d4 cxd4 4.Qxd4 (4.Nxd4 e6) 4... Nc6
    The added twist being that you can nest your variations one in another like a russian matryoshka doll.
    1. e4 e5 2. f4 (2. Nf3 Nc6 (2... Nf6 3. Nxe5) 3. Bb5) 2... exf4 3. Nf3 g5
    Or one next to the other:
    1.e4 c6 2.d4 d5 3.Nc3 (3.f3 e6) (3.Nd2 dxe4) (3.e5 Bf5) 3... dxe4
    Or a combination of those methods, so long as you remember to "open" and "close" the parenthesis, you'll be fine.

    //3.I love it when a PGN comes together//
    This is a redundant step, but a good indication of what that which you have so far should look like:

    [Event "Christiansen vs Chessmaster 9K"]
    [Site "ICC"]
    [Date "2012.10.11"]
    [Round "1"]
    [White "Chessmaster 9000"]
    [Black "LarryC"]
    [Result "1-0"]
    [WhiteElo "2718"]
    [BlackElo "2575"]
    [ECO "A28"]
    [TimeControl "7200+120"]

    1.c4 {This move, known as The English Opening came as a pleasant surprise to me. I play this opening myself and understand its subtleties and strategies.} 1... e5 2.Nc3 Nf6 3.Nf3 Nc6 4.d4 exd4 5.Nxd4 Bb4 6.Bg5 h6 7.Bh4 Bxc3+ {We are still in theory at this stage of the game. My plan is to settle 9K with weak isolated, doubled c-pawns. 9k's plan should be to utilize his bishop pair and space advantage to put pressure on my position. With correct play by both sides, I think the game should be about equal.} 8.bxc3 Ne5 9.e3? (9 f4! 9... Ng6! (9... Nxc4? 10 e4!) 10 Bxf6! Qxf6 11 g3!) 9... d6 10.Be2 Ng6 11.Bxf6 Qxf6 12.0-0 0-0 13.Qc2 Re8 14.Rfd1 Nf8 15.Bd3 Ne6 16.Nb3 Rb8 17.a4 Qe7 18.a5 Bd7 19.a6 b6 20.Nd4 Nc5 21.Nb5 Bxb5 22.cxb5 Qf6 23.Bc4 Re5 24.Bd5 Rbe8 25.Rd4 Ne6 26.Rd2 g6 27.Ra4 Kg7 28.Rd1 Re7 29.Rb4 g5 30.Bc6 Qg6 31.Qb2 f5 32.Qb1 Qf6 33.Bd5 f4 34.e4 Nf8 35.f3 h5 36.Qc2 Ng6 37.Qa2 Kh6 38.Qd2 Rg7 39.Qd4 g4 40.fxg4 Nh4 41.Rb2 Rxg4 42.Kh1 Ng6 43.Rf2 Qe7 44.Qd2 Reg5 45.Ra1 h4 46.c4 Qe5 47.Rc1 Kg7 48.Bc6 Qe7 49.Rcf1 Re5 50.Qc3 Kh6 51.Bd5 Reg5 52.Qb3 Qe5 53.Rd1 Rg3 54.hxg3 hxg3 55.Ra2 Rg4 56.Kg1 Qh5 57.Kf1 f3 58.Ke1 f2+ 59.Kd2 Rh4 60.Qe3+ Kg7 61.Rf1 Qe5 62.Kc2 Rh2 63.Qf3 Qf4 64.e5 Qxf3 65.Bxf3 Nxe5 66.Bd5 Rh5 67.Ra3 Rg5 68.Kd2 Ng6 69.Re3 Ne5 70.Ke2 Kf6 71.Rh1 Ng6 72.Rh7 1-0 {Black resigns.}

    Note: I've added the above game as an attachment to this post so you can see what it looks like.

    You wouldn't believe it, but this is where things usually go wrong when creating PGNs in notepad. Notepad, by default, saves any and all files as .TXT files. While PGNs are basically posh TXT files, every chess application will snub at TXT files as being second-class software. So, we will be needing that PGN extension.
    When you're done creating the game (tags, annotation, commentary, moves, variations) you should click "file" (or whatever it is called on your machine) then "save as", then stop for a bit and take a look at your screen. At this point, there should be a "save as" window open. The filename is set to *.txt, the target as "Text document (*.txt) or something to that effect. This means that, if you save your game right now, it'll save as a TXT file, which is next to useless for your purposes. Click on "Text documents (*.txt)" and change it to "All Files". If you've done this correctly, the (*.txt) disappears from filename and "All Files" appears beneath the now-empty filename bar.
    Choose whatever filename suits you, but end with the following: .pgn
    If it's in the location you want to save it to, hit "Save".

    If all went as planned; you should be done

    Sometimes, you'll want to place several games into a PGN. Notepad can be used for that purpose as well. After the last line of your game, leave one line clear, then start the next game's tags.

    Well, that's about it. I hope this helps
    Attached Files
    Last edited by Perseus; 10-15-2012, 05:05 AM.
    Have you read the Forum rules?

    Queeg: Pawn to King Four. Holly: Horsie to King Bish Three.
    Rimmer: It's called a "knight," actually, Holly...
    Queeg: Knight to King Bishop three. Holly: Queen to Rook Eight. Checkmate.
    Queeg: That's an illegal move. Holly: Oh, sorry. Queens don't move like that. I was thinking of poker.
    Holly: Cleudo? You could be Colonel Mustard.
    Cat: If it's any help, I've been studying his tactics and there's a pattern emerging: Every time you make a move, he makes one too. *Winks to Holly*
    Holly: *Winks back* Thanks, Cat.
    --Red Dwarf