Squeak Class Documentation category index | class index  
 
ChessMoveGenerator
  category: Morphic-Games-Chess
  superclass: Object
  subclasses:

This class generates moves for any given board. It's speed is critical - for each new position all moves need to be generated in that position. It may be worthwhile to make give this class a little plugin support at some time.

instance methods
  initialize
  initialize

  moves-general
  moveBishopAt:
moveBlackKingAt:
moveKingAt:
moveKnightAt:
movePawnAt:
movePiece:along:at:
moveQueenAt:
moveRookAt:
moveWhiteKingAt:

  moves-pawns
  blackPawnCaptureAt:direction:
blackPawnPushAt:
moveBlackPawnAt:
moveWhitePawnAt:
promotePawn:
whitePawnCaptureAt:direction:
whitePawnPushAt:

  public
  attackSquares
findAllPossibleMovesFor:
findAttackSquaresFor:
findPossibleMovesFor:
findPossibleMovesFor:at:
findQuiescenceMovesFor:
kingAttack
moveList
profileGenerationFor:
recycleMoveList:

  support
  canCastleBlackKingSide
canCastleBlackQueenSide
canCastleWhiteKingSide
canCastleWhiteQueenSide

class methods
  no messages
 

instance methods
  initialize top  
 

initialize


  moves-general top  
 

moveBishopAt:


 

moveBlackKingAt:


 

moveKingAt:


 

moveKnightAt:


 

movePawnAt:

Pawns only move in one direction so check for which direction to use


 

movePiece:along:at:


 

moveQueenAt:


 

moveRookAt:


 

moveWhiteKingAt:


  moves-pawns top  
 

blackPawnCaptureAt:direction:


 

blackPawnPushAt:

Try to push this pawn


 

moveBlackPawnAt:

Pawns only move in one direction so check for which direction to use


 

moveWhitePawnAt:

Pawns only move in one direction so check for which direction to use


 

promotePawn:

Duplicate the given move and embed all promotion types


 

whitePawnCaptureAt:direction:


 

whitePawnPushAt:

Pawns only move in one direction so check for which direction to use


  public top  
 

attackSquares


 

findAllPossibleMovesFor:

Find all possible moves. This method does not check if the move is legal, e.g., if the king of the player is under attack after the move. If the opponent is check mate (e.g., the king could be taken in the next move) the method returns nil. If the game is stale mate (e.g., the receiver has no move left) this method returns an empty array.


 

findAttackSquaresFor:

Mark all the fields of a board that are attacked by the given player.
The pieces attacking a field are encoded as (1 << Piece) so that we can
record all types of pieces that attack the square.


 

findPossibleMovesFor:

Find all possible moves. This method does not check if the move is legal, e.g., if the king of the player is under attack after the move. If the opponent is check mate (e.g., the king could be taken in the next move) the method returns nil. If the game is stale mate (e.g., the receiver has no move left) this method returns an empty array.


 

findPossibleMovesFor:at:

Find all possible moves at the given square. This method does not check if the move is legal, e.g., if the king of the player is under attack after the move. If the opponent is check mate (e.g., the king could be taken in the next move) the method returns nil. If the game is stale mate (e.g., the receiver has no move left) this method returns an empty array.


 

findQuiescenceMovesFor:

Find all the quiescence moves (that is moves capturing pieces)


 

kingAttack


 

moveList


 

profileGenerationFor:


 

recycleMoveList:


  support top  
 

canCastleBlackKingSide


 

canCastleBlackQueenSide


 

canCastleWhiteKingSide


 

canCastleWhiteQueenSide


class methods
  no messages top