This is Player.m in view mode; [Download] [Up]
#import "Player.h"
@implementation Player
// init... nothing special
- initWithRules:(Rules *)r andPieceType:(square_state)type;
{
[self init];
rules = r;
pieceType = type;
if (pieceType == SQUARE_ONE)
opposingPiece = SQUARE_TWO;
else
opposingPiece = SQUARE_ONE;
currentState = PLAYER_STOPPED;
playerName = NULL;
return self;
}
- (char *)playerName
{
return playerName;
}
// nothing... subclasses must implement here
- doNextMove:(Board *)b
{
return self;
}
- (square_state)pieceType
{
return pieceType;
}
- setGame:g
{
game = g;
return self;
}
- gameOver:(Board *)b
{
return self;
}
- setPlayerState:(PlayerState)state
{
currentState = state;
return self;
}
- (PlayerState)playerState
{
return currentState;
}
// used for debugging... probably shouldn't be in this object since its only
// used by the ComputerPlayer class.
//! make this into a protocol PlayerDebugging
- setDebug:(BOOL)state
{
debug = state;
return self;
}
- (int)moveTime
{
return 0;
}
- (int)numLeaves
{
return 0;
}
- (int)pruningPercent
{
return 0;
}
@end
These are the contents of the former NiCE NeXT User Group NeXTSTEP/OpenStep software archive, currently hosted by Netfuture.ch.