26#include <magic_enum/magic_enum.hpp>
56 -> std::expected<File, std::string>;
74struct std::formatter<
chess::board::File> final {
75 template <
typename ParseContext>
76 constexpr auto parse(ParseContext& ctx) ->
typename ParseContext::iterator
81 template <
typename FormatContext>
109 -> std::expected<File, std::string>
112 case 'a': [[fallthrough]];
115 case 'b': [[fallthrough]];
118 case 'c': [[fallthrough]];
121 case 'd': [[fallthrough]];
124 case 'e': [[fallthrough]];
127 case 'f': [[fallthrough]];
130 case 'g': [[fallthrough]];
133 case 'h': [[fallthrough]];
137 return std::unexpected {
139 "Cannot parse File from character: {}",
147 const auto upperChar = magic_enum::enum_name(file).front();
149 return static_cast<char>(
150 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.