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

The model of a freecell game. Holds the stacks of cards.
cardDeck
lastCardDeck
freeCells
homeCells
stacks array of CardDecks of the columns of cards.
----
Hardness: a number from 1 to 10000.
After dealing, count down the number. For each count, go to next column, pick a ramdom card (with same generator as deck) and move it one place in its stack. This is a kind of bubble sort. Interesting that the slowness of bubble sort is a plus -- gives fine gradation in the hardness.
Moving a card: Move red cards to deep half, black to shallow (or vice versa). Within a color, put low cards deep and high cards shallow.
If speed is an issue, move several steps at once, decrementing counter.

(May make it easier? If running columns, need a way to make harder in other ways.)

instance methods
  accessing
  actionSelector:
cardDeck
hardness
hardness:
target:

  actions
  acceptCard:onStack:
acceptSingleCard:on:
cardMoved
cardMovedHome
doubleClickInStack:OnCard:
dragCard:fromHome:
dragCard:fromStack:
inAutoMove

  as yet unclassified
  drawOn:

  hardness
  addHardness
makeHarder:rand:toDo:

  initialization
  initialize
pickGame:
resetBoard
resetFreeCells
resetHomeCells
resetStacks

  layout
  cardCell
cellsRow
cellsRowSpacer
freeCell
freeCells
homeCell
homeCells
layout
stack
stacks
stacksRow

  private
  autoMoveCardsHome
isPlayableCardInHomeCells:
maxDraggableStackSize:
performActionSelector:
visiblyMove:to:

  undo
  captureStateBeforeGrab
capturedState
rememberUndoableAction:named:
undoFromCapturedState:

class methods
  as yet unclassified
  includeInNewMorphMenu

instance methods
  accessing top  
 

actionSelector:


 

cardDeck


 

hardness


 

hardness:


 

target:


  actions top  
 

acceptCard:onStack:

assumes that number of cards was check at drag time, need to reduce count if dropping
into an empty stack


 

acceptSingleCard:on:

Home cells and free cells don't accept multiple cards on a home cell,
defer to deck for other cases


 

cardMoved

Free cells and stacks do nothing special here - yet - th 12/15/1999
16:15


 

cardMovedHome


 

doubleClickInStack:OnCard:

if there is an empty free cell, move the card there. otherwise try for an empty stack


 

dragCard:fromHome:


 

dragCard:fromStack:


 

inAutoMove

Return true if an automove sequence is in progress


  as yet unclassified top  
 

drawOn:

we don't have anything to draw, but we need a color so the inset border of one of our submorphs will work


  hardness top  
 

addHardness

post process the layout of cards to make it harder. See class comment.


 

makeHarder:rand:toDo:

Move cards in a stack to make it harder. Pick a card from the pile. Only consider moving it deeper (toward last of pile).


  initialization top  
 

initialize


 

pickGame:


 

resetBoard


 

resetFreeCells


 

resetHomeCells


 

resetStacks


  layout top  
 

cardCell


 

cellsRow


 

cellsRowSpacer


 

freeCell


 

freeCells


 

homeCell


 

homeCells


 

layout


 

stack

Answer the nearest containing Stack, or, if none, a stack in the current project, and if still none, nil. The extra messiness is because uninstalled backgrounds don't have an owner pointers to their stack.


 

stacks


 

stacksRow


  private top  
 

autoMoveCardsHome


 

isPlayableCardInHomeCells:

are all cards that could be played on this card if it stayed on the stack present in the
home cells?


 

maxDraggableStackSize:

Note: dropIntoEmptyStack, means one less empty stack to work with.
This needs to be reevaluated at time of drop.


 

performActionSelector:


 

visiblyMove:to:


  undo top  
 

captureStateBeforeGrab


 

capturedState

May be overridden in subclasses.


 

rememberUndoableAction:named:


 

undoFromCapturedState:

May be overridden in subclasses. See also capturedState


class methods
  as yet unclassified top  
 

includeInNewMorphMenu

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