rules
Class Knight

java.lang.Object
  extended by core.Piece
      extended by rules.Knight

public class Knight
extends Piece

Knight piece.


Field Summary
 
Fields inherited from class core.Piece
color
 
Constructor Summary
Knight(Color color, int lastMove)
           
 
Method Summary
protected  String getName()
           
 int hashCode()
          This should be unique for different pieces or different colors.
 Collection<Move> moveCandidates(GameState g, Position here)
           
 String pieceString()
           
static boolean threatens(GameState g, Color c, Position pos)
           
 
Methods inherited from class core.Piece
getColor, getLastMove, postMove, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Knight

public Knight(Color color,
              int lastMove)
Method Detail

getName

protected String getName()
Specified by:
getName in class Piece

pieceString

public String pieceString()
Specified by:
pieceString in class Piece

moveCandidates

public Collection<Move> moveCandidates(GameState g,
                                       Position here)
Specified by:
moveCandidates in class Piece
See Also:
Piece

threatens

public static boolean threatens(GameState g,
                                Color c,
                                Position pos)
Requires:
g, from, to != null
Returns:
whether any piece of this type and a color threatens a given position pos.

hashCode

public int hashCode()
Description copied from class: Piece
This should be unique for different pieces or different colors.

Specified by:
hashCode in class Piece