Current section
Files
Jump to
Current section
Files
src/move_san.erl
-module(move_san).
-compile([no_auto_import, nowarn_unused_vars, nowarn_unused_function]).
-export([from_string/1]).
-export_type([move_san/0, position_san/0, error_san/0, castle_side/0, check_or_check_mate/0]).
-type move_san() :: {normal,
gleam@option:option(position_san()),
position:position(),
piece:kind(),
boolean(),
gleam@option:option(piece:kind()),
gleam@option:option(check_or_check_mate())} |
{castle, castle_side(), gleam@option:option(check_or_check_mate())} |
{en_passant,
gleam@option:option(position_san()),
position:position(),
gleam@option:option(check_or_check_mate())}.
-type position_san() :: {position_san,
gleam@option:option(position:file()),
gleam@option:option(position:rank())}.
-type error_san() :: invalid_move_string |
invalid_castle_string |
invalid_positional_information.
-type castle_side() :: king_side | queen_side.
-type check_or_check_mate() :: check | check_mate.
-spec from_string(binary()) -> {ok, move_san()} | {error, error_san()}.
from_string(San) ->
case gleam@string:to_graphemes(San) of
[] ->
(erlang:error(#{gleam_error => panic,
message => <<"panic expression evaluated"/utf8>>,
module => <<"move_san"/utf8>>,
function => <<"from_string"/utf8>>,
line => 47}))(<<"Cannot parse empty string."/utf8>>);
[Piece_letter | Rest] when ((((Piece_letter =:= <<"K"/utf8>>) orelse (Piece_letter =:= <<"Q"/utf8>>)) orelse (Piece_letter =:= <<"R"/utf8>>)) orelse (Piece_letter =:= <<"B"/utf8>>)) orelse (Piece_letter =:= <<"N"/utf8>>) ->
Check_or_checkmate = case gleam@list:last(Rest) of
{ok, <<"+"/utf8>>} ->
{some, check};
{ok, <<"#"/utf8>>} ->
{some, check_mate};
_ ->
none
end,
Moving_piece = case Piece_letter of
<<"K"/utf8>> ->
king;
<<"Q"/utf8>> ->
queen;
<<"R"/utf8>> ->
rook;
<<"B"/utf8>> ->
bishop;
<<"N"/utf8>> ->
knight;
_ ->
(erlang:error(#{gleam_error => panic,
message => <<"panic expression evaluated"/utf8>>,
module => <<"move_san"/utf8>>,
function => <<"from_string"/utf8>>,
line => 61}))(<<"Invalid piece letter."/utf8>>)
end,
Promotion = none,
Capture = gleam@list:contains(Rest, <<"x"/utf8>>),
Positional_information = gleam@list:filter(
Rest,
fun(Grapheme) ->
((Grapheme /= <<"+"/utf8>>) andalso (Grapheme /= <<"#"/utf8>>))
andalso (Grapheme /= <<"x"/utf8>>)
end
),
case gleam@list:length(Positional_information) of
4 ->
[From_file, From_rank, To_file, To_rank] = Positional_information,
From_file@1 = case From_file of
<<"a"/utf8>> ->
a;
<<"b"/utf8>> ->
b;
<<"c"/utf8>> ->
c;
<<"d"/utf8>> ->
d;
<<"e"/utf8>> ->
e;
<<"f"/utf8>> ->
f;
<<"g"/utf8>> ->
g;
<<"h"/utf8>> ->
h;
_ ->
(erlang:error(#{gleam_error => panic,
message => <<"panic expression evaluated"/utf8>>,
module => <<"move_san"/utf8>>,
function => <<"from_string"/utf8>>,
line => 86}))(<<"Invalid file."/utf8>>)
end,
From_rank@1 = case From_rank of
<<"1"/utf8>> ->
one;
<<"2"/utf8>> ->
two;
<<"3"/utf8>> ->
three;
<<"4"/utf8>> ->
four;
<<"5"/utf8>> ->
five;
<<"6"/utf8>> ->
six;
<<"7"/utf8>> ->
seven;
<<"8"/utf8>> ->
eight;
_ ->
(erlang:error(#{gleam_error => panic,
message => <<"panic expression evaluated"/utf8>>,
module => <<"move_san"/utf8>>,
function => <<"from_string"/utf8>>,
line => 98}))(<<"Invalid rank."/utf8>>)
end,
To_file@1 = case To_file of
<<"a"/utf8>> ->
a;
<<"b"/utf8>> ->
b;
<<"c"/utf8>> ->
c;
<<"d"/utf8>> ->
d;
<<"e"/utf8>> ->
e;
<<"f"/utf8>> ->
f;
<<"g"/utf8>> ->
g;
<<"h"/utf8>> ->
h;
_ ->
(erlang:error(#{gleam_error => panic,
message => <<"panic expression evaluated"/utf8>>,
module => <<"move_san"/utf8>>,
function => <<"from_string"/utf8>>,
line => 110}))(<<"Invalid file."/utf8>>)
end,
To_rank@1 = case To_rank of
<<"1"/utf8>> ->
one;
<<"2"/utf8>> ->
two;
<<"3"/utf8>> ->
three;
<<"4"/utf8>> ->
four;
<<"5"/utf8>> ->
five;
<<"6"/utf8>> ->
six;
<<"7"/utf8>> ->
seven;
<<"8"/utf8>> ->
eight;
_ ->
(erlang:error(#{gleam_error => panic,
message => <<"panic expression evaluated"/utf8>>,
module => <<"move_san"/utf8>>,
function => <<"from_string"/utf8>>,
line => 122}))(<<"Invalid rank."/utf8>>)
end,
{ok,
{normal,
{some,
{position_san,
{some, From_file@1},
{some, From_rank@1}}},
{position, To_file@1, To_rank@1},
Moving_piece,
Capture,
Promotion,
Check_or_checkmate}};
3 ->
[Maybe_from_file_or_from_rank, To_file@2, To_rank@2] = Positional_information,
case Maybe_from_file_or_from_rank of
<<"a"/utf8>> ->
From_file@2 = case Maybe_from_file_or_from_rank of
<<"a"/utf8>> ->
a;
<<"b"/utf8>> ->
b;
<<"c"/utf8>> ->
c;
<<"d"/utf8>> ->
d;
<<"e"/utf8>> ->
e;
<<"f"/utf8>> ->
f;
<<"g"/utf8>> ->
g;
<<"h"/utf8>> ->
h;
_ ->
(erlang:error(#{gleam_error => panic,
message => <<"panic expression evaluated"/utf8>>,
module => <<"move_san"/utf8>>,
function => <<"from_string"/utf8>>,
line => 148}))(
<<"Invalid file"/utf8>>
)
end,
To_file@3 = case To_file@2 of
<<"a"/utf8>> ->
a;
<<"b"/utf8>> ->
b;
<<"c"/utf8>> ->
c;
<<"d"/utf8>> ->
d;
<<"e"/utf8>> ->
e;
<<"f"/utf8>> ->
f;
<<"g"/utf8>> ->
g;
<<"h"/utf8>> ->
h;
_ ->
(erlang:error(#{gleam_error => panic,
message => <<"panic expression evaluated"/utf8>>,
module => <<"move_san"/utf8>>,
function => <<"from_string"/utf8>>,
line => 160}))(
<<"Invalid file."/utf8>>
)
end,
To_rank@3 = case To_rank@2 of
<<"1"/utf8>> ->
one;
<<"2"/utf8>> ->
two;
<<"3"/utf8>> ->
three;
<<"4"/utf8>> ->
four;
<<"5"/utf8>> ->
five;
<<"6"/utf8>> ->
six;
<<"7"/utf8>> ->
seven;
<<"8"/utf8>> ->
eight;
_ ->
(erlang:error(#{gleam_error => panic,
message => <<"panic expression evaluated"/utf8>>,
module => <<"move_san"/utf8>>,
function => <<"from_string"/utf8>>,
line => 172}))(
<<"Invalid rank."/utf8>>
)
end,
{ok,
{normal,
{some,
{position_san,
{some, From_file@2},
none}},
{position, To_file@3, To_rank@3},
Moving_piece,
Capture,
Promotion,
Check_or_checkmate}};
<<"b"/utf8>> ->
From_file@2 = case Maybe_from_file_or_from_rank of
<<"a"/utf8>> ->
a;
<<"b"/utf8>> ->
b;
<<"c"/utf8>> ->
c;
<<"d"/utf8>> ->
d;
<<"e"/utf8>> ->
e;
<<"f"/utf8>> ->
f;
<<"g"/utf8>> ->
g;
<<"h"/utf8>> ->
h;
_ ->
(erlang:error(#{gleam_error => panic,
message => <<"panic expression evaluated"/utf8>>,
module => <<"move_san"/utf8>>,
function => <<"from_string"/utf8>>,
line => 148}))(
<<"Invalid file"/utf8>>
)
end,
To_file@3 = case To_file@2 of
<<"a"/utf8>> ->
a;
<<"b"/utf8>> ->
b;
<<"c"/utf8>> ->
c;
<<"d"/utf8>> ->
d;
<<"e"/utf8>> ->
e;
<<"f"/utf8>> ->
f;
<<"g"/utf8>> ->
g;
<<"h"/utf8>> ->
h;
_ ->
(erlang:error(#{gleam_error => panic,
message => <<"panic expression evaluated"/utf8>>,
module => <<"move_san"/utf8>>,
function => <<"from_string"/utf8>>,
line => 160}))(
<<"Invalid file."/utf8>>
)
end,
To_rank@3 = case To_rank@2 of
<<"1"/utf8>> ->
one;
<<"2"/utf8>> ->
two;
<<"3"/utf8>> ->
three;
<<"4"/utf8>> ->
four;
<<"5"/utf8>> ->
five;
<<"6"/utf8>> ->
six;
<<"7"/utf8>> ->
seven;
<<"8"/utf8>> ->
eight;
_ ->
(erlang:error(#{gleam_error => panic,
message => <<"panic expression evaluated"/utf8>>,
module => <<"move_san"/utf8>>,
function => <<"from_string"/utf8>>,
line => 172}))(
<<"Invalid rank."/utf8>>
)
end,
{ok,
{normal,
{some,
{position_san,
{some, From_file@2},
none}},
{position, To_file@3, To_rank@3},
Moving_piece,
Capture,
Promotion,
Check_or_checkmate}};
<<"c"/utf8>> ->
From_file@2 = case Maybe_from_file_or_from_rank of
<<"a"/utf8>> ->
a;
<<"b"/utf8>> ->
b;
<<"c"/utf8>> ->
c;
<<"d"/utf8>> ->
d;
<<"e"/utf8>> ->
e;
<<"f"/utf8>> ->
f;
<<"g"/utf8>> ->
g;
<<"h"/utf8>> ->
h;
_ ->
(erlang:error(#{gleam_error => panic,
message => <<"panic expression evaluated"/utf8>>,
module => <<"move_san"/utf8>>,
function => <<"from_string"/utf8>>,
line => 148}))(
<<"Invalid file"/utf8>>
)
end,
To_file@3 = case To_file@2 of
<<"a"/utf8>> ->
a;
<<"b"/utf8>> ->
b;
<<"c"/utf8>> ->
c;
<<"d"/utf8>> ->
d;
<<"e"/utf8>> ->
e;
<<"f"/utf8>> ->
f;
<<"g"/utf8>> ->
g;
<<"h"/utf8>> ->
h;
_ ->
(erlang:error(#{gleam_error => panic,
message => <<"panic expression evaluated"/utf8>>,
module => <<"move_san"/utf8>>,
function => <<"from_string"/utf8>>,
line => 160}))(
<<"Invalid file."/utf8>>
)
end,
To_rank@3 = case To_rank@2 of
<<"1"/utf8>> ->
one;
<<"2"/utf8>> ->
two;
<<"3"/utf8>> ->
three;
<<"4"/utf8>> ->
four;
<<"5"/utf8>> ->
five;
<<"6"/utf8>> ->
six;
<<"7"/utf8>> ->
seven;
<<"8"/utf8>> ->
eight;
_ ->
(erlang:error(#{gleam_error => panic,
message => <<"panic expression evaluated"/utf8>>,
module => <<"move_san"/utf8>>,
function => <<"from_string"/utf8>>,
line => 172}))(
<<"Invalid rank."/utf8>>
)
end,
{ok,
{normal,
{some,
{position_san,
{some, From_file@2},
none}},
{position, To_file@3, To_rank@3},
Moving_piece,
Capture,
Promotion,
Check_or_checkmate}};
<<"d"/utf8>> ->
From_file@2 = case Maybe_from_file_or_from_rank of
<<"a"/utf8>> ->
a;
<<"b"/utf8>> ->
b;
<<"c"/utf8>> ->
c;
<<"d"/utf8>> ->
d;
<<"e"/utf8>> ->
e;
<<"f"/utf8>> ->
f;
<<"g"/utf8>> ->
g;
<<"h"/utf8>> ->
h;
_ ->
(erlang:error(#{gleam_error => panic,
message => <<"panic expression evaluated"/utf8>>,
module => <<"move_san"/utf8>>,
function => <<"from_string"/utf8>>,
line => 148}))(
<<"Invalid file"/utf8>>
)
end,
To_file@3 = case To_file@2 of
<<"a"/utf8>> ->
a;
<<"b"/utf8>> ->
b;
<<"c"/utf8>> ->
c;
<<"d"/utf8>> ->
d;
<<"e"/utf8>> ->
e;
<<"f"/utf8>> ->
f;
<<"g"/utf8>> ->
g;
<<"h"/utf8>> ->
h;
_ ->
(erlang:error(#{gleam_error => panic,
message => <<"panic expression evaluated"/utf8>>,
module => <<"move_san"/utf8>>,
function => <<"from_string"/utf8>>,
line => 160}))(
<<"Invalid file."/utf8>>
)
end,
To_rank@3 = case To_rank@2 of
<<"1"/utf8>> ->
one;
<<"2"/utf8>> ->
two;
<<"3"/utf8>> ->
three;
<<"4"/utf8>> ->
four;
<<"5"/utf8>> ->
five;
<<"6"/utf8>> ->
six;
<<"7"/utf8>> ->
seven;
<<"8"/utf8>> ->
eight;
_ ->
(erlang:error(#{gleam_error => panic,
message => <<"panic expression evaluated"/utf8>>,
module => <<"move_san"/utf8>>,
function => <<"from_string"/utf8>>,
line => 172}))(
<<"Invalid rank."/utf8>>
)
end,
{ok,
{normal,
{some,
{position_san,
{some, From_file@2},
none}},
{position, To_file@3, To_rank@3},
Moving_piece,
Capture,
Promotion,
Check_or_checkmate}};
<<"e"/utf8>> ->
From_file@2 = case Maybe_from_file_or_from_rank of
<<"a"/utf8>> ->
a;
<<"b"/utf8>> ->
b;
<<"c"/utf8>> ->
c;
<<"d"/utf8>> ->
d;
<<"e"/utf8>> ->
e;
<<"f"/utf8>> ->
f;
<<"g"/utf8>> ->
g;
<<"h"/utf8>> ->
h;
_ ->
(erlang:error(#{gleam_error => panic,
message => <<"panic expression evaluated"/utf8>>,
module => <<"move_san"/utf8>>,
function => <<"from_string"/utf8>>,
line => 148}))(
<<"Invalid file"/utf8>>
)
end,
To_file@3 = case To_file@2 of
<<"a"/utf8>> ->
a;
<<"b"/utf8>> ->
b;
<<"c"/utf8>> ->
c;
<<"d"/utf8>> ->
d;
<<"e"/utf8>> ->
e;
<<"f"/utf8>> ->
f;
<<"g"/utf8>> ->
g;
<<"h"/utf8>> ->
h;
_ ->
(erlang:error(#{gleam_error => panic,
message => <<"panic expression evaluated"/utf8>>,
module => <<"move_san"/utf8>>,
function => <<"from_string"/utf8>>,
line => 160}))(
<<"Invalid file."/utf8>>
)
end,
To_rank@3 = case To_rank@2 of
<<"1"/utf8>> ->
one;
<<"2"/utf8>> ->
two;
<<"3"/utf8>> ->
three;
<<"4"/utf8>> ->
four;
<<"5"/utf8>> ->
five;
<<"6"/utf8>> ->
six;
<<"7"/utf8>> ->
seven;
<<"8"/utf8>> ->
eight;
_ ->
(erlang:error(#{gleam_error => panic,
message => <<"panic expression evaluated"/utf8>>,
module => <<"move_san"/utf8>>,
function => <<"from_string"/utf8>>,
line => 172}))(
<<"Invalid rank."/utf8>>
)
end,
{ok,
{normal,
{some,
{position_san,
{some, From_file@2},
none}},
{position, To_file@3, To_rank@3},
Moving_piece,
Capture,
Promotion,
Check_or_checkmate}};
<<"f"/utf8>> ->
From_file@2 = case Maybe_from_file_or_from_rank of
<<"a"/utf8>> ->
a;
<<"b"/utf8>> ->
b;
<<"c"/utf8>> ->
c;
<<"d"/utf8>> ->
d;
<<"e"/utf8>> ->
e;
<<"f"/utf8>> ->
f;
<<"g"/utf8>> ->
g;
<<"h"/utf8>> ->
h;
_ ->
(erlang:error(#{gleam_error => panic,
message => <<"panic expression evaluated"/utf8>>,
module => <<"move_san"/utf8>>,
function => <<"from_string"/utf8>>,
line => 148}))(
<<"Invalid file"/utf8>>
)
end,
To_file@3 = case To_file@2 of
<<"a"/utf8>> ->
a;
<<"b"/utf8>> ->
b;
<<"c"/utf8>> ->
c;
<<"d"/utf8>> ->
d;
<<"e"/utf8>> ->
e;
<<"f"/utf8>> ->
f;
<<"g"/utf8>> ->
g;
<<"h"/utf8>> ->
h;
_ ->
(erlang:error(#{gleam_error => panic,
message => <<"panic expression evaluated"/utf8>>,
module => <<"move_san"/utf8>>,
function => <<"from_string"/utf8>>,
line => 160}))(
<<"Invalid file."/utf8>>
)
end,
To_rank@3 = case To_rank@2 of
<<"1"/utf8>> ->
one;
<<"2"/utf8>> ->
two;
<<"3"/utf8>> ->
three;
<<"4"/utf8>> ->
four;
<<"5"/utf8>> ->
five;
<<"6"/utf8>> ->
six;
<<"7"/utf8>> ->
seven;
<<"8"/utf8>> ->
eight;
_ ->
(erlang:error(#{gleam_error => panic,
message => <<"panic expression evaluated"/utf8>>,
module => <<"move_san"/utf8>>,
function => <<"from_string"/utf8>>,
line => 172}))(
<<"Invalid rank."/utf8>>
)
end,
{ok,
{normal,
{some,
{position_san,
{some, From_file@2},
none}},
{position, To_file@3, To_rank@3},
Moving_piece,
Capture,
Promotion,
Check_or_checkmate}};
<<"g"/utf8>> ->
From_file@2 = case Maybe_from_file_or_from_rank of
<<"a"/utf8>> ->
a;
<<"b"/utf8>> ->
b;
<<"c"/utf8>> ->
c;
<<"d"/utf8>> ->
d;
<<"e"/utf8>> ->
e;
<<"f"/utf8>> ->
f;
<<"g"/utf8>> ->
g;
<<"h"/utf8>> ->
h;
_ ->
(erlang:error(#{gleam_error => panic,
message => <<"panic expression evaluated"/utf8>>,
module => <<"move_san"/utf8>>,
function => <<"from_string"/utf8>>,
line => 148}))(
<<"Invalid file"/utf8>>
)
end,
To_file@3 = case To_file@2 of
<<"a"/utf8>> ->
a;
<<"b"/utf8>> ->
b;
<<"c"/utf8>> ->
c;
<<"d"/utf8>> ->
d;
<<"e"/utf8>> ->
e;
<<"f"/utf8>> ->
f;
<<"g"/utf8>> ->
g;
<<"h"/utf8>> ->
h;
_ ->
(erlang:error(#{gleam_error => panic,
message => <<"panic expression evaluated"/utf8>>,
module => <<"move_san"/utf8>>,
function => <<"from_string"/utf8>>,
line => 160}))(
<<"Invalid file."/utf8>>
)
end,
To_rank@3 = case To_rank@2 of
<<"1"/utf8>> ->
one;
<<"2"/utf8>> ->
two;
<<"3"/utf8>> ->
three;
<<"4"/utf8>> ->
four;
<<"5"/utf8>> ->
five;
<<"6"/utf8>> ->
six;
<<"7"/utf8>> ->
seven;
<<"8"/utf8>> ->
eight;
_ ->
(erlang:error(#{gleam_error => panic,
message => <<"panic expression evaluated"/utf8>>,
module => <<"move_san"/utf8>>,
function => <<"from_string"/utf8>>,
line => 172}))(
<<"Invalid rank."/utf8>>
)
end,
{ok,
{normal,
{some,
{position_san,
{some, From_file@2},
none}},
{position, To_file@3, To_rank@3},
Moving_piece,
Capture,
Promotion,
Check_or_checkmate}};
<<"h"/utf8>> ->
From_file@2 = case Maybe_from_file_or_from_rank of
<<"a"/utf8>> ->
a;
<<"b"/utf8>> ->
b;
<<"c"/utf8>> ->
c;
<<"d"/utf8>> ->
d;
<<"e"/utf8>> ->
e;
<<"f"/utf8>> ->
f;
<<"g"/utf8>> ->
g;
<<"h"/utf8>> ->
h;
_ ->
(erlang:error(#{gleam_error => panic,
message => <<"panic expression evaluated"/utf8>>,
module => <<"move_san"/utf8>>,
function => <<"from_string"/utf8>>,
line => 148}))(
<<"Invalid file"/utf8>>
)
end,
To_file@3 = case To_file@2 of
<<"a"/utf8>> ->
a;
<<"b"/utf8>> ->
b;
<<"c"/utf8>> ->
c;
<<"d"/utf8>> ->
d;
<<"e"/utf8>> ->
e;
<<"f"/utf8>> ->
f;
<<"g"/utf8>> ->
g;
<<"h"/utf8>> ->
h;
_ ->
(erlang:error(#{gleam_error => panic,
message => <<"panic expression evaluated"/utf8>>,
module => <<"move_san"/utf8>>,
function => <<"from_string"/utf8>>,
line => 160}))(
<<"Invalid file."/utf8>>
)
end,
To_rank@3 = case To_rank@2 of
<<"1"/utf8>> ->
one;
<<"2"/utf8>> ->
two;
<<"3"/utf8>> ->
three;
<<"4"/utf8>> ->
four;
<<"5"/utf8>> ->
five;
<<"6"/utf8>> ->
six;
<<"7"/utf8>> ->
seven;
<<"8"/utf8>> ->
eight;
_ ->
(erlang:error(#{gleam_error => panic,
message => <<"panic expression evaluated"/utf8>>,
module => <<"move_san"/utf8>>,
function => <<"from_string"/utf8>>,
line => 172}))(
<<"Invalid rank."/utf8>>
)
end,
{ok,
{normal,
{some,
{position_san,
{some, From_file@2},
none}},
{position, To_file@3, To_rank@3},
Moving_piece,
Capture,
Promotion,
Check_or_checkmate}};
<<"1"/utf8>> ->
From_rank@2 = case Maybe_from_file_or_from_rank of
<<"1"/utf8>> ->
one;
<<"2"/utf8>> ->
two;
<<"3"/utf8>> ->
three;
<<"4"/utf8>> ->
four;
<<"5"/utf8>> ->
five;
<<"6"/utf8>> ->
six;
<<"7"/utf8>> ->
seven;
<<"8"/utf8>> ->
eight;
_ ->
(erlang:error(#{gleam_error => panic,
message => <<"panic expression evaluated"/utf8>>,
module => <<"move_san"/utf8>>,
function => <<"from_string"/utf8>>,
line => 194}))(
<<"Invalid rank."/utf8>>
)
end,
To_file@4 = case To_file@2 of
<<"a"/utf8>> ->
a;
<<"b"/utf8>> ->
b;
<<"c"/utf8>> ->
c;
<<"d"/utf8>> ->
d;
<<"e"/utf8>> ->
e;
<<"f"/utf8>> ->
f;
<<"g"/utf8>> ->
g;
<<"h"/utf8>> ->
h;
_ ->
(erlang:error(#{gleam_error => panic,
message => <<"panic expression evaluated"/utf8>>,
module => <<"move_san"/utf8>>,
function => <<"from_string"/utf8>>,
line => 206}))(
<<"Invalid file."/utf8>>
)
end,
To_rank@4 = case To_rank@2 of
<<"1"/utf8>> ->
one;
<<"2"/utf8>> ->
two;
<<"3"/utf8>> ->
three;
<<"4"/utf8>> ->
four;
<<"5"/utf8>> ->
five;
<<"6"/utf8>> ->
six;
<<"7"/utf8>> ->
seven;
<<"8"/utf8>> ->
eight;
_ ->
(erlang:error(#{gleam_error => panic,
message => <<"panic expression evaluated"/utf8>>,
module => <<"move_san"/utf8>>,
function => <<"from_string"/utf8>>,
line => 218}))(
<<"Invalid rank."/utf8>>
)
end,
{ok,
{normal,
{some,
{position_san,
none,
{some, From_rank@2}}},
{position, To_file@4, To_rank@4},
Moving_piece,
Capture,
Promotion,
Check_or_checkmate}};
<<"2"/utf8>> ->
From_rank@2 = case Maybe_from_file_or_from_rank of
<<"1"/utf8>> ->
one;
<<"2"/utf8>> ->
two;
<<"3"/utf8>> ->
three;
<<"4"/utf8>> ->
four;
<<"5"/utf8>> ->
five;
<<"6"/utf8>> ->
six;
<<"7"/utf8>> ->
seven;
<<"8"/utf8>> ->
eight;
_ ->
(erlang:error(#{gleam_error => panic,
message => <<"panic expression evaluated"/utf8>>,
module => <<"move_san"/utf8>>,
function => <<"from_string"/utf8>>,
line => 194}))(
<<"Invalid rank."/utf8>>
)
end,
To_file@4 = case To_file@2 of
<<"a"/utf8>> ->
a;
<<"b"/utf8>> ->
b;
<<"c"/utf8>> ->
c;
<<"d"/utf8>> ->
d;
<<"e"/utf8>> ->
e;
<<"f"/utf8>> ->
f;
<<"g"/utf8>> ->
g;
<<"h"/utf8>> ->
h;
_ ->
(erlang:error(#{gleam_error => panic,
message => <<"panic expression evaluated"/utf8>>,
module => <<"move_san"/utf8>>,
function => <<"from_string"/utf8>>,
line => 206}))(
<<"Invalid file."/utf8>>
)
end,
To_rank@4 = case To_rank@2 of
<<"1"/utf8>> ->
one;
<<"2"/utf8>> ->
two;
<<"3"/utf8>> ->
three;
<<"4"/utf8>> ->
four;
<<"5"/utf8>> ->
five;
<<"6"/utf8>> ->
six;
<<"7"/utf8>> ->
seven;
<<"8"/utf8>> ->
eight;
_ ->
(erlang:error(#{gleam_error => panic,
message => <<"panic expression evaluated"/utf8>>,
module => <<"move_san"/utf8>>,
function => <<"from_string"/utf8>>,
line => 218}))(
<<"Invalid rank."/utf8>>
)
end,
{ok,
{normal,
{some,
{position_san,
none,
{some, From_rank@2}}},
{position, To_file@4, To_rank@4},
Moving_piece,
Capture,
Promotion,
Check_or_checkmate}};
<<"3"/utf8>> ->
From_rank@2 = case Maybe_from_file_or_from_rank of
<<"1"/utf8>> ->
one;
<<"2"/utf8>> ->
two;
<<"3"/utf8>> ->
three;
<<"4"/utf8>> ->
four;
<<"5"/utf8>> ->
five;
<<"6"/utf8>> ->
six;
<<"7"/utf8>> ->
seven;
<<"8"/utf8>> ->
eight;
_ ->
(erlang:error(#{gleam_error => panic,
message => <<"panic expression evaluated"/utf8>>,
module => <<"move_san"/utf8>>,
function => <<"from_string"/utf8>>,
line => 194}))(
<<"Invalid rank."/utf8>>
)
end,
To_file@4 = case To_file@2 of
<<"a"/utf8>> ->
a;
<<"b"/utf8>> ->
b;
<<"c"/utf8>> ->
c;
<<"d"/utf8>> ->
d;
<<"e"/utf8>> ->
e;
<<"f"/utf8>> ->
f;
<<"g"/utf8>> ->
g;
<<"h"/utf8>> ->
h;
_ ->
(erlang:error(#{gleam_error => panic,
message => <<"panic expression evaluated"/utf8>>,
module => <<"move_san"/utf8>>,
function => <<"from_string"/utf8>>,
line => 206}))(
<<"Invalid file."/utf8>>
)
end,
To_rank@4 = case To_rank@2 of
<<"1"/utf8>> ->
one;
<<"2"/utf8>> ->
two;
<<"3"/utf8>> ->
three;
<<"4"/utf8>> ->
four;
<<"5"/utf8>> ->
five;
<<"6"/utf8>> ->
six;
<<"7"/utf8>> ->
seven;
<<"8"/utf8>> ->
eight;
_ ->
(erlang:error(#{gleam_error => panic,
message => <<"panic expression evaluated"/utf8>>,
module => <<"move_san"/utf8>>,
function => <<"from_string"/utf8>>,
line => 218}))(
<<"Invalid rank."/utf8>>
)
end,
{ok,
{normal,
{some,
{position_san,
none,
{some, From_rank@2}}},
{position, To_file@4, To_rank@4},
Moving_piece,
Capture,
Promotion,
Check_or_checkmate}};
<<"4"/utf8>> ->
From_rank@2 = case Maybe_from_file_or_from_rank of
<<"1"/utf8>> ->
one;
<<"2"/utf8>> ->
two;
<<"3"/utf8>> ->
three;
<<"4"/utf8>> ->
four;
<<"5"/utf8>> ->
five;
<<"6"/utf8>> ->
six;
<<"7"/utf8>> ->
seven;
<<"8"/utf8>> ->
eight;
_ ->
(erlang:error(#{gleam_error => panic,
message => <<"panic expression evaluated"/utf8>>,
module => <<"move_san"/utf8>>,
function => <<"from_string"/utf8>>,
line => 194}))(
<<"Invalid rank."/utf8>>
)
end,
To_file@4 = case To_file@2 of
<<"a"/utf8>> ->
a;
<<"b"/utf8>> ->
b;
<<"c"/utf8>> ->
c;
<<"d"/utf8>> ->
d;
<<"e"/utf8>> ->
e;
<<"f"/utf8>> ->
f;
<<"g"/utf8>> ->
g;
<<"h"/utf8>> ->
h;
_ ->
(erlang:error(#{gleam_error => panic,
message => <<"panic expression evaluated"/utf8>>,
module => <<"move_san"/utf8>>,
function => <<"from_string"/utf8>>,
line => 206}))(
<<"Invalid file."/utf8>>
)
end,
To_rank@4 = case To_rank@2 of
<<"1"/utf8>> ->
one;
<<"2"/utf8>> ->
two;
<<"3"/utf8>> ->
three;
<<"4"/utf8>> ->
four;
<<"5"/utf8>> ->
five;
<<"6"/utf8>> ->
six;
<<"7"/utf8>> ->
seven;
<<"8"/utf8>> ->
eight;
_ ->
(erlang:error(#{gleam_error => panic,
message => <<"panic expression evaluated"/utf8>>,
module => <<"move_san"/utf8>>,
function => <<"from_string"/utf8>>,
line => 218}))(
<<"Invalid rank."/utf8>>
)
end,
{ok,
{normal,
{some,
{position_san,
none,
{some, From_rank@2}}},
{position, To_file@4, To_rank@4},
Moving_piece,
Capture,
Promotion,
Check_or_checkmate}};
<<"5"/utf8>> ->
From_rank@2 = case Maybe_from_file_or_from_rank of
<<"1"/utf8>> ->
one;
<<"2"/utf8>> ->
two;
<<"3"/utf8>> ->
three;
<<"4"/utf8>> ->
four;
<<"5"/utf8>> ->
five;
<<"6"/utf8>> ->
six;
<<"7"/utf8>> ->
seven;
<<"8"/utf8>> ->
eight;
_ ->
(erlang:error(#{gleam_error => panic,
message => <<"panic expression evaluated"/utf8>>,
module => <<"move_san"/utf8>>,
function => <<"from_string"/utf8>>,
line => 194}))(
<<"Invalid rank."/utf8>>
)
end,
To_file@4 = case To_file@2 of
<<"a"/utf8>> ->
a;
<<"b"/utf8>> ->
b;
<<"c"/utf8>> ->
c;
<<"d"/utf8>> ->
d;
<<"e"/utf8>> ->
e;
<<"f"/utf8>> ->
f;
<<"g"/utf8>> ->
g;
<<"h"/utf8>> ->
h;
_ ->
(erlang:error(#{gleam_error => panic,
message => <<"panic expression evaluated"/utf8>>,
module => <<"move_san"/utf8>>,
function => <<"from_string"/utf8>>,
line => 206}))(
<<"Invalid file."/utf8>>
)
end,
To_rank@4 = case To_rank@2 of
<<"1"/utf8>> ->
one;
<<"2"/utf8>> ->
two;
<<"3"/utf8>> ->
three;
<<"4"/utf8>> ->
four;
<<"5"/utf8>> ->
five;
<<"6"/utf8>> ->
six;
<<"7"/utf8>> ->
seven;
<<"8"/utf8>> ->
eight;
_ ->
(erlang:error(#{gleam_error => panic,
message => <<"panic expression evaluated"/utf8>>,
module => <<"move_san"/utf8>>,
function => <<"from_string"/utf8>>,
line => 218}))(
<<"Invalid rank."/utf8>>
)
end,
{ok,
{normal,
{some,
{position_san,
none,
{some, From_rank@2}}},
{position, To_file@4, To_rank@4},
Moving_piece,
Capture,
Promotion,
Check_or_checkmate}};
<<"6"/utf8>> ->
From_rank@2 = case Maybe_from_file_or_from_rank of
<<"1"/utf8>> ->
one;
<<"2"/utf8>> ->
two;
<<"3"/utf8>> ->
three;
<<"4"/utf8>> ->
four;
<<"5"/utf8>> ->
five;
<<"6"/utf8>> ->
six;
<<"7"/utf8>> ->
seven;
<<"8"/utf8>> ->
eight;
_ ->
(erlang:error(#{gleam_error => panic,
message => <<"panic expression evaluated"/utf8>>,
module => <<"move_san"/utf8>>,
function => <<"from_string"/utf8>>,
line => 194}))(
<<"Invalid rank."/utf8>>
)
end,
To_file@4 = case To_file@2 of
<<"a"/utf8>> ->
a;
<<"b"/utf8>> ->
b;
<<"c"/utf8>> ->
c;
<<"d"/utf8>> ->
d;
<<"e"/utf8>> ->
e;
<<"f"/utf8>> ->
f;
<<"g"/utf8>> ->
g;
<<"h"/utf8>> ->
h;
_ ->
(erlang:error(#{gleam_error => panic,
message => <<"panic expression evaluated"/utf8>>,
module => <<"move_san"/utf8>>,
function => <<"from_string"/utf8>>,
line => 206}))(
<<"Invalid file."/utf8>>
)
end,
To_rank@4 = case To_rank@2 of
<<"1"/utf8>> ->
one;
<<"2"/utf8>> ->
two;
<<"3"/utf8>> ->
three;
<<"4"/utf8>> ->
four;
<<"5"/utf8>> ->
five;
<<"6"/utf8>> ->
six;
<<"7"/utf8>> ->
seven;
<<"8"/utf8>> ->
eight;
_ ->
(erlang:error(#{gleam_error => panic,
message => <<"panic expression evaluated"/utf8>>,
module => <<"move_san"/utf8>>,
function => <<"from_string"/utf8>>,
line => 218}))(
<<"Invalid rank."/utf8>>
)
end,
{ok,
{normal,
{some,
{position_san,
none,
{some, From_rank@2}}},
{position, To_file@4, To_rank@4},
Moving_piece,
Capture,
Promotion,
Check_or_checkmate}};
<<"7"/utf8>> ->
From_rank@2 = case Maybe_from_file_or_from_rank of
<<"1"/utf8>> ->
one;
<<"2"/utf8>> ->
two;
<<"3"/utf8>> ->
three;
<<"4"/utf8>> ->
four;
<<"5"/utf8>> ->
five;
<<"6"/utf8>> ->
six;
<<"7"/utf8>> ->
seven;
<<"8"/utf8>> ->
eight;
_ ->
(erlang:error(#{gleam_error => panic,
message => <<"panic expression evaluated"/utf8>>,
module => <<"move_san"/utf8>>,
function => <<"from_string"/utf8>>,
line => 194}))(
<<"Invalid rank."/utf8>>
)
end,
To_file@4 = case To_file@2 of
<<"a"/utf8>> ->
a;
<<"b"/utf8>> ->
b;
<<"c"/utf8>> ->
c;
<<"d"/utf8>> ->
d;
<<"e"/utf8>> ->
e;
<<"f"/utf8>> ->
f;
<<"g"/utf8>> ->
g;
<<"h"/utf8>> ->
h;
_ ->
(erlang:error(#{gleam_error => panic,
message => <<"panic expression evaluated"/utf8>>,
module => <<"move_san"/utf8>>,
function => <<"from_string"/utf8>>,
line => 206}))(
<<"Invalid file."/utf8>>
)
end,
To_rank@4 = case To_rank@2 of
<<"1"/utf8>> ->
one;
<<"2"/utf8>> ->
two;
<<"3"/utf8>> ->
three;
<<"4"/utf8>> ->
four;
<<"5"/utf8>> ->
five;
<<"6"/utf8>> ->
six;
<<"7"/utf8>> ->
seven;
<<"8"/utf8>> ->
eight;
_ ->
(erlang:error(#{gleam_error => panic,
message => <<"panic expression evaluated"/utf8>>,
module => <<"move_san"/utf8>>,
function => <<"from_string"/utf8>>,
line => 218}))(
<<"Invalid rank."/utf8>>
)
end,
{ok,
{normal,
{some,
{position_san,
none,
{some, From_rank@2}}},
{position, To_file@4, To_rank@4},
Moving_piece,
Capture,
Promotion,
Check_or_checkmate}};
<<"8"/utf8>> ->
From_rank@2 = case Maybe_from_file_or_from_rank of
<<"1"/utf8>> ->
one;
<<"2"/utf8>> ->
two;
<<"3"/utf8>> ->
three;
<<"4"/utf8>> ->
four;
<<"5"/utf8>> ->
five;
<<"6"/utf8>> ->
six;
<<"7"/utf8>> ->
seven;
<<"8"/utf8>> ->
eight;
_ ->
(erlang:error(#{gleam_error => panic,
message => <<"panic expression evaluated"/utf8>>,
module => <<"move_san"/utf8>>,
function => <<"from_string"/utf8>>,
line => 194}))(
<<"Invalid rank."/utf8>>
)
end,
To_file@4 = case To_file@2 of
<<"a"/utf8>> ->
a;
<<"b"/utf8>> ->
b;
<<"c"/utf8>> ->
c;
<<"d"/utf8>> ->
d;
<<"e"/utf8>> ->
e;
<<"f"/utf8>> ->
f;
<<"g"/utf8>> ->
g;
<<"h"/utf8>> ->
h;
_ ->
(erlang:error(#{gleam_error => panic,
message => <<"panic expression evaluated"/utf8>>,
module => <<"move_san"/utf8>>,
function => <<"from_string"/utf8>>,
line => 206}))(
<<"Invalid file."/utf8>>
)
end,
To_rank@4 = case To_rank@2 of
<<"1"/utf8>> ->
one;
<<"2"/utf8>> ->
two;
<<"3"/utf8>> ->
three;
<<"4"/utf8>> ->
four;
<<"5"/utf8>> ->
five;
<<"6"/utf8>> ->
six;
<<"7"/utf8>> ->
seven;
<<"8"/utf8>> ->
eight;
_ ->
(erlang:error(#{gleam_error => panic,
message => <<"panic expression evaluated"/utf8>>,
module => <<"move_san"/utf8>>,
function => <<"from_string"/utf8>>,
line => 218}))(
<<"Invalid rank."/utf8>>
)
end,
{ok,
{normal,
{some,
{position_san,
none,
{some, From_rank@2}}},
{position, To_file@4, To_rank@4},
Moving_piece,
Capture,
Promotion,
Check_or_checkmate}};
_ ->
{error, invalid_positional_information}
end;
2 ->
[To_file@5, To_rank@5] = Positional_information,
To_file@6 = case To_file@5 of
<<"a"/utf8>> ->
a;
<<"b"/utf8>> ->
b;
<<"c"/utf8>> ->
c;
<<"d"/utf8>> ->
d;
<<"e"/utf8>> ->
e;
<<"f"/utf8>> ->
f;
<<"g"/utf8>> ->
g;
<<"h"/utf8>> ->
h;
_ ->
(erlang:error(#{gleam_error => panic,
message => <<"panic expression evaluated"/utf8>>,
module => <<"move_san"/utf8>>,
function => <<"from_string"/utf8>>,
line => 244}))(<<"Invalid file."/utf8>>)
end,
To_rank@6 = case To_rank@5 of
<<"1"/utf8>> ->
one;
<<"2"/utf8>> ->
two;
<<"3"/utf8>> ->
three;
<<"4"/utf8>> ->
four;
<<"5"/utf8>> ->
five;
<<"6"/utf8>> ->
six;
<<"7"/utf8>> ->
seven;
<<"8"/utf8>> ->
eight;
_ ->
(erlang:error(#{gleam_error => panic,
message => <<"panic expression evaluated"/utf8>>,
module => <<"move_san"/utf8>>,
function => <<"from_string"/utf8>>,
line => 256}))(<<"Invalid rank."/utf8>>)
end,
{ok,
{normal,
none,
{position, To_file@6, To_rank@6},
Moving_piece,
Capture,
Promotion,
Check_or_checkmate}};
_ ->
{error, invalid_positional_information}
end;
[<<"O"/utf8>> | Rest@1] ->
case Rest@1 of
[<<"-"/utf8>>,
<<"O"/utf8>>,
<<"-"/utf8>>,
<<"O"/utf8>> |
Checks_or_checkmates] ->
case Checks_or_checkmates of
[] ->
{ok, {castle, queen_side, none}};
[<<"+"/utf8>> | _] ->
{ok, {castle, queen_side, {some, check}}};
[<<"#"/utf8>> | _] ->
{ok, {castle, queen_side, {some, check_mate}}}
end;
[<<"-"/utf8>>,
<<"0"/utf8>>,
<<"-"/utf8>>,
<<"0"/utf8>> |
Checks_or_checkmates] ->
case Checks_or_checkmates of
[] ->
{ok, {castle, queen_side, none}};
[<<"+"/utf8>> | _] ->
{ok, {castle, queen_side, {some, check}}};
[<<"#"/utf8>> | _] ->
{ok, {castle, queen_side, {some, check_mate}}}
end;
[<<"-"/utf8>>, <<"O"/utf8>> | Checks_or_checkmates@1] ->
case Checks_or_checkmates@1 of
[] ->
{ok, {castle, king_side, none}};
[<<"+"/utf8>> | _] ->
{ok, {castle, king_side, {some, check}}};
[<<"#"/utf8>> | _] ->
{ok, {castle, king_side, {some, check_mate}}}
end;
[<<"-"/utf8>>, <<"0"/utf8>> | Checks_or_checkmates@1] ->
case Checks_or_checkmates@1 of
[] ->
{ok, {castle, king_side, none}};
[<<"+"/utf8>> | _] ->
{ok, {castle, king_side, {some, check}}};
[<<"#"/utf8>> | _] ->
{ok, {castle, king_side, {some, check_mate}}}
end;
_ ->
{error, invalid_castle_string}
end;
[<<"0"/utf8>> | Rest@1] ->
case Rest@1 of
[<<"-"/utf8>>,
<<"O"/utf8>>,
<<"-"/utf8>>,
<<"O"/utf8>> |
Checks_or_checkmates] ->
case Checks_or_checkmates of
[] ->
{ok, {castle, queen_side, none}};
[<<"+"/utf8>> | _] ->
{ok, {castle, queen_side, {some, check}}};
[<<"#"/utf8>> | _] ->
{ok, {castle, queen_side, {some, check_mate}}}
end;
[<<"-"/utf8>>,
<<"0"/utf8>>,
<<"-"/utf8>>,
<<"0"/utf8>> |
Checks_or_checkmates] ->
case Checks_or_checkmates of
[] ->
{ok, {castle, queen_side, none}};
[<<"+"/utf8>> | _] ->
{ok, {castle, queen_side, {some, check}}};
[<<"#"/utf8>> | _] ->
{ok, {castle, queen_side, {some, check_mate}}}
end;
[<<"-"/utf8>>, <<"O"/utf8>> | Checks_or_checkmates@1] ->
case Checks_or_checkmates@1 of
[] ->
{ok, {castle, king_side, none}};
[<<"+"/utf8>> | _] ->
{ok, {castle, king_side, {some, check}}};
[<<"#"/utf8>> | _] ->
{ok, {castle, king_side, {some, check_mate}}}
end;
[<<"-"/utf8>>, <<"0"/utf8>> | Checks_or_checkmates@1] ->
case Checks_or_checkmates@1 of
[] ->
{ok, {castle, king_side, none}};
[<<"+"/utf8>> | _] ->
{ok, {castle, king_side, {some, check}}};
[<<"#"/utf8>> | _] ->
{ok, {castle, king_side, {some, check_mate}}}
end;
_ ->
{error, invalid_castle_string}
end;
[Pawn_move_first_grapheme | Rest@2] when (((((((Pawn_move_first_grapheme =:= <<"a"/utf8>>) orelse (Pawn_move_first_grapheme =:= <<"b"/utf8>>)) orelse (Pawn_move_first_grapheme =:= <<"c"/utf8>>)) orelse (Pawn_move_first_grapheme =:= <<"d"/utf8>>)) orelse (Pawn_move_first_grapheme =:= <<"e"/utf8>>)) orelse (Pawn_move_first_grapheme =:= <<"f"/utf8>>)) orelse (Pawn_move_first_grapheme =:= <<"g"/utf8>>)) orelse (Pawn_move_first_grapheme =:= <<"h"/utf8>>) ->
Is_en_passant = gleam@string:contains(
gleam@string_builder:to_string(
gleam@string_builder:from_strings(Rest@2)
),
<<"e.p."/utf8>>
),
Rest@3 = gleam@string:replace(
gleam@string_builder:to_string(
gleam@string_builder:from_strings(Rest@2)
),
<<"e.p."/utf8>>,
<<""/utf8>>
),
Rest@4 = gleam@string:trim(Rest@3),
Rest@5 = gleam@string:to_graphemes(Rest@4),
Capture@1 = gleam@list:contains(Rest@5, <<"x"/utf8>>),
Rest@6 = gleam@list:filter(
Rest@5,
fun(Grapheme@1) -> Grapheme@1 /= <<"x"/utf8>> end
),
{Promotion_segment, Rest@7} = gleam@list:partition(
[Pawn_move_first_grapheme | Rest@6],
fun(Grapheme@2) -> case Grapheme@2 of
<<"="/utf8>> ->
true;
<<"Q"/utf8>> ->
true;
<<"R"/utf8>> ->
true;
<<"B"/utf8>> ->
true;
<<"N"/utf8>> ->
true;
_ ->
false
end end
),
Promotion@1 = case Promotion_segment of
[] ->
none;
[<<"="/utf8>>, <<"Q"/utf8>> | _] ->
{some, queen};
[<<"="/utf8>>, <<"R"/utf8>> | _] ->
{some, rook};
[<<"="/utf8>>, <<"B"/utf8>> | _] ->
{some, bishop};
[<<"="/utf8>>, <<"N"/utf8>> | _] ->
{some, knight}
end,
Maybe_check_or_checkmate = case gleam@list:last(Rest@7) of
{ok, <<"+"/utf8>>} ->
{some, check};
{ok, <<"#"/utf8>>} ->
{some, check_mate};
_ ->
none
end,
Positional_information@1 = gleam@list:filter(
Rest@7,
fun(Grapheme@3) ->
(Grapheme@3 /= <<"+"/utf8>>) andalso (Grapheme@3 /= <<"#"/utf8>>)
end
),
case gleam@list:length(Positional_information@1) of
4 ->
[From_file@3, From_rank@3, To_file@7, To_rank@7] = Positional_information@1,
From_file@4 = case From_file@3 of
<<"a"/utf8>> ->
a;
<<"b"/utf8>> ->
b;
<<"c"/utf8>> ->
c;
<<"d"/utf8>> ->
d;
<<"e"/utf8>> ->
e;
<<"f"/utf8>> ->
f;
<<"g"/utf8>> ->
g;
<<"h"/utf8>> ->
h;
_ ->
(erlang:error(#{gleam_error => panic,
message => <<"panic expression evaluated"/utf8>>,
module => <<"move_san"/utf8>>,
function => <<"from_string"/utf8>>,
line => 373}))(<<"Invalid file."/utf8>>)
end,
From_rank@4 = case From_rank@3 of
<<"1"/utf8>> ->
one;
<<"2"/utf8>> ->
two;
<<"3"/utf8>> ->
three;
<<"4"/utf8>> ->
four;
<<"5"/utf8>> ->
five;
<<"6"/utf8>> ->
six;
<<"7"/utf8>> ->
seven;
<<"8"/utf8>> ->
eight;
_ ->
(erlang:error(#{gleam_error => panic,
message => <<"panic expression evaluated"/utf8>>,
module => <<"move_san"/utf8>>,
function => <<"from_string"/utf8>>,
line => 385}))(<<"Invalid rank."/utf8>>)
end,
To_file@8 = case To_file@7 of
<<"a"/utf8>> ->
a;
<<"b"/utf8>> ->
b;
<<"c"/utf8>> ->
c;
<<"d"/utf8>> ->
d;
<<"e"/utf8>> ->
e;
<<"f"/utf8>> ->
f;
<<"g"/utf8>> ->
g;
<<"h"/utf8>> ->
h;
_ ->
(erlang:error(#{gleam_error => panic,
message => <<"panic expression evaluated"/utf8>>,
module => <<"move_san"/utf8>>,
function => <<"from_string"/utf8>>,
line => 397}))(<<"Invalid file."/utf8>>)
end,
To_rank@8 = case To_rank@7 of
<<"1"/utf8>> ->
one;
<<"2"/utf8>> ->
two;
<<"3"/utf8>> ->
three;
<<"4"/utf8>> ->
four;
<<"5"/utf8>> ->
five;
<<"6"/utf8>> ->
six;
<<"7"/utf8>> ->
seven;
<<"8"/utf8>> ->
eight;
_ ->
(erlang:error(#{gleam_error => panic,
message => <<"panic expression evaluated"/utf8>>,
module => <<"move_san"/utf8>>,
function => <<"from_string"/utf8>>,
line => 409}))(<<"Invalid rank."/utf8>>)
end,
case Is_en_passant of
true ->
{ok,
{en_passant,
{some,
{position_san,
{some, From_file@4},
{some, From_rank@4}}},
{position, To_file@8, To_rank@8},
Maybe_check_or_checkmate}};
false ->
{ok,
{normal,
{some,
{position_san,
{some, From_file@4},
{some, From_rank@4}}},
{position, To_file@8, To_rank@8},
pawn,
Capture@1,
Promotion@1,
Maybe_check_or_checkmate}}
end;
3 ->
[Maybe_from_file_or_from_rank@1, To_file@9, To_rank@9] = Positional_information@1,
case Maybe_from_file_or_from_rank@1 of
<<"a"/utf8>> ->
From_file@5 = case Maybe_from_file_or_from_rank@1 of
<<"a"/utf8>> ->
a;
<<"b"/utf8>> ->
b;
<<"c"/utf8>> ->
c;
<<"d"/utf8>> ->
d;
<<"e"/utf8>> ->
e;
<<"f"/utf8>> ->
f;
<<"g"/utf8>> ->
g;
<<"h"/utf8>> ->
h;
_ ->
(erlang:error(#{gleam_error => panic,
message => <<"panic expression evaluated"/utf8>>,
module => <<"move_san"/utf8>>,
function => <<"from_string"/utf8>>,
line => 452}))(
<<"Invalid file"/utf8>>
)
end,
To_file@10 = case To_file@9 of
<<"a"/utf8>> ->
a;
<<"b"/utf8>> ->
b;
<<"c"/utf8>> ->
c;
<<"d"/utf8>> ->
d;
<<"e"/utf8>> ->
e;
<<"f"/utf8>> ->
f;
<<"g"/utf8>> ->
g;
<<"h"/utf8>> ->
h;
_ ->
(erlang:error(#{gleam_error => panic,
message => <<"panic expression evaluated"/utf8>>,
module => <<"move_san"/utf8>>,
function => <<"from_string"/utf8>>,
line => 464}))(
<<"Invalid file."/utf8>>
)
end,
To_rank@10 = case To_rank@9 of
<<"1"/utf8>> ->
one;
<<"2"/utf8>> ->
two;
<<"3"/utf8>> ->
three;
<<"4"/utf8>> ->
four;
<<"5"/utf8>> ->
five;
<<"6"/utf8>> ->
six;
<<"7"/utf8>> ->
seven;
<<"8"/utf8>> ->
eight;
_ ->
(erlang:error(#{gleam_error => panic,
message => <<"panic expression evaluated"/utf8>>,
module => <<"move_san"/utf8>>,
function => <<"from_string"/utf8>>,
line => 476}))(
<<"Invalid rank."/utf8>>
)
end,
case Is_en_passant of
true ->
{ok,
{en_passant,
{some,
{position_san,
{some, From_file@5},
none}},
{position, To_file@10, To_rank@10},
Maybe_check_or_checkmate}};
false ->
{ok,
{normal,
{some,
{position_san,
{some, From_file@5},
none}},
{position, To_file@10, To_rank@10},
pawn,
Capture@1,
Promotion@1,
Maybe_check_or_checkmate}}
end;
<<"b"/utf8>> ->
From_file@5 = case Maybe_from_file_or_from_rank@1 of
<<"a"/utf8>> ->
a;
<<"b"/utf8>> ->
b;
<<"c"/utf8>> ->
c;
<<"d"/utf8>> ->
d;
<<"e"/utf8>> ->
e;
<<"f"/utf8>> ->
f;
<<"g"/utf8>> ->
g;
<<"h"/utf8>> ->
h;
_ ->
(erlang:error(#{gleam_error => panic,
message => <<"panic expression evaluated"/utf8>>,
module => <<"move_san"/utf8>>,
function => <<"from_string"/utf8>>,
line => 452}))(
<<"Invalid file"/utf8>>
)
end,
To_file@10 = case To_file@9 of
<<"a"/utf8>> ->
a;
<<"b"/utf8>> ->
b;
<<"c"/utf8>> ->
c;
<<"d"/utf8>> ->
d;
<<"e"/utf8>> ->
e;
<<"f"/utf8>> ->
f;
<<"g"/utf8>> ->
g;
<<"h"/utf8>> ->
h;
_ ->
(erlang:error(#{gleam_error => panic,
message => <<"panic expression evaluated"/utf8>>,
module => <<"move_san"/utf8>>,
function => <<"from_string"/utf8>>,
line => 464}))(
<<"Invalid file."/utf8>>
)
end,
To_rank@10 = case To_rank@9 of
<<"1"/utf8>> ->
one;
<<"2"/utf8>> ->
two;
<<"3"/utf8>> ->
three;
<<"4"/utf8>> ->
four;
<<"5"/utf8>> ->
five;
<<"6"/utf8>> ->
six;
<<"7"/utf8>> ->
seven;
<<"8"/utf8>> ->
eight;
_ ->
(erlang:error(#{gleam_error => panic,
message => <<"panic expression evaluated"/utf8>>,
module => <<"move_san"/utf8>>,
function => <<"from_string"/utf8>>,
line => 476}))(
<<"Invalid rank."/utf8>>
)
end,
case Is_en_passant of
true ->
{ok,
{en_passant,
{some,
{position_san,
{some, From_file@5},
none}},
{position, To_file@10, To_rank@10},
Maybe_check_or_checkmate}};
false ->
{ok,
{normal,
{some,
{position_san,
{some, From_file@5},
none}},
{position, To_file@10, To_rank@10},
pawn,
Capture@1,
Promotion@1,
Maybe_check_or_checkmate}}
end;
<<"c"/utf8>> ->
From_file@5 = case Maybe_from_file_or_from_rank@1 of
<<"a"/utf8>> ->
a;
<<"b"/utf8>> ->
b;
<<"c"/utf8>> ->
c;
<<"d"/utf8>> ->
d;
<<"e"/utf8>> ->
e;
<<"f"/utf8>> ->
f;
<<"g"/utf8>> ->
g;
<<"h"/utf8>> ->
h;
_ ->
(erlang:error(#{gleam_error => panic,
message => <<"panic expression evaluated"/utf8>>,
module => <<"move_san"/utf8>>,
function => <<"from_string"/utf8>>,
line => 452}))(
<<"Invalid file"/utf8>>
)
end,
To_file@10 = case To_file@9 of
<<"a"/utf8>> ->
a;
<<"b"/utf8>> ->
b;
<<"c"/utf8>> ->
c;
<<"d"/utf8>> ->
d;
<<"e"/utf8>> ->
e;
<<"f"/utf8>> ->
f;
<<"g"/utf8>> ->
g;
<<"h"/utf8>> ->
h;
_ ->
(erlang:error(#{gleam_error => panic,
message => <<"panic expression evaluated"/utf8>>,
module => <<"move_san"/utf8>>,
function => <<"from_string"/utf8>>,
line => 464}))(
<<"Invalid file."/utf8>>
)
end,
To_rank@10 = case To_rank@9 of
<<"1"/utf8>> ->
one;
<<"2"/utf8>> ->
two;
<<"3"/utf8>> ->
three;
<<"4"/utf8>> ->
four;
<<"5"/utf8>> ->
five;
<<"6"/utf8>> ->
six;
<<"7"/utf8>> ->
seven;
<<"8"/utf8>> ->
eight;
_ ->
(erlang:error(#{gleam_error => panic,
message => <<"panic expression evaluated"/utf8>>,
module => <<"move_san"/utf8>>,
function => <<"from_string"/utf8>>,
line => 476}))(
<<"Invalid rank."/utf8>>
)
end,
case Is_en_passant of
true ->
{ok,
{en_passant,
{some,
{position_san,
{some, From_file@5},
none}},
{position, To_file@10, To_rank@10},
Maybe_check_or_checkmate}};
false ->
{ok,
{normal,
{some,
{position_san,
{some, From_file@5},
none}},
{position, To_file@10, To_rank@10},
pawn,
Capture@1,
Promotion@1,
Maybe_check_or_checkmate}}
end;
<<"d"/utf8>> ->
From_file@5 = case Maybe_from_file_or_from_rank@1 of
<<"a"/utf8>> ->
a;
<<"b"/utf8>> ->
b;
<<"c"/utf8>> ->
c;
<<"d"/utf8>> ->
d;
<<"e"/utf8>> ->
e;
<<"f"/utf8>> ->
f;
<<"g"/utf8>> ->
g;
<<"h"/utf8>> ->
h;
_ ->
(erlang:error(#{gleam_error => panic,
message => <<"panic expression evaluated"/utf8>>,
module => <<"move_san"/utf8>>,
function => <<"from_string"/utf8>>,
line => 452}))(
<<"Invalid file"/utf8>>
)
end,
To_file@10 = case To_file@9 of
<<"a"/utf8>> ->
a;
<<"b"/utf8>> ->
b;
<<"c"/utf8>> ->
c;
<<"d"/utf8>> ->
d;
<<"e"/utf8>> ->
e;
<<"f"/utf8>> ->
f;
<<"g"/utf8>> ->
g;
<<"h"/utf8>> ->
h;
_ ->
(erlang:error(#{gleam_error => panic,
message => <<"panic expression evaluated"/utf8>>,
module => <<"move_san"/utf8>>,
function => <<"from_string"/utf8>>,
line => 464}))(
<<"Invalid file."/utf8>>
)
end,
To_rank@10 = case To_rank@9 of
<<"1"/utf8>> ->
one;
<<"2"/utf8>> ->
two;
<<"3"/utf8>> ->
three;
<<"4"/utf8>> ->
four;
<<"5"/utf8>> ->
five;
<<"6"/utf8>> ->
six;
<<"7"/utf8>> ->
seven;
<<"8"/utf8>> ->
eight;
_ ->
(erlang:error(#{gleam_error => panic,
message => <<"panic expression evaluated"/utf8>>,
module => <<"move_san"/utf8>>,
function => <<"from_string"/utf8>>,
line => 476}))(
<<"Invalid rank."/utf8>>
)
end,
case Is_en_passant of
true ->
{ok,
{en_passant,
{some,
{position_san,
{some, From_file@5},
none}},
{position, To_file@10, To_rank@10},
Maybe_check_or_checkmate}};
false ->
{ok,
{normal,
{some,
{position_san,
{some, From_file@5},
none}},
{position, To_file@10, To_rank@10},
pawn,
Capture@1,
Promotion@1,
Maybe_check_or_checkmate}}
end;
<<"e"/utf8>> ->
From_file@5 = case Maybe_from_file_or_from_rank@1 of
<<"a"/utf8>> ->
a;
<<"b"/utf8>> ->
b;
<<"c"/utf8>> ->
c;
<<"d"/utf8>> ->
d;
<<"e"/utf8>> ->
e;
<<"f"/utf8>> ->
f;
<<"g"/utf8>> ->
g;
<<"h"/utf8>> ->
h;
_ ->
(erlang:error(#{gleam_error => panic,
message => <<"panic expression evaluated"/utf8>>,
module => <<"move_san"/utf8>>,
function => <<"from_string"/utf8>>,
line => 452}))(
<<"Invalid file"/utf8>>
)
end,
To_file@10 = case To_file@9 of
<<"a"/utf8>> ->
a;
<<"b"/utf8>> ->
b;
<<"c"/utf8>> ->
c;
<<"d"/utf8>> ->
d;
<<"e"/utf8>> ->
e;
<<"f"/utf8>> ->
f;
<<"g"/utf8>> ->
g;
<<"h"/utf8>> ->
h;
_ ->
(erlang:error(#{gleam_error => panic,
message => <<"panic expression evaluated"/utf8>>,
module => <<"move_san"/utf8>>,
function => <<"from_string"/utf8>>,
line => 464}))(
<<"Invalid file."/utf8>>
)
end,
To_rank@10 = case To_rank@9 of
<<"1"/utf8>> ->
one;
<<"2"/utf8>> ->
two;
<<"3"/utf8>> ->
three;
<<"4"/utf8>> ->
four;
<<"5"/utf8>> ->
five;
<<"6"/utf8>> ->
six;
<<"7"/utf8>> ->
seven;
<<"8"/utf8>> ->
eight;
_ ->
(erlang:error(#{gleam_error => panic,
message => <<"panic expression evaluated"/utf8>>,
module => <<"move_san"/utf8>>,
function => <<"from_string"/utf8>>,
line => 476}))(
<<"Invalid rank."/utf8>>
)
end,
case Is_en_passant of
true ->
{ok,
{en_passant,
{some,
{position_san,
{some, From_file@5},
none}},
{position, To_file@10, To_rank@10},
Maybe_check_or_checkmate}};
false ->
{ok,
{normal,
{some,
{position_san,
{some, From_file@5},
none}},
{position, To_file@10, To_rank@10},
pawn,
Capture@1,
Promotion@1,
Maybe_check_or_checkmate}}
end;
<<"f"/utf8>> ->
From_file@5 = case Maybe_from_file_or_from_rank@1 of
<<"a"/utf8>> ->
a;
<<"b"/utf8>> ->
b;
<<"c"/utf8>> ->
c;
<<"d"/utf8>> ->
d;
<<"e"/utf8>> ->
e;
<<"f"/utf8>> ->
f;
<<"g"/utf8>> ->
g;
<<"h"/utf8>> ->
h;
_ ->
(erlang:error(#{gleam_error => panic,
message => <<"panic expression evaluated"/utf8>>,
module => <<"move_san"/utf8>>,
function => <<"from_string"/utf8>>,
line => 452}))(
<<"Invalid file"/utf8>>
)
end,
To_file@10 = case To_file@9 of
<<"a"/utf8>> ->
a;
<<"b"/utf8>> ->
b;
<<"c"/utf8>> ->
c;
<<"d"/utf8>> ->
d;
<<"e"/utf8>> ->
e;
<<"f"/utf8>> ->
f;
<<"g"/utf8>> ->
g;
<<"h"/utf8>> ->
h;
_ ->
(erlang:error(#{gleam_error => panic,
message => <<"panic expression evaluated"/utf8>>,
module => <<"move_san"/utf8>>,
function => <<"from_string"/utf8>>,
line => 464}))(
<<"Invalid file."/utf8>>
)
end,
To_rank@10 = case To_rank@9 of
<<"1"/utf8>> ->
one;
<<"2"/utf8>> ->
two;
<<"3"/utf8>> ->
three;
<<"4"/utf8>> ->
four;
<<"5"/utf8>> ->
five;
<<"6"/utf8>> ->
six;
<<"7"/utf8>> ->
seven;
<<"8"/utf8>> ->
eight;
_ ->
(erlang:error(#{gleam_error => panic,
message => <<"panic expression evaluated"/utf8>>,
module => <<"move_san"/utf8>>,
function => <<"from_string"/utf8>>,
line => 476}))(
<<"Invalid rank."/utf8>>
)
end,
case Is_en_passant of
true ->
{ok,
{en_passant,
{some,
{position_san,
{some, From_file@5},
none}},
{position, To_file@10, To_rank@10},
Maybe_check_or_checkmate}};
false ->
{ok,
{normal,
{some,
{position_san,
{some, From_file@5},
none}},
{position, To_file@10, To_rank@10},
pawn,
Capture@1,
Promotion@1,
Maybe_check_or_checkmate}}
end;
<<"g"/utf8>> ->
From_file@5 = case Maybe_from_file_or_from_rank@1 of
<<"a"/utf8>> ->
a;
<<"b"/utf8>> ->
b;
<<"c"/utf8>> ->
c;
<<"d"/utf8>> ->
d;
<<"e"/utf8>> ->
e;
<<"f"/utf8>> ->
f;
<<"g"/utf8>> ->
g;
<<"h"/utf8>> ->
h;
_ ->
(erlang:error(#{gleam_error => panic,
message => <<"panic expression evaluated"/utf8>>,
module => <<"move_san"/utf8>>,
function => <<"from_string"/utf8>>,
line => 452}))(
<<"Invalid file"/utf8>>
)
end,
To_file@10 = case To_file@9 of
<<"a"/utf8>> ->
a;
<<"b"/utf8>> ->
b;
<<"c"/utf8>> ->
c;
<<"d"/utf8>> ->
d;
<<"e"/utf8>> ->
e;
<<"f"/utf8>> ->
f;
<<"g"/utf8>> ->
g;
<<"h"/utf8>> ->
h;
_ ->
(erlang:error(#{gleam_error => panic,
message => <<"panic expression evaluated"/utf8>>,
module => <<"move_san"/utf8>>,
function => <<"from_string"/utf8>>,
line => 464}))(
<<"Invalid file."/utf8>>
)
end,
To_rank@10 = case To_rank@9 of
<<"1"/utf8>> ->
one;
<<"2"/utf8>> ->
two;
<<"3"/utf8>> ->
three;
<<"4"/utf8>> ->
four;
<<"5"/utf8>> ->
five;
<<"6"/utf8>> ->
six;
<<"7"/utf8>> ->
seven;
<<"8"/utf8>> ->
eight;
_ ->
(erlang:error(#{gleam_error => panic,
message => <<"panic expression evaluated"/utf8>>,
module => <<"move_san"/utf8>>,
function => <<"from_string"/utf8>>,
line => 476}))(
<<"Invalid rank."/utf8>>
)
end,
case Is_en_passant of
true ->
{ok,
{en_passant,
{some,
{position_san,
{some, From_file@5},
none}},
{position, To_file@10, To_rank@10},
Maybe_check_or_checkmate}};
false ->
{ok,
{normal,
{some,
{position_san,
{some, From_file@5},
none}},
{position, To_file@10, To_rank@10},
pawn,
Capture@1,
Promotion@1,
Maybe_check_or_checkmate}}
end;
<<"h"/utf8>> ->
From_file@5 = case Maybe_from_file_or_from_rank@1 of
<<"a"/utf8>> ->
a;
<<"b"/utf8>> ->
b;
<<"c"/utf8>> ->
c;
<<"d"/utf8>> ->
d;
<<"e"/utf8>> ->
e;
<<"f"/utf8>> ->
f;
<<"g"/utf8>> ->
g;
<<"h"/utf8>> ->
h;
_ ->
(erlang:error(#{gleam_error => panic,
message => <<"panic expression evaluated"/utf8>>,
module => <<"move_san"/utf8>>,
function => <<"from_string"/utf8>>,
line => 452}))(
<<"Invalid file"/utf8>>
)
end,
To_file@10 = case To_file@9 of
<<"a"/utf8>> ->
a;
<<"b"/utf8>> ->
b;
<<"c"/utf8>> ->
c;
<<"d"/utf8>> ->
d;
<<"e"/utf8>> ->
e;
<<"f"/utf8>> ->
f;
<<"g"/utf8>> ->
g;
<<"h"/utf8>> ->
h;
_ ->
(erlang:error(#{gleam_error => panic,
message => <<"panic expression evaluated"/utf8>>,
module => <<"move_san"/utf8>>,
function => <<"from_string"/utf8>>,
line => 464}))(
<<"Invalid file."/utf8>>
)
end,
To_rank@10 = case To_rank@9 of
<<"1"/utf8>> ->
one;
<<"2"/utf8>> ->
two;
<<"3"/utf8>> ->
three;
<<"4"/utf8>> ->
four;
<<"5"/utf8>> ->
five;
<<"6"/utf8>> ->
six;
<<"7"/utf8>> ->
seven;
<<"8"/utf8>> ->
eight;
_ ->
(erlang:error(#{gleam_error => panic,
message => <<"panic expression evaluated"/utf8>>,
module => <<"move_san"/utf8>>,
function => <<"from_string"/utf8>>,
line => 476}))(
<<"Invalid rank."/utf8>>
)
end,
case Is_en_passant of
true ->
{ok,
{en_passant,
{some,
{position_san,
{some, From_file@5},
none}},
{position, To_file@10, To_rank@10},
Maybe_check_or_checkmate}};
false ->
{ok,
{normal,
{some,
{position_san,
{some, From_file@5},
none}},
{position, To_file@10, To_rank@10},
pawn,
Capture@1,
Promotion@1,
Maybe_check_or_checkmate}}
end;
<<"1"/utf8>> ->
From_rank@5 = case Maybe_from_file_or_from_rank@1 of
<<"1"/utf8>> ->
one;
<<"2"/utf8>> ->
two;
<<"3"/utf8>> ->
three;
<<"4"/utf8>> ->
four;
<<"5"/utf8>> ->
five;
<<"6"/utf8>> ->
six;
<<"7"/utf8>> ->
seven;
<<"8"/utf8>> ->
eight;
_ ->
(erlang:error(#{gleam_error => panic,
message => <<"panic expression evaluated"/utf8>>,
module => <<"move_san"/utf8>>,
function => <<"from_string"/utf8>>,
line => 509}))(
<<"Invalid rank."/utf8>>
)
end,
To_file@11 = case To_file@9 of
<<"a"/utf8>> ->
a;
<<"b"/utf8>> ->
b;
<<"c"/utf8>> ->
c;
<<"d"/utf8>> ->
d;
<<"e"/utf8>> ->
e;
<<"f"/utf8>> ->
f;
<<"g"/utf8>> ->
g;
<<"h"/utf8>> ->
h;
_ ->
(erlang:error(#{gleam_error => panic,
message => <<"panic expression evaluated"/utf8>>,
module => <<"move_san"/utf8>>,
function => <<"from_string"/utf8>>,
line => 521}))(
<<"Invalid file."/utf8>>
)
end,
To_rank@11 = case To_rank@9 of
<<"1"/utf8>> ->
one;
<<"2"/utf8>> ->
two;
<<"3"/utf8>> ->
three;
<<"4"/utf8>> ->
four;
<<"5"/utf8>> ->
five;
<<"6"/utf8>> ->
six;
<<"7"/utf8>> ->
seven;
<<"8"/utf8>> ->
eight;
_ ->
(erlang:error(#{gleam_error => panic,
message => <<"panic expression evaluated"/utf8>>,
module => <<"move_san"/utf8>>,
function => <<"from_string"/utf8>>,
line => 533}))(
<<"Invalid rank."/utf8>>
)
end,
case Is_en_passant of
true ->
{ok,
{en_passant,
{some,
{position_san,
none,
{some, From_rank@5}}},
{position, To_file@11, To_rank@11},
Maybe_check_or_checkmate}};
false ->
{ok,
{normal,
{some,
{position_san,
none,
{some, From_rank@5}}},
{position, To_file@11, To_rank@11},
pawn,
Capture@1,
Promotion@1,
Maybe_check_or_checkmate}}
end;
<<"2"/utf8>> ->
From_rank@5 = case Maybe_from_file_or_from_rank@1 of
<<"1"/utf8>> ->
one;
<<"2"/utf8>> ->
two;
<<"3"/utf8>> ->
three;
<<"4"/utf8>> ->
four;
<<"5"/utf8>> ->
five;
<<"6"/utf8>> ->
six;
<<"7"/utf8>> ->
seven;
<<"8"/utf8>> ->
eight;
_ ->
(erlang:error(#{gleam_error => panic,
message => <<"panic expression evaluated"/utf8>>,
module => <<"move_san"/utf8>>,
function => <<"from_string"/utf8>>,
line => 509}))(
<<"Invalid rank."/utf8>>
)
end,
To_file@11 = case To_file@9 of
<<"a"/utf8>> ->
a;
<<"b"/utf8>> ->
b;
<<"c"/utf8>> ->
c;
<<"d"/utf8>> ->
d;
<<"e"/utf8>> ->
e;
<<"f"/utf8>> ->
f;
<<"g"/utf8>> ->
g;
<<"h"/utf8>> ->
h;
_ ->
(erlang:error(#{gleam_error => panic,
message => <<"panic expression evaluated"/utf8>>,
module => <<"move_san"/utf8>>,
function => <<"from_string"/utf8>>,
line => 521}))(
<<"Invalid file."/utf8>>
)
end,
To_rank@11 = case To_rank@9 of
<<"1"/utf8>> ->
one;
<<"2"/utf8>> ->
two;
<<"3"/utf8>> ->
three;
<<"4"/utf8>> ->
four;
<<"5"/utf8>> ->
five;
<<"6"/utf8>> ->
six;
<<"7"/utf8>> ->
seven;
<<"8"/utf8>> ->
eight;
_ ->
(erlang:error(#{gleam_error => panic,
message => <<"panic expression evaluated"/utf8>>,
module => <<"move_san"/utf8>>,
function => <<"from_string"/utf8>>,
line => 533}))(
<<"Invalid rank."/utf8>>
)
end,
case Is_en_passant of
true ->
{ok,
{en_passant,
{some,
{position_san,
none,
{some, From_rank@5}}},
{position, To_file@11, To_rank@11},
Maybe_check_or_checkmate}};
false ->
{ok,
{normal,
{some,
{position_san,
none,
{some, From_rank@5}}},
{position, To_file@11, To_rank@11},
pawn,
Capture@1,
Promotion@1,
Maybe_check_or_checkmate}}
end;
<<"3"/utf8>> ->
From_rank@5 = case Maybe_from_file_or_from_rank@1 of
<<"1"/utf8>> ->
one;
<<"2"/utf8>> ->
two;
<<"3"/utf8>> ->
three;
<<"4"/utf8>> ->
four;
<<"5"/utf8>> ->
five;
<<"6"/utf8>> ->
six;
<<"7"/utf8>> ->
seven;
<<"8"/utf8>> ->
eight;
_ ->
(erlang:error(#{gleam_error => panic,
message => <<"panic expression evaluated"/utf8>>,
module => <<"move_san"/utf8>>,
function => <<"from_string"/utf8>>,
line => 509}))(
<<"Invalid rank."/utf8>>
)
end,
To_file@11 = case To_file@9 of
<<"a"/utf8>> ->
a;
<<"b"/utf8>> ->
b;
<<"c"/utf8>> ->
c;
<<"d"/utf8>> ->
d;
<<"e"/utf8>> ->
e;
<<"f"/utf8>> ->
f;
<<"g"/utf8>> ->
g;
<<"h"/utf8>> ->
h;
_ ->
(erlang:error(#{gleam_error => panic,
message => <<"panic expression evaluated"/utf8>>,
module => <<"move_san"/utf8>>,
function => <<"from_string"/utf8>>,
line => 521}))(
<<"Invalid file."/utf8>>
)
end,
To_rank@11 = case To_rank@9 of
<<"1"/utf8>> ->
one;
<<"2"/utf8>> ->
two;
<<"3"/utf8>> ->
three;
<<"4"/utf8>> ->
four;
<<"5"/utf8>> ->
five;
<<"6"/utf8>> ->
six;
<<"7"/utf8>> ->
seven;
<<"8"/utf8>> ->
eight;
_ ->
(erlang:error(#{gleam_error => panic,
message => <<"panic expression evaluated"/utf8>>,
module => <<"move_san"/utf8>>,
function => <<"from_string"/utf8>>,
line => 533}))(
<<"Invalid rank."/utf8>>
)
end,
case Is_en_passant of
true ->
{ok,
{en_passant,
{some,
{position_san,
none,
{some, From_rank@5}}},
{position, To_file@11, To_rank@11},
Maybe_check_or_checkmate}};
false ->
{ok,
{normal,
{some,
{position_san,
none,
{some, From_rank@5}}},
{position, To_file@11, To_rank@11},
pawn,
Capture@1,
Promotion@1,
Maybe_check_or_checkmate}}
end;
<<"4"/utf8>> ->
From_rank@5 = case Maybe_from_file_or_from_rank@1 of
<<"1"/utf8>> ->
one;
<<"2"/utf8>> ->
two;
<<"3"/utf8>> ->
three;
<<"4"/utf8>> ->
four;
<<"5"/utf8>> ->
five;
<<"6"/utf8>> ->
six;
<<"7"/utf8>> ->
seven;
<<"8"/utf8>> ->
eight;
_ ->
(erlang:error(#{gleam_error => panic,
message => <<"panic expression evaluated"/utf8>>,
module => <<"move_san"/utf8>>,
function => <<"from_string"/utf8>>,
line => 509}))(
<<"Invalid rank."/utf8>>
)
end,
To_file@11 = case To_file@9 of
<<"a"/utf8>> ->
a;
<<"b"/utf8>> ->
b;
<<"c"/utf8>> ->
c;
<<"d"/utf8>> ->
d;
<<"e"/utf8>> ->
e;
<<"f"/utf8>> ->
f;
<<"g"/utf8>> ->
g;
<<"h"/utf8>> ->
h;
_ ->
(erlang:error(#{gleam_error => panic,
message => <<"panic expression evaluated"/utf8>>,
module => <<"move_san"/utf8>>,
function => <<"from_string"/utf8>>,
line => 521}))(
<<"Invalid file."/utf8>>
)
end,
To_rank@11 = case To_rank@9 of
<<"1"/utf8>> ->
one;
<<"2"/utf8>> ->
two;
<<"3"/utf8>> ->
three;
<<"4"/utf8>> ->
four;
<<"5"/utf8>> ->
five;
<<"6"/utf8>> ->
six;
<<"7"/utf8>> ->
seven;
<<"8"/utf8>> ->
eight;
_ ->
(erlang:error(#{gleam_error => panic,
message => <<"panic expression evaluated"/utf8>>,
module => <<"move_san"/utf8>>,
function => <<"from_string"/utf8>>,
line => 533}))(
<<"Invalid rank."/utf8>>
)
end,
case Is_en_passant of
true ->
{ok,
{en_passant,
{some,
{position_san,
none,
{some, From_rank@5}}},
{position, To_file@11, To_rank@11},
Maybe_check_or_checkmate}};
false ->
{ok,
{normal,
{some,
{position_san,
none,
{some, From_rank@5}}},
{position, To_file@11, To_rank@11},
pawn,
Capture@1,
Promotion@1,
Maybe_check_or_checkmate}}
end;
<<"5"/utf8>> ->
From_rank@5 = case Maybe_from_file_or_from_rank@1 of
<<"1"/utf8>> ->
one;
<<"2"/utf8>> ->
two;
<<"3"/utf8>> ->
three;
<<"4"/utf8>> ->
four;
<<"5"/utf8>> ->
five;
<<"6"/utf8>> ->
six;
<<"7"/utf8>> ->
seven;
<<"8"/utf8>> ->
eight;
_ ->
(erlang:error(#{gleam_error => panic,
message => <<"panic expression evaluated"/utf8>>,
module => <<"move_san"/utf8>>,
function => <<"from_string"/utf8>>,
line => 509}))(
<<"Invalid rank."/utf8>>
)
end,
To_file@11 = case To_file@9 of
<<"a"/utf8>> ->
a;
<<"b"/utf8>> ->
b;
<<"c"/utf8>> ->
c;
<<"d"/utf8>> ->
d;
<<"e"/utf8>> ->
e;
<<"f"/utf8>> ->
f;
<<"g"/utf8>> ->
g;
<<"h"/utf8>> ->
h;
_ ->
(erlang:error(#{gleam_error => panic,
message => <<"panic expression evaluated"/utf8>>,
module => <<"move_san"/utf8>>,
function => <<"from_string"/utf8>>,
line => 521}))(
<<"Invalid file."/utf8>>
)
end,
To_rank@11 = case To_rank@9 of
<<"1"/utf8>> ->
one;
<<"2"/utf8>> ->
two;
<<"3"/utf8>> ->
three;
<<"4"/utf8>> ->
four;
<<"5"/utf8>> ->
five;
<<"6"/utf8>> ->
six;
<<"7"/utf8>> ->
seven;
<<"8"/utf8>> ->
eight;
_ ->
(erlang:error(#{gleam_error => panic,
message => <<"panic expression evaluated"/utf8>>,
module => <<"move_san"/utf8>>,
function => <<"from_string"/utf8>>,
line => 533}))(
<<"Invalid rank."/utf8>>
)
end,
case Is_en_passant of
true ->
{ok,
{en_passant,
{some,
{position_san,
none,
{some, From_rank@5}}},
{position, To_file@11, To_rank@11},
Maybe_check_or_checkmate}};
false ->
{ok,
{normal,
{some,
{position_san,
none,
{some, From_rank@5}}},
{position, To_file@11, To_rank@11},
pawn,
Capture@1,
Promotion@1,
Maybe_check_or_checkmate}}
end;
<<"6"/utf8>> ->
From_rank@5 = case Maybe_from_file_or_from_rank@1 of
<<"1"/utf8>> ->
one;
<<"2"/utf8>> ->
two;
<<"3"/utf8>> ->
three;
<<"4"/utf8>> ->
four;
<<"5"/utf8>> ->
five;
<<"6"/utf8>> ->
six;
<<"7"/utf8>> ->
seven;
<<"8"/utf8>> ->
eight;
_ ->
(erlang:error(#{gleam_error => panic,
message => <<"panic expression evaluated"/utf8>>,
module => <<"move_san"/utf8>>,
function => <<"from_string"/utf8>>,
line => 509}))(
<<"Invalid rank."/utf8>>
)
end,
To_file@11 = case To_file@9 of
<<"a"/utf8>> ->
a;
<<"b"/utf8>> ->
b;
<<"c"/utf8>> ->
c;
<<"d"/utf8>> ->
d;
<<"e"/utf8>> ->
e;
<<"f"/utf8>> ->
f;
<<"g"/utf8>> ->
g;
<<"h"/utf8>> ->
h;
_ ->
(erlang:error(#{gleam_error => panic,
message => <<"panic expression evaluated"/utf8>>,
module => <<"move_san"/utf8>>,
function => <<"from_string"/utf8>>,
line => 521}))(
<<"Invalid file."/utf8>>
)
end,
To_rank@11 = case To_rank@9 of
<<"1"/utf8>> ->
one;
<<"2"/utf8>> ->
two;
<<"3"/utf8>> ->
three;
<<"4"/utf8>> ->
four;
<<"5"/utf8>> ->
five;
<<"6"/utf8>> ->
six;
<<"7"/utf8>> ->
seven;
<<"8"/utf8>> ->
eight;
_ ->
(erlang:error(#{gleam_error => panic,
message => <<"panic expression evaluated"/utf8>>,
module => <<"move_san"/utf8>>,
function => <<"from_string"/utf8>>,
line => 533}))(
<<"Invalid rank."/utf8>>
)
end,
case Is_en_passant of
true ->
{ok,
{en_passant,
{some,
{position_san,
none,
{some, From_rank@5}}},
{position, To_file@11, To_rank@11},
Maybe_check_or_checkmate}};
false ->
{ok,
{normal,
{some,
{position_san,
none,
{some, From_rank@5}}},
{position, To_file@11, To_rank@11},
pawn,
Capture@1,
Promotion@1,
Maybe_check_or_checkmate}}
end;
<<"7"/utf8>> ->
From_rank@5 = case Maybe_from_file_or_from_rank@1 of
<<"1"/utf8>> ->
one;
<<"2"/utf8>> ->
two;
<<"3"/utf8>> ->
three;
<<"4"/utf8>> ->
four;
<<"5"/utf8>> ->
five;
<<"6"/utf8>> ->
six;
<<"7"/utf8>> ->
seven;
<<"8"/utf8>> ->
eight;
_ ->
(erlang:error(#{gleam_error => panic,
message => <<"panic expression evaluated"/utf8>>,
module => <<"move_san"/utf8>>,
function => <<"from_string"/utf8>>,
line => 509}))(
<<"Invalid rank."/utf8>>
)
end,
To_file@11 = case To_file@9 of
<<"a"/utf8>> ->
a;
<<"b"/utf8>> ->
b;
<<"c"/utf8>> ->
c;
<<"d"/utf8>> ->
d;
<<"e"/utf8>> ->
e;
<<"f"/utf8>> ->
f;
<<"g"/utf8>> ->
g;
<<"h"/utf8>> ->
h;
_ ->
(erlang:error(#{gleam_error => panic,
message => <<"panic expression evaluated"/utf8>>,
module => <<"move_san"/utf8>>,
function => <<"from_string"/utf8>>,
line => 521}))(
<<"Invalid file."/utf8>>
)
end,
To_rank@11 = case To_rank@9 of
<<"1"/utf8>> ->
one;
<<"2"/utf8>> ->
two;
<<"3"/utf8>> ->
three;
<<"4"/utf8>> ->
four;
<<"5"/utf8>> ->
five;
<<"6"/utf8>> ->
six;
<<"7"/utf8>> ->
seven;
<<"8"/utf8>> ->
eight;
_ ->
(erlang:error(#{gleam_error => panic,
message => <<"panic expression evaluated"/utf8>>,
module => <<"move_san"/utf8>>,
function => <<"from_string"/utf8>>,
line => 533}))(
<<"Invalid rank."/utf8>>
)
end,
case Is_en_passant of
true ->
{ok,
{en_passant,
{some,
{position_san,
none,
{some, From_rank@5}}},
{position, To_file@11, To_rank@11},
Maybe_check_or_checkmate}};
false ->
{ok,
{normal,
{some,
{position_san,
none,
{some, From_rank@5}}},
{position, To_file@11, To_rank@11},
pawn,
Capture@1,
Promotion@1,
Maybe_check_or_checkmate}}
end;
<<"8"/utf8>> ->
From_rank@5 = case Maybe_from_file_or_from_rank@1 of
<<"1"/utf8>> ->
one;
<<"2"/utf8>> ->
two;
<<"3"/utf8>> ->
three;
<<"4"/utf8>> ->
four;
<<"5"/utf8>> ->
five;
<<"6"/utf8>> ->
six;
<<"7"/utf8>> ->
seven;
<<"8"/utf8>> ->
eight;
_ ->
(erlang:error(#{gleam_error => panic,
message => <<"panic expression evaluated"/utf8>>,
module => <<"move_san"/utf8>>,
function => <<"from_string"/utf8>>,
line => 509}))(
<<"Invalid rank."/utf8>>
)
end,
To_file@11 = case To_file@9 of
<<"a"/utf8>> ->
a;
<<"b"/utf8>> ->
b;
<<"c"/utf8>> ->
c;
<<"d"/utf8>> ->
d;
<<"e"/utf8>> ->
e;
<<"f"/utf8>> ->
f;
<<"g"/utf8>> ->
g;
<<"h"/utf8>> ->
h;
_ ->
(erlang:error(#{gleam_error => panic,
message => <<"panic expression evaluated"/utf8>>,
module => <<"move_san"/utf8>>,
function => <<"from_string"/utf8>>,
line => 521}))(
<<"Invalid file."/utf8>>
)
end,
To_rank@11 = case To_rank@9 of
<<"1"/utf8>> ->
one;
<<"2"/utf8>> ->
two;
<<"3"/utf8>> ->
three;
<<"4"/utf8>> ->
four;
<<"5"/utf8>> ->
five;
<<"6"/utf8>> ->
six;
<<"7"/utf8>> ->
seven;
<<"8"/utf8>> ->
eight;
_ ->
(erlang:error(#{gleam_error => panic,
message => <<"panic expression evaluated"/utf8>>,
module => <<"move_san"/utf8>>,
function => <<"from_string"/utf8>>,
line => 533}))(
<<"Invalid rank."/utf8>>
)
end,
case Is_en_passant of
true ->
{ok,
{en_passant,
{some,
{position_san,
none,
{some, From_rank@5}}},
{position, To_file@11, To_rank@11},
Maybe_check_or_checkmate}};
false ->
{ok,
{normal,
{some,
{position_san,
none,
{some, From_rank@5}}},
{position, To_file@11, To_rank@11},
pawn,
Capture@1,
Promotion@1,
Maybe_check_or_checkmate}}
end;
_ ->
{error, invalid_positional_information}
end;
2 ->
[To_file@12, To_rank@12] = Positional_information@1,
To_file@13 = case To_file@12 of
<<"a"/utf8>> ->
a;
<<"b"/utf8>> ->
b;
<<"c"/utf8>> ->
c;
<<"d"/utf8>> ->
d;
<<"e"/utf8>> ->
e;
<<"f"/utf8>> ->
f;
<<"g"/utf8>> ->
g;
<<"h"/utf8>> ->
h;
_ ->
(erlang:error(#{gleam_error => panic,
message => <<"panic expression evaluated"/utf8>>,
module => <<"move_san"/utf8>>,
function => <<"from_string"/utf8>>,
line => 570}))(<<"Invalid file."/utf8>>)
end,
To_rank@13 = case To_rank@12 of
<<"1"/utf8>> ->
one;
<<"2"/utf8>> ->
two;
<<"3"/utf8>> ->
three;
<<"4"/utf8>> ->
four;
<<"5"/utf8>> ->
five;
<<"6"/utf8>> ->
six;
<<"7"/utf8>> ->
seven;
<<"8"/utf8>> ->
eight;
_ ->
(erlang:error(#{gleam_error => panic,
message => <<"panic expression evaluated"/utf8>>,
module => <<"move_san"/utf8>>,
function => <<"from_string"/utf8>>,
line => 582}))(<<"Invalid rank."/utf8>>)
end,
case Is_en_passant of
true ->
{ok,
{en_passant,
none,
{position, To_file@13, To_rank@13},
Maybe_check_or_checkmate}};
false ->
{ok,
{normal,
none,
{position, To_file@13, To_rank@13},
pawn,
Capture@1,
Promotion@1,
Maybe_check_or_checkmate}}
end
end;
_ ->
{error, invalid_move_string}
end.