06-chess/assignment/chess.h
2024-10-28 18:41:32 +01:00

57 lines
No EOL
1.1 KiB
C

/*----------------------------------------------------------
* HTBLA-Leonding
* ----------------------------------------------------------
* Description:
* Basic chess functions.
* ----------------------------------------------------------
*/
#ifndef ___CHESS_H
#define ___CHESS_H
#include <stdio.h>
#include <stdbool.h>
#include "chess_printer.h"
#define CHESSBOARD_LENGTH 8
typedef struct ChessSquare ChessBoard[CHESSBOARD_LENGTH][CHESSBOARD_LENGTH];
typedef enum {
Pawn,
Knight,
Bishop,
Rook,
Queen,
King,
NoPiece
} PieceType;
typedef enum {
White,
Black,
NO_COLOR
} Color;
typedef enum {
NormalMove,
CaptureMove
} MoveType;
struct ChessPiece {
PieceType type;
Color color;
};
struct ChessSquare {
bool is_occupied;
struct ChessPiece piece;
};
typedef char File;
typedef int Rank;
struct ChessPiece get_piece(ChessBoard chess_board, File file, Rank rank);
bool squares_share_pawns_move(Color color, MoveType move, File filePiece1, Rank rankPiece1, File filePiece2, Rank rankPiece2);
#endif