Class Bishop

java.lang.Object
edu.uky.ai.chess.state.Piece
edu.uky.ai.chess.state.Bishop

public class Bishop extends Piece
Represents the bishop chess piece.
Author:
Stephen G. Ware
  • Field Summary

    Fields inherited from class edu.uky.ai.chess.state.Piece

    file, player, rank
  • Constructor Summary

    Constructors
    Constructor
    Description
    Bishop(Player player, int file, int rank)
    Constructs a new bishop for the given player at the given location.
  • Method Summary

    Modifier and Type
    Method
    Description
    move(int dfile, int drank)
    Returns a new piece object of the same type which has been moved a given number of squares on the board.
     

    Methods inherited from class edu.uky.ai.chess.state.Piece

    equals, hashCode

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • Bishop

      public Bishop(Player player, int file, int rank)
      Constructs a new bishop for the given player at the given location.
      Parameters:
      player - the player who controls the bishop
      file - the piece's file (column) on the board
      rank - the piece's rank (row) on the board
  • Method Details

    • toString

      public String toString()
      Overrides:
      toString in class Object
    • move

      public Bishop move(int dfile, int drank)
      Description copied from class: Piece
      Returns a new piece object of the same type which has been moved a given number of squares on the board.
      Specified by:
      move in class Piece
      Parameters:
      dfile - the number of squares to move horizontally (positive for right, negative for left)
      drank - the number of squares to move vertically (positive to up, negative for down)
      Returns:
      a piece of the same type at the new location