Paul Webster’s Games & Blogs

Piece Representation

·

·

The pieces are defined as an enumeration to add to the clarity of the code.

enum class Pieces { empty, P, N, B, R, Q, K, p, n, b, r, q, k, offboard, enpassant };

They are converted to integers by casting, for instance:

int a = static_cast<int>(Pieces::Q) ;


2 responses to “Piece Representation”
  1. […] Piece Representation […]

  2. […] give each piece, as listed in the Pieces Representation, a value. The precise values used are irrelevant, they merely indicate that one piece is more […]

Leave a Reply

Your email address will not be published. Required fields are marked *