Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion driver_docs/LICENSE.driver.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
# Purpose
The provided content is a software license known as the MIT License, which is a permissive free software license. It grants users broad rights to use, copy, modify, merge, publish, distribute, sublicense, and sell copies of the software, as long as the original copyright notice and permission notice are included in all copies or substantial portions of the software. The license also disclaims any warranties, stating that the software is provided "as is" without any guarantees of merchantability, fitness for a particular purpose, or non-infringement. This license is designed to maximize freedom for developers and users while limiting liability for the authors.
The provided content is a software license known as the MIT License, which is a permissive free software license. It grants users broad rights to use, copy, modify, merge, publish, distribute, sublicense, and sell copies of the software, as long as the original copyright notice and permission notice are included in all copies or substantial portions of the software. This license is designed to maximize freedom for users while limiting liability for the authors, as it explicitly states that the software is provided "as is," without any warranties, and disclaims any liability for damages arising from its use. The inclusion of this license in a software project facilitates open-source collaboration and distribution by clearly defining the terms under which the software can be used and shared.
2 changes: 1 addition & 1 deletion driver_docs/Makefile.driver.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
# Purpose
This Makefile is designed for building a Chess implementation written in C. It specifies the use of the GNU Compiler Collection (GCC) with the `-Wall` flag to enable all compiler warnings. The file includes conditional logic to add debugging information based on the `DEBUG` variable, allowing for either debug or release builds. It defines source and object files, and handles platform independence by setting executable and library paths differently for Windows and other operating systems. The Makefile includes targets for building the chess library (`chesslib`), running tests (`tests`), and cleaning up build artifacts (`clean`). It also ensures the creation of a `bin` directory for storing compiled binaries and libraries.
This Makefile is designed for building a Chess implementation written in C, facilitating the compilation and linking process using the GNU Compiler Collection (GCC). It defines several variables, such as `CC` for the compiler and `CFLAGS` for compiler flags, which include warnings and optional debugging information based on the `DEBUG` flag. The file uses pattern rules to compile source files located in the `src` and `src/chesslib` directories into object files, and it creates a static library `libchesslib.a` from these object files, excluding the test main object. It also specifies platform-independent rules for generating the test executable, `tests`, and includes targets for cleaning up build artifacts and running tests. The Makefile ensures that the necessary directories are created and that the build process is streamlined for both development and testing purposes.
2 changes: 1 addition & 1 deletion driver_docs/README.md.driver.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
# Purpose
The provided content is a markdown file that serves as documentation for a C-based chess library called "chesslib." It outlines the build instructions for compiling the library, detailing the use of a makefile compatible with Linux and Windows (via MSYS2), and provides specific steps for setting up the build environment on Windows. Additionally, the document includes a sample C program that demonstrates how to use the library to simulate a random chess game, showcasing the library's functionality by printing moves in UCI format and the final board position in FEN format. The file also outlines future development plans for the library, such as adding support for SAN and PGN formats, improving documentation, and enhancing the API.
The provided content is a markdown file that serves as documentation for a C-based chess library named "chesslib." It outlines the build process for the library, detailing how to compile the source files using a C compiler and providing specific instructions for building on Windows using MSYS2. The document includes a sample C program that demonstrates how to use the library to simulate a random chess game, showcasing the library's functionality by printing UCI moves and the final FEN position. Additionally, the file outlines future development plans for the library, such as adding support for SAN and PGN formats, improving documentation, and enhancing the API. This documentation is essential for developers who wish to understand, build, and extend the chess library.
36 changes: 18 additions & 18 deletions driver_docs/cpp_src.driver.md
Original file line number Diff line number Diff line change
@@ -1,27 +1,27 @@

## Files
- **[bishop.cpp](cpp_src/bishop.cpp.driver.md)**: The `bishop.cpp` file implements the Bishop class for a chess game, defining its movement rules, value, and display representation.
- **[bishop.h](cpp_src/bishop.h.driver.md)**: The `bishop.h` file defines a class representing a chess bishop piece, including methods for creating a bishop, determining its value, checking legal moves, and displaying the piece.
- **[board.cpp](cpp_src/board.cpp.driver.md)**: The `board.cpp` file implements a chess board for the ChessProject, including methods to check if paths are clear for vertical, horizontal, and diagonal movements, as well as displaying the board state.
- **[board.h](cpp_src/board.h.driver.md)**: The `board.h` file defines a `Board` class representing an 8x8 game board, including methods for accessing squares, checking clear paths, and displaying the board.
- **[game.cpp](cpp_src/game.cpp.driver.md)**: The `game.cpp` file in the `c_cpp_export_test` codebase implements the setup and management of a chess game, including initializing pieces and players, and determining the next player to move.
- **[bishop.cpp](cpp_src/bishop.cpp.driver.md)**: The `bishop.cpp` file implements the Bishop class for a chess game, defining its movement, value, and display characteristics.
- **[bishop.h](cpp_src/bishop.h.driver.md)**: The `bishop.h` file defines a class representing a chess bishop piece, including methods for determining its value, legal moves, and displaying the piece.
- **[board.cpp](cpp_src/board.cpp.driver.md)**: The `board.cpp` file implements a chess board for the ChessProject, including methods for board setup, checking clear paths for moves, and displaying the board state.
- **[board.h](cpp_src/board.h.driver.md)**: The `board.h` file defines a `Board` class representing an 8x8 game board, including methods for accessing squares, checking clear paths, determining end rows, and displaying the board.
- **[game.cpp](cpp_src/game.cpp.driver.md)**: The `game.cpp` file in the `c_cpp_export_test` codebase implements the initialization and management of a chess game, including setting up the board with pieces and handling player turns.
- **[game.h](cpp_src/game.h.driver.md)**: The `game.h` file defines a class for representing a game of chess, including methods for initializing the game and managing player turns.
- **[king.cpp](cpp_src/king.cpp.driver.md)**: The `king.cpp` file implements the behavior of a King piece in a chess game, including its movement rules and display functionality.
- **[king.h](cpp_src/king.h.driver.md)**: The `king.h` file defines a `King` class representing a chess king piece, including methods for creating the piece, determining its value, checking legal moves, and displaying it.
- **[knight.cpp](cpp_src/knight.cpp.driver.md)**: The `knight.cpp` file implements the behavior of a Knight piece in a chess game, including its movement rules and display representation.
- **[knight.h](cpp_src/knight.h.driver.md)**: The `knight.h` file defines a `Knight` class representing a chess knight piece, including methods for determining legal moves, getting its point value, and displaying the piece.
- **[king.cpp](cpp_src/king.cpp.driver.md)**: The `king.cpp` file implements the behavior of a chess king piece, including its movement rules and display functionality.
- **[king.h](cpp_src/king.h.driver.md)**: The `king.h` file defines a `King` class that represents a chess king piece, including methods for creating the piece, determining its point value, checking legal moves, and displaying it.
- **[knight.cpp](cpp_src/knight.cpp.driver.md)**: The `knight.cpp` file implements the Knight piece for a chess game, including its movement logic and display functionality.
- **[knight.h](cpp_src/knight.h.driver.md)**: The `knight.h` file defines a `Knight` class that represents a chess knight piece, including methods for creating a knight, determining its point value, checking legal moves, and displaying the piece.
- **[main.cpp](cpp_src/main.cpp.driver.md)**: The `main.cpp` file contains the main program logic for playing a chess game, including initializing the game, displaying the board, and handling player moves.
- **[pawn.cpp](cpp_src/pawn.cpp.driver.md)**: The `pawn.cpp` file implements the behavior of a pawn piece in a chess game, including movement, promotion to a queen, and display functionality.
- **[pawn.h](cpp_src/pawn.h.driver.md)**: The `pawn.h` file defines a `Pawn` class representing a chess pawn piece, including methods for setting its location, determining legal moves, and displaying the piece.
- **[piece.cpp](cpp_src/piece.cpp.driver.md)**: The `piece.cpp` file implements the behavior of a chess piece, including movement validation and capturing logic, within a chess game project.
- **[piece.h](cpp_src/piece.h.driver.md)**: The `piece.h` file defines an abstract class for a game piece, including methods for movement, location, and color attributes.
- **[pawn.h](cpp_src/pawn.h.driver.md)**: The `pawn.h` file defines a `Pawn` class representing a chess pawn piece, including methods for movement, location setting, and display functionality.
- **[piece.cpp](cpp_src/piece.cpp.driver.md)**: The `piece.cpp` file implements the `Piece` class for a chess game, handling piece movement, capturing logic, and color assignment.
- **[piece.h](cpp_src/piece.h.driver.md)**: The `piece.h` file defines an abstract class for a game piece, including methods for movement, color determination, and location management.
- **[player.cpp](cpp_src/player.cpp.driver.md)**: The `player.cpp` file implements the `Player` class for a chess game, handling player actions such as making moves, checking for check status, capturing pieces, and calculating scores.
- **[player.h](cpp_src/player.h.driver.md)**: The `player.h` file defines a `Player` class for a chess game, including methods for making moves, checking if the player is in check, capturing pieces, and accessing player attributes like name, color, and score.
- **[queen.cpp](cpp_src/queen.cpp.driver.md)**: The `queen.cpp` file implements the Queen chess piece, including its movement logic and display functionality, for a chess project.
- **[player.h](cpp_src/player.h.driver.md)**: The `player.h` file defines a `Player` class for a chess game, including methods for making moves, checking if the player is in check, capturing pieces, and accessing player attributes such as name, color, and score.
- **[queen.cpp](cpp_src/queen.cpp.driver.md)**: The `queen.cpp` file implements the Queen class for a chess game, defining its movement capabilities and display representation.
- **[queen.h](cpp_src/queen.h.driver.md)**: The `queen.h` file defines a `Queen` class representing a chess queen piece, including methods for determining legal moves, getting its point value, and displaying the piece.
- **[restrictedPiece.cpp](cpp_src/restrictedPiece.cpp.driver.md)**: The `restrictedPiece.cpp` file defines the `RestrictedPiece` class for a chess project, which extends the `Piece` class to include functionality for tracking whether the piece has moved.
- **[restrictedPiece.h](cpp_src/restrictedPiece.h.driver.md)**: The `restrictedPiece.h` file defines a `RestrictedPiece` class for a chess piece that tracks whether it has been moved, inheriting from the `Piece` class.
- **[rook.cpp](cpp_src/rook.cpp.driver.md)**: The `rook.cpp` file implements the behavior of a Rook chess piece, including its movement validation and display, within the `ChessProject`.
- **[restrictedPiece.h](cpp_src/restrictedPiece.h.driver.md)**: The `restrictedPiece.h` file defines a `RestrictedPiece` class for a chess piece that tracks whether it has been moved, extending the functionality of a generic `Piece`.
- **[rook.cpp](cpp_src/rook.cpp.driver.md)**: The `rook.cpp` file implements the Rook chess piece, including its movement logic and display functionality, for the ChessProject.
- **[rook.h](cpp_src/rook.h.driver.md)**: The `rook.h` file defines a class representing a chess rook piece, including methods for determining legal moves, getting its point value, and displaying the piece.
- **[square.cpp](cpp_src/square.cpp.driver.md)**: The `square.cpp` file implements the `Square` class for a chess project, managing the position and occupancy of a chessboard square.
- **[square.h](cpp_src/square.h.driver.md)**: The `square.h` file defines a `Square` class for a game board, including methods to manage its position and the piece occupying it.
- **[square.cpp](cpp_src/square.cpp.driver.md)**: The `square.cpp` file implements the `Square` class for a chess project, managing the position and occupancy of a square on the chessboard.
- **[square.h](cpp_src/square.h.driver.md)**: The `square.h` file defines a `Square` class for representing a square on a game board, including methods for setting and retrieving the piece occupying the square, as well as its position.
42 changes: 17 additions & 25 deletions driver_docs/cpp_src/bishop.cpp.driver.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Purpose
This C++ code defines the implementation of a [`Bishop`](#BishopBishop) class, which is part of a chess game project. The code provides narrow functionality specific to the behavior and characteristics of a bishop piece in chess. It is a C++ source file intended to be compiled as part of a larger chess application, likely alongside other piece classes. The [`Bishop`](#BishopBishop) class inherits from a `Piece` class, indicating a class hierarchy for different chess pieces. It includes methods to determine the bishop's value, check if a move is valid based on diagonal movement, and display the bishop's representation. The code relies on external components such as a `Board` class and a `Square` class, suggesting it is part of a modular design where each piece type has its own implementation file.
This C++ code defines the implementation of a [`Bishop`](#BishopBishop) class, which is part of a chess game project. The code provides narrow functionality specific to the behavior and characteristics of a bishop piece in chess. It is not an executable file but rather a C++ source file intended to be used in conjunction with other files, likely as part of a larger chess game application. The [`Bishop`](#BishopBishop) class inherits from a `Piece` class, indicating a hierarchical design where [`Bishop`](#BishopBishop) is a specialized type of `Piece`. The class includes methods to determine the bishop's value, check if it can move to a specified square based on chess rules (specifically moving diagonally), and display the bishop's representation on the board. The use of a destructor and constructor suggests proper resource management, although no dynamic memory allocation is evident in this snippet.
# Imports and Dependencies

---
Expand All @@ -17,7 +17,7 @@ This C++ code defines the implementation of a [`Bishop`](#BishopBishop) class, w
- [`Bishop::value`](#Bishopvalue)
- [`Bishop::canMoveTo`](#BishopcanMoveTo)
- [`Bishop::display`](#Bishopdisplay)
- **Inherits from**:
- **Inherits From**:
- `Piece`

**Methods**
Expand All @@ -30,61 +30,53 @@ The `Bishop` constructor initializes a Bishop object with a specified color by c
- **Control Flow**:
- The constructor `Bishop::Bishop(bool isWhite)` is called with a boolean parameter `isWhite`.
- The constructor initializes the Bishop object by calling the base class `Piece` constructor with the `isWhite` parameter.
- **Output**:
- There is no return value as this is a constructor for initializing a Bishop object.
- **Output**: There is no return value as this is a constructor for initializing a Bishop object.
- **See also**: [`Bishop`](bishop.h.driver.md#Bishop) (Data Structure)


---
#### Bishop::\~Bishop<!-- {{#callable:Bishop::~Bishop}} -->
The destructor for the Bishop class is a default destructor that performs no specific actions.
- **Inputs**:
- None
The `Bishop::~Bishop()` function is the default destructor for the `Bishop` class, which currently performs no specific actions upon object destruction.
- **Inputs**: None
- **Control Flow**:
- The destructor is called when a Bishop object is destroyed.
- No specific actions or resource deallocations are performed within the destructor.
- **Output**:
- There is no output or return value from the destructor.
- The destructor is called when a `Bishop` object goes out of scope or is explicitly deleted.
- Currently, the destructor does not contain any code, so it performs no operations.
- **Output**: There is no output from this destructor as it is empty and performs no actions.
- **See also**: [`Bishop`](bishop.h.driver.md#Bishop) (Data Structure)


---
#### Bishop::value<!-- {{#callable:Bishop::value}} -->
The `value` function returns the point value of a Bishop piece in a chess game.
- **Inputs**:
- None
The `value` function returns the fixed point value of a Bishop piece in a chess game.
- **Inputs**: None
- **Control Flow**:
- The function is a constant member function of the `Bishop` class, indicating it does not modify the state of the object.
- It directly returns the integer value `3`, which represents the point value of a Bishop in chess.
- **Output**:
- The function returns an integer value of `3`, representing the point value of a Bishop piece.
- **Output**: The function returns an integer value of `3`.
- **See also**: [`Bishop`](bishop.h.driver.md#Bishop) (Data Structure)


---
#### Bishop::canMoveTo<!-- {{#callable:Bishop::canMoveTo}} -->
The `canMoveTo` function determines if a Bishop can legally move to a specified square by checking if the path is a clear diagonal.
The `canMoveTo` function checks if a Bishop can legally move to a specified square by verifying if the path is a clear diagonal.
- **Inputs**:
- `location`: A reference to a `Square` object representing the target location to which the Bishop intends to move.
- `location`: A reference to a `Square` object representing the destination square to which the Bishop intends to move.
- **Control Flow**:
- Initialize a boolean variable `validMove` to `false`.
- Check if the path from the Bishop's current location to the target `location` is a clear diagonal using `Board::getBoard()->isClearDiagonal`.
- If the path is clear, set `validMove` to `true`.
- Return the value of `validMove`.
- **Output**:
- A boolean value indicating whether the Bishop can legally move to the specified square.
- **Output**: A boolean value indicating whether the Bishop can legally move to the specified square.
- **See also**: [`Bishop`](bishop.h.driver.md#Bishop) (Data Structure)


---
#### Bishop::display<!-- {{#callable:Bishop::display}} -->
The `display` function outputs the color and type of the Bishop piece to the console.
- **Inputs**:
- None
- **Inputs**: None
- **Control Flow**:
- The function uses the `cout` stream to output the Bishop's color followed by the letter 'B'.
- **Output**:
- The function outputs a string to the console that represents the Bishop piece, consisting of its color and the letter 'B'.
- The function uses the `cout` stream to output the Bishop's color followed by the letter 'B' to represent the Bishop piece.
- **Output**: The function does not return any value; it outputs directly to the console.
- **See also**: [`Bishop`](bishop.h.driver.md#Bishop) (Data Structure)


Expand Down
Loading