Source/DemoBoardView.m
changeset 7 428a194e3e59
parent 1 3eb7be1dd7b6
child 8 45c82a071aca
     1.1 --- a/Source/DemoBoardView.m	Mon Mar 10 17:30:57 2008 -0700
     1.2 +++ b/Source/DemoBoardView.m	Sun Mar 16 15:06:47 2008 -0700
     1.3 @@ -43,7 +43,7 @@
     1.4                                             @"TicTacToeGame", @"GoGame"};
     1.5  
     1.6  /** Class name of the current game. */
     1.7 -static NSString* sCurrentGameName = @"KlondikeGame";
     1.8 +static NSString* sCurrentGameName = @"CheckersGame";
     1.9  
    1.10  
    1.11  - (void) startGameNamed: (NSString*)gameClassName
    1.12 @@ -89,6 +89,8 @@
    1.13                                            alignment: kCALayerWidthSizable | kCALayerMinYMargin];
    1.14      
    1.15      [self startGameNamed: sCurrentGameName];
    1.16 +    
    1.17 +    [_turnSlider bind: @"value"    toObject: self withKeyPath: @"game.currentTurn" options: nil];
    1.18  }
    1.19  
    1.20  
    1.21 @@ -106,6 +108,10 @@
    1.22  {
    1.23      Game *game = self.game;
    1.24      if( object == game ) {
    1.25 +        NSLog(@"maxTurn = %u, currentTurn=%u", self.game.maxTurn,self.game.currentTurn);
    1.26 +        _turnSlider.maxValue = self.game.maxTurn;
    1.27 +        _turnSlider.numberOfTickMarks = self.game.maxTurn+1;
    1.28 +        
    1.29          Player *p = game.winner;
    1.30          NSString *msg;
    1.31          if( p ) {
    1.32 @@ -114,6 +120,7 @@
    1.33          } else {
    1.34              p = game.currentPlayer;
    1.35              msg = @"Your turn, %@";
    1.36 +            NSLog(@"Game state = '%@'", self.game.stateString);
    1.37          }
    1.38          _headline.string = [NSString stringWithFormat: msg, p.name];
    1.39      }