The board is composed of tiles, each of which is a class. The most important parts of each tile are as follows:
1: public class Tile
2: {
3: public File file;
4: public Rank rank;
5: public ChessPiece piece;
6: public Tile[] neighbors;
If a tile does not have a piece on it, the piece variable is null; likewise, if a piece is a border tile, the entry for it's neighbor (of 6 possible) is null - this tells us when a piece is an edge tile.
Pieces are likewise classes, and their most important parts are as follows:
1: public class ChessPiece
2: {
3: public PieceType type;
4: public PieceColor side;
5: public Tile tile;
6: public bool Alive;
7: public bool WasMoved;
8: public bool WasOnStartingTile;
9: public List<Tile> MoveableTiles = new List<Tile>();
10: public List<Tile> AttackableTiles = new List<Tile>();
Movements shall be covered next!
No comments:
Post a Comment