Source/HexchequerGame.m
changeset 20 7c9ecb09a612
parent 16 28392c9a969f
child 22 4cb50131788f
     1.1 --- a/Source/HexchequerGame.m	Mon Jul 14 21:00:15 2008 -0700
     1.2 +++ b/Source/HexchequerGame.m	Fri Jul 18 13:26:59 2008 -0700
     1.3 @@ -127,5 +127,17 @@
     1.4      [self endTurn];
     1.5  }
     1.6  
     1.7 +- (BOOL) canOpponentMoveFrom: (GridCell*)src
     1.8 +{
     1.9 +    if( ! src.bit.unfriendly )
    1.10 +        return NO;
    1.11 +    if( [super canOpponentMoveFrom: src] )
    1.12 +        return YES;
    1.13 +    Hex *hex = (Hex*)src;
    1.14 +    if( hex.bit.tag )           // remember, it's opponent's piece, so directions are reversed
    1.15 +        if( hex.r.empty || (hex.r.bit.friendly && hex.r.r.empty) )
    1.16 +            return YES;
    1.17 +    return hex.l.empty || (hex.l.bit.friendly && hex.l.l.empty);
    1.18 +}
    1.19  
    1.20  @end