Created
September 5, 2011 10:49
-
-
Save mulbc/1194684 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/// pgnString returns an NSString representing the entire game as PGN. | |
- (NSString *)pgnString { | |
NSMutableString *string = [NSMutableString stringWithCapacity: 2000]; | |
[string appendFormat: @"[Event \"%@\"]\n", event]; | |
[string appendFormat: @"[Site \"%@\"]\n", site]; | |
[string appendFormat: @"[Date \"%@\"]\n", date]; | |
[string appendFormat: @"[Round \"%@\"]\n", round]; | |
[string appendFormat: @"[White \"%@\"]\n", whitePlayer]; | |
[string appendFormat: @"[Black \"%@\"]\n", blackPlayer]; | |
[string appendFormat: @"[Result \"%@\"]\n", result]; | |
if (![startFEN isEqualToString: @"rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1"]) | |
[string appendFormat: @"[FEN \"%@\"]\n", startFEN]; | |
[string appendString: @"\n"]; | |
[string appendString: [self pgnMoveListString]]; | |
[string appendFormat: @"\n%@\n\n", [self result]]; | |
return string; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment