brlandry
Class ColumnToColumnMove

java.lang.Object
  |
  +--Move
        |
        +--brlandry.ColumnToColumnMove

public class ColumnToColumnMove
extends Move

This class represents moves between Columns. It supports moves initiated by mousedrags or by the computer to solve the game.

Author:
Brian Landry (brlandry@wpi.edu)
See Also:
Serialized Form

Field Summary
protected  Column from
           
protected  Card movingCard
           
protected  Column to
           
 
Constructor Summary
ColumnToColumnMove(Column from, Card movingCard, Column to)
           
 
Method Summary
 boolean doMove(Solitaire theGame)
          Moves can execute themselves
protected  boolean kingOverAce(int rank)
          Helper function to determine if a King is being placed on an Ace.
protected  boolean oneLess(int rank)
          Helper function to be used when movingCard is null
 boolean undo(Solitaire theGame)
          Undo
 boolean valid(Solitaire theGame)
          Moves can determine their validity.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

from

protected Column from

to

protected Column to

movingCard

protected Card movingCard
Constructor Detail

ColumnToColumnMove

public ColumnToColumnMove(Column from,
                          Card movingCard,
                          Column to)
Method Detail

valid

public boolean valid(Solitaire theGame)
Moves can determine their validity. Helper functions have been used to improve the readability of the code.

Returns:
whether the move is legal

oneLess

protected boolean oneLess(int rank)
Helper function to be used when movingCard is null


kingOverAce

protected boolean kingOverAce(int rank)
Helper function to determine if a King is being placed on an Ace. Called when movingCard is null.


doMove

public boolean doMove(Solitaire theGame)
Moves can execute themselves

Returns:
boolean whether or not the move was completed

undo

public boolean undo(Solitaire theGame)
Undo