diff -r 428a194e3e59 -r a59acc683080 Source/Game.h --- a/Source/Game.h Sun Mar 16 15:06:47 2008 -0700 +++ b/Source/Game.h Thu May 29 15:04:06 2008 -0700 @@ -27,6 +27,7 @@ /** Abstract superclass. Keeps track of the rules and turns of a game. */ @interface Game : NSObject { + NSString *_uniqueID; GGBLayer *_board; NSArray *_players; Player *_currentPlayer, *_winner; @@ -35,6 +36,10 @@ unsigned _currentTurn; } +/** Returns the name used to identify this game in URLs. + (By default it just returns the class name with the "Game" suffix removed.) */ ++ (NSString*) identifier; + /** Returns the human-readable name of this game. (By default it just returns the class name with the "Game" suffix removed.) */ + (NSString*) displayName; @@ -49,9 +54,17 @@ @property unsigned currentTurn; @property (readonly) BOOL isLatestTurn; + +/** A globally-unique string assigned to this game instance, to help networked players identify it. */ +@property (readonly) NSString* uniqueID; + - (BOOL) animateMoveFrom: (BitHolder*)src to: (BitHolder*)dst; +- (id) initWithUniqueID: (NSString*)uniqueID; +- (id) init; + + // Methods for subclasses to implement: /** Designated initializer. After calling the superclass implementation, @@ -87,8 +100,11 @@ Default implementation returns nil. */ - (Player*) checkForWinner; +/** A string describing the current state of the game (the positions of all pieces, + orderings of cards, player scores, ... */ +@property (copy) NSString* stateString; -@property (copy) NSString* stateString; +/** Add a move to the game based on the contents of the string. */ - (BOOL) applyMoveString: (NSString*)move; @@ -111,7 +127,7 @@ /** A mostly-passive object used to represent a player. */ -@interface Player : NSObject +@interface Player : NSObject { Game *_game; NSString *_name;