Squeak Class Documentation category index | class index  
 
ChessMorph
  category: Morphic-Games-Chess
  superclass: BorderedMorph
  subclasses:

This class defines the user interface for a fine game of chess.

instance methods
  drag and drop
  acceptDroppingMorph:event:
dragPiece:from:
dragSquareEnter:from:
dragSquareLeave:from:
wantsDroppedMorph:event:

  events
  showMoves:from:
showMovesAt:

  game callbacks
  addedPiece:at:white:
completedMove:white:
finishedGame:
gameReset
movedPiece:from:to:
removedPiece:at:
replacedPiece:with:at:white:
undoMove:white:
validateGamePosition

  geometry
  areasRemainingToFill:
asSquare:
atSquare:
squaresDo:

  initialize
  addButtonRow
addSquares
buttonFillStyle
buttonName:action:
initialize
newPiece:white:
newSquare

  other stuff
  rotateBoard
statusString

  playing
  autoPlay
findBestMove
movePieceFrom:to:
newGame
redoMove
thinkAndMove
undoMove

  stepping
  step
stepTime

class methods
  accessing
  blackBishopImage
blackKingImage
blackKnightImage
blackPawnImage
blackQueenImage
blackRookImage
whiteBishopImage
whiteKingImage
whiteKnightImage
whitePawnImage
whiteQueenImage
whiteRookImage

  parts bin
  descriptionForPartsBin

instance methods
  drag and drop top  
 

acceptDroppingMorph:event:

This message is sent when a morph is dropped onto a morph that has agreed to accept the dropped morph by responding 'true' to the wantsDroppedMorph:Event: message. This default implementation just adds the given morph to the receiver.


 

dragPiece:from:


 

dragSquareEnter:from:

Note: #wantsDroppedMorph: will validate move


 

dragSquareLeave:from:


 

wantsDroppedMorph:event:

Return true if the receiver wishes to accept the given morph, which is being dropped by a hand in response to the given event. Note that for a successful drop operation both parties need to agree. The symmetric check is done automatically via aMorph wantsToBeDroppedInto: self.


  events top  
 

showMoves:from:


 

showMovesAt:


  game callbacks top  
 

addedPiece:at:white:


 

completedMove:white:


 

finishedGame:


0 - white lost
0.5 - draw
1 - white won


 

gameReset


 

movedPiece:from:to:


 

removedPiece:at:


 

replacedPiece:with:at:white:


 

undoMove:white:


 

validateGamePosition

This method does nothing but validating what you see (on screen) is what you get (from the board).


  geometry top  
 

areasRemainingToFill:

May be overridden by any subclasses with opaque regions


 

asSquare:


 

atSquare:


 

squaresDo:


  initialize top  
 

addButtonRow


 

addSquares


 

buttonFillStyle


 

buttonName:action:


 

initialize


 

newPiece:white:


 

newSquare


  other stuff top  
 

rotateBoard


 

statusString


  playing top  
 

autoPlay


 

findBestMove


 

movePieceFrom:to:


 

newGame


 

redoMove

Redo the last undone move


 

thinkAndMove


 

undoMove

Undo the last move


  stepping top  
 

step

Do some periodic activity. Use startStepping/stopStepping to start and stop getting sent this message. The time between steps is specified by this morph's answer to the stepTime message. The generic version dispatches control to the player, if any. The nasty circumlocation about owner's transformation is necessitated by the flexing problem that the player remains in the properties dictionary both of the flex and the real morph. In the current architecture, only the top renderer's pointer to the player should actually be honored for the purpose of firing.


 

stepTime

Answer the desired time between steps in milliseconds. This default implementation requests that the 'step' method be called once every second.


class methods
  accessing top  
 

blackBishopImage


 

blackKingImage


 

blackKnightImage


 

blackPawnImage


 

blackQueenImage


 

blackRookImage


 

whiteBishopImage


 

whiteKingImage


 

whiteKnightImage


 

whitePawnImage


 

whiteQueenImage


 

whiteRookImage


  parts bin top  
 

descriptionForPartsBin

If the receiver is a member of a class that would like to be represented in a parts bin, answer the name by which it should be known, and a documentation string to be provided, for example, as balloon help. When the 'nativitySelector' is sent to the 'globalReceiver', it is expected that some kind of Morph will result. The parameters used in the implementation below are for documentation purposes only!