1.1 --- a/Source/Game.h Tue Mar 11 17:09:50 2008 -0700
1.2 +++ b/Source/Game.h Sun Mar 16 15:06:47 2008 -0700
1.3 @@ -20,7 +20,7 @@
1.4 CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
1.5 THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
1.6 */
1.7 -@class GGBLayer, Bit, Player;
1.8 +@class GGBLayer, Bit, BitHolder, Player;
1.9 @protocol BitHolder;
1.10
1.11
1.12 @@ -30,6 +30,9 @@
1.13 GGBLayer *_board;
1.14 NSArray *_players;
1.15 Player *_currentPlayer, *_winner;
1.16 + NSMutableString *_currentMove;
1.17 + NSMutableArray *_states, *_moves;
1.18 + unsigned _currentTurn;
1.19 }
1.20
1.21 /** Returns the human-readable name of this game.
1.22 @@ -41,6 +44,13 @@
1.23 @property (readonly, copy) NSArray *players;
1.24 @property (readonly) Player *currentPlayer, *winner;
1.25
1.26 +@property (readonly) NSArray *states, *moves;
1.27 +@property (readonly) unsigned maxTurn;
1.28 +@property unsigned currentTurn;
1.29 +@property (readonly) BOOL isLatestTurn;
1.30 +
1.31 +- (BOOL) animateMoveFrom: (BitHolder*)src to: (BitHolder*)dst;
1.32 +
1.33
1.34 // Methods for subclasses to implement:
1.35
1.36 @@ -48,6 +58,7 @@
1.37 it should add the necessary Grids, Pieces, Cards, Decks etc. to the board. */
1.38 - (id) initWithBoard: (GGBLayer*)board;
1.39
1.40 +
1.41 /** Should return YES if it is legal for the given bit to be moved from its current holder.
1.42 Default implementation always returns YES. */
1.43 - (BOOL) canBit: (Bit*)bit moveFrom: (id<BitHolder>)src;
1.44 @@ -56,6 +67,7 @@
1.45 Default implementation always returns YES. */
1.46 - (BOOL) canBit: (Bit*)bit moveFrom: (id<BitHolder>)src to: (id<BitHolder>)dst;
1.47
1.48 +
1.49 /** Should handle any side effects of a Bit's movement, such as captures or scoring.
1.50 Does not need to do the actual movement! That's already happened.
1.51 It should end by calling -endTurn, if the player's turn is over.
1.52 @@ -76,11 +88,18 @@
1.53 - (Player*) checkForWinner;
1.54
1.55
1.56 +@property (copy) NSString* stateString;
1.57 +- (BOOL) applyMoveString: (NSString*)move;
1.58 +
1.59 +
1.60 // Protected methods for subclasses to call:
1.61
1.62 /** Sets the number of players in the game. Subclass initializers should call this. */
1.63 - (void) setNumberOfPlayers: (unsigned)n;
1.64
1.65 +/** The current move in progress. Append text to it as the user makes moves. */
1.66 +@property (readonly) NSMutableString* currentMove;
1.67 +
1.68 /** Advance to the next player, when a turn is over. */
1.69 - (void) nextPlayer;
1.70