Source/Grid.h
changeset 13 db7bb080c3d5
parent 11 436cbdf56810
child 15 73f8c889f053
     1.1 --- a/Source/Grid.h	Sat Jul 05 17:46:43 2008 -0700
     1.2 +++ b/Source/Grid.h	Tue Jul 08 13:12:01 2008 -0700
     1.3 @@ -73,6 +73,21 @@
     1.4  
     1.5  - (GridCell*) cellWithName: (NSString*)identifier;
     1.6  
     1.7 +/** Returns all of the Players who have any Bits on the grid, with each Player's count being the
     1.8 +    number of Bits. */
     1.9 +- (NSCountedSet*) countPiecesByPlayer;
    1.10 +
    1.11 +
    1.12 +/** Utility to get and set the entire state of the Grid. The stateString is made by concatenating
    1.13 +    the name of the Bit of every GridCell in order, with "-" for empty cells.
    1.14 +    The setter method calls the Game's optional -makePieceNamed: method to create the pieces. */
    1.15 +@property (copy) NSString *stateString;
    1.16 +
    1.17 +/** Interprets the string as a series of cell names separated by "-", and tells the Game to move
    1.18 +    the piece at the first cell to each cell in succession by calling its -animateMoveFrom:to:. */
    1.19 +- (BOOL) applyMoveString: (NSString*)move;
    1.20 +
    1.21 +
    1.22  // protected:
    1.23  - (GridCell*) createCellAtRow: (unsigned)row column: (unsigned)col 
    1.24                 suggestedFrame: (CGRect)frame;
    1.25 @@ -98,7 +113,7 @@
    1.26  /** Returns YES if 'forward' is north (increasing row#) for the current player */
    1.27  @property (readonly) BOOL fwdIsN;
    1.28  
    1.29 -/* Go-style group detection. Returns the set of contiguous GridCells that have pieces of the same
    1.30 +/** Go-style group detection. Returns the set of contiguous GridCells that have pieces of the same
    1.31     owner as this one, and optionally a count of the number of "liberties", or adjacent empty cells. */
    1.32  - (NSSet*) getGroup: (int*)outLiberties;
    1.33  
    1.34 @@ -128,6 +143,17 @@
    1.35  @property (readonly) Square *nw, *n, *ne, *e, *se, *s, *sw, *w;    // Absolute directions (n = increasing row#)
    1.36  @property (readonly) Square *fl, *f, *fr, *r, *br, *b, *bl, *l;    // Relative to player (upside-down for player 2)
    1.37  
    1.38 +/** Returns the absolute direction selector (see above) for the straight line from self to dst;
    1.39 +    or NULL if there is no straight line, or if dst==self.
    1.40 +    Diagonal lines are allowed only if the Grid's -usesDiagonals is YES. */
    1.41 +- (SEL) directionToCell: (GridCell*)dst;
    1.42 +
    1.43 +/** Returns an array of all the cells in a straight line from self to dst;
    1.44 +    or NULL if there is no straight line, or if dst==self.
    1.45 +    If 'inclusive' is YES, the array will include self and dst, otherwise not.
    1.46 +    Diagonal lines are allowed only if the Grid's -usesDiagonals is YES. */
    1.47 +- (NSArray*) lineToCell: (GridCell*)dst inclusive: (BOOL)inclusive;
    1.48 +
    1.49  @end
    1.50  
    1.51