26#include <magic_enum/magic_enum.hpp>
56 -> std::expected<File, std::string>;
74struct std::formatter<
chess::board::File> final {
75 template <
typename ParseContext>
77 constexpr auto parse(ParseContext& ctx) ->
typename ParseContext::iterator
82 template <
typename FormatContext>
111 -> std::expected<File, std::string>
114 case 'a': [[fallthrough]];
117 case 'b': [[fallthrough]];
120 case 'c': [[fallthrough]];
123 case 'd': [[fallthrough]];
126 case 'e': [[fallthrough]];
129 case 'f': [[fallthrough]];
132 case 'g': [[fallthrough]];
135 case 'h': [[fallthrough]];
139 return std::unexpected {
141 "Cannot parse File from character: {}",
149 const auto upperChar = magic_enum::enum_name(file).front();
151 return static_cast<char>(
152 std::tolower(
static_cast<unsigned char>(upperChar)));
std::uint_fast8_t BitboardIndex
auto file_from_char(char character) -> std::expected< File, std::string >
auto file_to_char(File file) -> char
@ E
The E file. This is the file that the kings start on.
@ D
The D file. This is the file that the queens start on.