<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">/**
 * The &lt;code&gt;Piece&lt;/code&gt; class manages all static information about
 * the pieces, such as their value, count, images.
 * Instances of piece can be created and used on the board.
 * @author  &lt; your name here &gt;
 * @version 2.0, 01/29/00
 */

class Piece {

  ///////////////////////////////////////////////
  // INSTANCE
  ///////////////////////////////////////////////

 	// YOUR CODE HERE

  ///////////////////////////////////////////////
  // STATIC
  ///////////////////////////////////////////////

	// YOUR CODE HERE

	// BELOW ARE HELPER METHODS TO GET YOU STARTED

  /**
   * Calculates internal array index 
   * Instances are created via the create methods
   * @param char piece code
   */
  protected static int getIndex(char c) {
    if(c&gt;='a' &amp;&amp; c&lt;='z') return c-'a';
    if(c&gt;='A' &amp;&amp; c&lt;='Z') return c-'A';
    throw new IndexOutOfBoundsException("Invalid letter: "+c);
  }

  /**
   * Converts an array of pieces to a string
   */
  public static String toString(Piece[] word) {
    StringBuffer s=new StringBuffer("");
    for(int i=0;i&lt;word.length;i++)
      s.append(word[i].getLetter());
    return s.toString();
  }
}
</pre></body></html>