-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
We're building a new brain, from scratch
- Loading branch information
Showing
28 changed files
with
76 additions
and
1,119 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,46 @@ | ||
#pragma once | ||
|
||
#include <codbrain/brain.hpp> | ||
#include <codchess/codchess.hpp> | ||
|
||
namespace codbrain { | ||
/// @brief Initializes the library | ||
void Init() noexcept { | ||
eval::Init(); | ||
void | ||
Init() noexcept { | ||
codchess::Init(); | ||
} | ||
} // namespace codbrain | ||
|
||
/// @brief The depth of the search. | ||
typedef std::uint8_t Depth; | ||
|
||
/// @brief The number of nodes searched. | ||
typedef std::uint64_t Nodes; | ||
|
||
/// @brief The evaluation of a position. | ||
typedef std::int16_t Evaluation; | ||
|
||
struct Result { | ||
Nodes nodes; | ||
Evaluation evaluation; | ||
std::vector<codchess::Move> pv; | ||
}; | ||
|
||
class Brain final { | ||
public: | ||
/// @brief Construct a new Brain object. | ||
explicit Brain(const Depth depth) noexcept : _depth{depth} {} | ||
|
||
/// @brief Returns the board. | ||
[[nodiscard]] auto &board() noexcept { return _board; } | ||
|
||
/// @brief Returns the best move. | ||
[[nodiscard]] Result Search() noexcept { | ||
const auto legal_moves = codchess::movegen::Legal(_board); | ||
return {0, 0, {*legal_moves.begin()}}; | ||
} | ||
|
||
private: | ||
Depth _depth; | ||
/// @brief The board. | ||
codchess::Board _board{}; | ||
}; | ||
} // namespace codbrain |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.