diff -r d781b00f3ed4 -r 428a194e3e59 Source/Game.h --- a/Source/Game.h Tue Mar 11 17:09:50 2008 -0700 +++ b/Source/Game.h Sun Mar 16 15:06:47 2008 -0700 @@ -20,7 +20,7 @@ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -@class GGBLayer, Bit, Player; +@class GGBLayer, Bit, BitHolder, Player; @protocol BitHolder; @@ -30,6 +30,9 @@ GGBLayer *_board; NSArray *_players; Player *_currentPlayer, *_winner; + NSMutableString *_currentMove; + NSMutableArray *_states, *_moves; + unsigned _currentTurn; } /** Returns the human-readable name of this game. @@ -41,6 +44,13 @@ @property (readonly, copy) NSArray *players; @property (readonly) Player *currentPlayer, *winner; +@property (readonly) NSArray *states, *moves; +@property (readonly) unsigned maxTurn; +@property unsigned currentTurn; +@property (readonly) BOOL isLatestTurn; + +- (BOOL) animateMoveFrom: (BitHolder*)src to: (BitHolder*)dst; + // Methods for subclasses to implement: @@ -48,6 +58,7 @@ it should add the necessary Grids, Pieces, Cards, Decks etc. to the board. */ - (id) initWithBoard: (GGBLayer*)board; + /** Should return YES if it is legal for the given bit to be moved from its current holder. Default implementation always returns YES. */ - (BOOL) canBit: (Bit*)bit moveFrom: (id)src; @@ -56,6 +67,7 @@ Default implementation always returns YES. */ - (BOOL) canBit: (Bit*)bit moveFrom: (id)src to: (id)dst; + /** Should handle any side effects of a Bit's movement, such as captures or scoring. Does not need to do the actual movement! That's already happened. It should end by calling -endTurn, if the player's turn is over. @@ -76,11 +88,18 @@ - (Player*) checkForWinner; +@property (copy) NSString* stateString; +- (BOOL) applyMoveString: (NSString*)move; + + // Protected methods for subclasses to call: /** Sets the number of players in the game. Subclass initializers should call this. */ - (void) setNumberOfPlayers: (unsigned)n; +/** The current move in progress. Append text to it as the user makes moves. */ +@property (readonly) NSMutableString* currentMove; + /** Advance to the next player, when a turn is over. */ - (void) nextPlayer;