All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.fathzer.chess.utils.Pieces Maven / Gradle / Ivy

The newest version!
package com.fathzer.chess.utils;

/** Pieces related data
 * 
In this library, types of pieces are identified by positive integers:
    *
  • Pawn: 1
  • *
  • Knight: 2
  • *
  • Bishop: 3
  • *
  • Rook: 4
  • *
  • Queen: 5
  • *
  • King: 6
  • *
  • 0 is reserved for empty cells
  • *
* Pieces (with their color) are identified by a signed integer. Its absolute value * is the piece's type identifier. White pieces have a positive id, black ones have * a negative one. */ public final class Pieces { /** The standard number of points associated to pieces (or empty cell). *
The piece types order is empty, pawn, knight, bishop, rook, queen, king */ private static final int[] VALUES = new int[] {0,1,3,3,5,9,10}; /** Pawn */ public static final int PAWN = 1; /** Knight */ public static final int KNIGHT = 2; /** Bishop */ public static final int BISHOP = 3; /** Rook */ public static final int ROOK = 4; /** Queen */ public static final int QUEEN = 5; /** King */ public static final int KING = 6; private Pieces() { // Prevents subclasses } /** Gets the standard number of points of a piece (or empty cell). * @param type The piece type * @return the number of points */ public static int getPoints(int type) { return VALUES[type]; } }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy