Squeak Class Documentation category index | class index  
 
SameGameBoard
  category: Morphic-Games
  superclass: AlignmentMorph
  subclasses:

I am an MxN array of SameGameTiles, and implement most of the logic to play the SameGame, including adjacent tile selection and removal.

instance methods
  accessing
  actionSelector
actionSelector:
columns
columns:
columns:rows:
protoTile
protoTile:
rows
rows:
selectionCount
target
target:
tileAt:

  actions
  collapseColumn:fromRow:
collapseColumns:
deselectSelection
findSelection
hint
removeColumn:
removeSelection
selectTilesAdjacentTo:
tileClickedAt:newSelection:

  dropping/grabbing
  acceptDroppingMorph:event:

  geometry
  extent:

  initialization
  initialize
resetBoard

  preferences
  preferredColumns
preferredRows
preferredTileTypes

  private
  adjustTiles
capturedState
tilesRemaining
undoFromCapturedState:

  stepping
  step
stepTime

class methods
  as yet unclassified
  includeInNewMorphMenu

instance methods
  accessing top  
 

actionSelector


 

actionSelector:


 

columns


 

columns:


 

columns:rows:


 

protoTile


 

protoTile:


 

rows


 

rows:


 

selectionCount


 

target


 

target:


 

tileAt:


  actions top  
 

collapseColumn:fromRow:


 

collapseColumns:


 

deselectSelection


 

findSelection

find a possible selection and return it, or nil if no selection


 

hint

find a possible selection and select it


 

removeColumn:


 

removeSelection


 

selectTilesAdjacentTo:


 

tileClickedAt:newSelection:


  dropping/grabbing top  
 

acceptDroppingMorph:event:

Allow the user to set the protoTile just by dropping it on this morph.


  geometry top  
 

extent:

constrain the extent to be a multiple of the protoTile size during resizing


  initialization top  
 

initialize


 

resetBoard


  preferences top  
 

preferredColumns


 

preferredRows


 

preferredTileTypes


  private top  
 

adjustTiles

add or remove new protoTile submorphs to fill out my new bounds


 

capturedState

Note the state stored in the second element is an array of associations
from submorph index to a shallowCopy of the morph, but only for those
morphs that change. Therefore the capturedState record *first* delivers
all the morphs, and *then* computes the difference and stores this back.
In the end, both undo and redo records follow this format.


 

tilesRemaining


 

undoFromCapturedState:

May be overridden in subclasses. See also capturedState


  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
  as yet unclassified top  
 

includeInNewMorphMenu

Return true for all classes that can be instantiated from the menu