-module(move_san). -compile([no_auto_import, nowarn_unused_vars, nowarn_unused_function, nowarn_nomatch]). -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 => <<"Cannot parse empty string."/utf8>>, module => <<"move_san"/utf8>>, function => <<"from_string"/utf8>>, line => 47}); [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 => <<"Invalid piece letter."/utf8>>, module => <<"move_san"/utf8>>, function => <<"from_string"/utf8>>, line => 65}) 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] = case Positional_information of [_, _, _, _] -> Positional_information; _assert_fail -> erlang:error(#{gleam_error => let_assert, message => <<"Assertion pattern match failed"/utf8>>, value => _assert_fail, module => <<"move_san"/utf8>>, function => <<"from_string"/utf8>>, line => 79}) end, 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 => <<"Invalid file."/utf8>>, module => <<"move_san"/utf8>>, function => <<"from_string"/utf8>>, line => 90}) 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 => <<"Invalid rank."/utf8>>, module => <<"move_san"/utf8>>, function => <<"from_string"/utf8>>, line => 102}) 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 => <<"Invalid file."/utf8>>, module => <<"move_san"/utf8>>, function => <<"from_string"/utf8>>, line => 114}) 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 => <<"Invalid rank."/utf8>>, module => <<"move_san"/utf8>>, function => <<"from_string"/utf8>>, line => 126}) 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] = case Positional_information of [_, _, _] -> Positional_information; _assert_fail@1 -> erlang:error(#{gleam_error => let_assert, message => <<"Assertion pattern match failed"/utf8>>, value => _assert_fail@1, module => <<"move_san"/utf8>>, function => <<"from_string"/utf8>>, line => 139}) end, 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 => <<"Invalid file"/utf8>>, module => <<"move_san"/utf8>>, function => <<"from_string"/utf8>>, line => 152}) 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 => <<"Invalid file."/utf8>>, module => <<"move_san"/utf8>>, function => <<"from_string"/utf8>>, line => 164}) 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 => <<"Invalid rank."/utf8>>, module => <<"move_san"/utf8>>, function => <<"from_string"/utf8>>, line => 176}) 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 => <<"Invalid file"/utf8>>, module => <<"move_san"/utf8>>, function => <<"from_string"/utf8>>, line => 152}) 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 => <<"Invalid file."/utf8>>, module => <<"move_san"/utf8>>, function => <<"from_string"/utf8>>, line => 164}) 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 => <<"Invalid rank."/utf8>>, module => <<"move_san"/utf8>>, function => <<"from_string"/utf8>>, line => 176}) 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 => <<"Invalid file"/utf8>>, module => <<"move_san"/utf8>>, function => <<"from_string"/utf8>>, line => 152}) 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 => <<"Invalid file."/utf8>>, module => <<"move_san"/utf8>>, function => <<"from_string"/utf8>>, line => 164}) 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 => <<"Invalid rank."/utf8>>, module => <<"move_san"/utf8>>, function => <<"from_string"/utf8>>, line => 176}) 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 => <<"Invalid file"/utf8>>, module => <<"move_san"/utf8>>, function => <<"from_string"/utf8>>, line => 152}) 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 => <<"Invalid file."/utf8>>, module => <<"move_san"/utf8>>, function => <<"from_string"/utf8>>, line => 164}) 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 => <<"Invalid rank."/utf8>>, module => <<"move_san"/utf8>>, function => <<"from_string"/utf8>>, line => 176}) 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 => <<"Invalid file"/utf8>>, module => <<"move_san"/utf8>>, function => <<"from_string"/utf8>>, line => 152}) 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 => <<"Invalid file."/utf8>>, module => <<"move_san"/utf8>>, function => <<"from_string"/utf8>>, line => 164}) 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 => <<"Invalid rank."/utf8>>, module => <<"move_san"/utf8>>, function => <<"from_string"/utf8>>, line => 176}) 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 => <<"Invalid file"/utf8>>, module => <<"move_san"/utf8>>, function => <<"from_string"/utf8>>, line => 152}) 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 => <<"Invalid file."/utf8>>, module => <<"move_san"/utf8>>, function => <<"from_string"/utf8>>, line => 164}) 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 => <<"Invalid rank."/utf8>>, module => <<"move_san"/utf8>>, function => <<"from_string"/utf8>>, line => 176}) 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 => <<"Invalid file"/utf8>>, module => <<"move_san"/utf8>>, function => <<"from_string"/utf8>>, line => 152}) 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 => <<"Invalid file."/utf8>>, module => <<"move_san"/utf8>>, function => <<"from_string"/utf8>>, line => 164}) 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 => <<"Invalid rank."/utf8>>, module => <<"move_san"/utf8>>, function => <<"from_string"/utf8>>, line => 176}) 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 => <<"Invalid file"/utf8>>, module => <<"move_san"/utf8>>, function => <<"from_string"/utf8>>, line => 152}) 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 => <<"Invalid file."/utf8>>, module => <<"move_san"/utf8>>, function => <<"from_string"/utf8>>, line => 164}) 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 => <<"Invalid rank."/utf8>>, module => <<"move_san"/utf8>>, function => <<"from_string"/utf8>>, line => 176}) 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 => <<"Invalid rank."/utf8>>, module => <<"move_san"/utf8>>, function => <<"from_string"/utf8>>, line => 198}) 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 => <<"Invalid file."/utf8>>, module => <<"move_san"/utf8>>, function => <<"from_string"/utf8>>, line => 210}) 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 => <<"Invalid rank."/utf8>>, module => <<"move_san"/utf8>>, function => <<"from_string"/utf8>>, line => 222}) 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 => <<"Invalid rank."/utf8>>, module => <<"move_san"/utf8>>, function => <<"from_string"/utf8>>, line => 198}) 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 => <<"Invalid file."/utf8>>, module => <<"move_san"/utf8>>, function => <<"from_string"/utf8>>, line => 210}) 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 => <<"Invalid rank."/utf8>>, module => <<"move_san"/utf8>>, function => <<"from_string"/utf8>>, line => 222}) 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 => <<"Invalid rank."/utf8>>, module => <<"move_san"/utf8>>, function => <<"from_string"/utf8>>, line => 198}) 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 => <<"Invalid file."/utf8>>, module => <<"move_san"/utf8>>, function => <<"from_string"/utf8>>, line => 210}) 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 => <<"Invalid rank."/utf8>>, module => <<"move_san"/utf8>>, function => <<"from_string"/utf8>>, line => 222}) 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 => <<"Invalid rank."/utf8>>, module => <<"move_san"/utf8>>, function => <<"from_string"/utf8>>, line => 198}) 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 => <<"Invalid file."/utf8>>, module => <<"move_san"/utf8>>, function => <<"from_string"/utf8>>, line => 210}) 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 => <<"Invalid rank."/utf8>>, module => <<"move_san"/utf8>>, function => <<"from_string"/utf8>>, line => 222}) 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 => <<"Invalid rank."/utf8>>, module => <<"move_san"/utf8>>, function => <<"from_string"/utf8>>, line => 198}) 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 => <<"Invalid file."/utf8>>, module => <<"move_san"/utf8>>, function => <<"from_string"/utf8>>, line => 210}) 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 => <<"Invalid rank."/utf8>>, module => <<"move_san"/utf8>>, function => <<"from_string"/utf8>>, line => 222}) 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 => <<"Invalid rank."/utf8>>, module => <<"move_san"/utf8>>, function => <<"from_string"/utf8>>, line => 198}) 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 => <<"Invalid file."/utf8>>, module => <<"move_san"/utf8>>, function => <<"from_string"/utf8>>, line => 210}) 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 => <<"Invalid rank."/utf8>>, module => <<"move_san"/utf8>>, function => <<"from_string"/utf8>>, line => 222}) 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 => <<"Invalid rank."/utf8>>, module => <<"move_san"/utf8>>, function => <<"from_string"/utf8>>, line => 198}) 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 => <<"Invalid file."/utf8>>, module => <<"move_san"/utf8>>, function => <<"from_string"/utf8>>, line => 210}) 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 => <<"Invalid rank."/utf8>>, module => <<"move_san"/utf8>>, function => <<"from_string"/utf8>>, line => 222}) 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 => <<"Invalid rank."/utf8>>, module => <<"move_san"/utf8>>, function => <<"from_string"/utf8>>, line => 198}) 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 => <<"Invalid file."/utf8>>, module => <<"move_san"/utf8>>, function => <<"from_string"/utf8>>, line => 210}) 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 => <<"Invalid rank."/utf8>>, module => <<"move_san"/utf8>>, function => <<"from_string"/utf8>>, line => 222}) 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] = case Positional_information of [_, _] -> Positional_information; _assert_fail@2 -> erlang:error(#{gleam_error => let_assert, message => <<"Assertion pattern match failed"/utf8>>, value => _assert_fail@2, module => <<"move_san"/utf8>>, function => <<"from_string"/utf8>>, line => 238}) end, 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 => <<"Invalid file."/utf8>>, module => <<"move_san"/utf8>>, function => <<"from_string"/utf8>>, line => 248}) 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 => <<"Invalid rank."/utf8>>, module => <<"move_san"/utf8>>, function => <<"from_string"/utf8>>, line => 260}) 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}}}; _ -> {error, invalid_castle_string} 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}}}; _ -> {error, invalid_castle_string} 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}}}; _ -> {error, invalid_castle_string} 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}}}; _ -> {error, invalid_castle_string} 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}}}; _ -> {error, invalid_castle_string} 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}}}; _ -> {error, invalid_castle_string} 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}}}; _ -> {error, invalid_castle_string} 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}}}; _ -> {error, invalid_castle_string} 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_stdlib:contains_string( 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}; _ -> erlang:error(#{gleam_error => panic, message => <<"Invalid promotion segment."/utf8>>, module => <<"move_san"/utf8>>, function => <<"from_string"/utf8>>, line => 360}) 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] = case Positional_information@1 of [_, _, _, _] -> Positional_information@1; _assert_fail@3 -> erlang:error(#{gleam_error => let_assert, message => <<"Assertion pattern match failed"/utf8>>, value => _assert_fail@3, module => <<"move_san"/utf8>>, function => <<"from_string"/utf8>>, line => 374}) end, 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 => <<"Invalid file."/utf8>>, module => <<"move_san"/utf8>>, function => <<"from_string"/utf8>>, line => 385}) 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 => <<"Invalid rank."/utf8>>, module => <<"move_san"/utf8>>, function => <<"from_string"/utf8>>, line => 397}) 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 => <<"Invalid file."/utf8>>, module => <<"move_san"/utf8>>, function => <<"from_string"/utf8>>, line => 409}) 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 => <<"Invalid rank."/utf8>>, module => <<"move_san"/utf8>>, function => <<"from_string"/utf8>>, line => 421}) 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] = case Positional_information@1 of [_, _, _] -> Positional_information@1; _assert_fail@4 -> erlang:error(#{gleam_error => let_assert, message => <<"Assertion pattern match failed"/utf8>>, value => _assert_fail@4, module => <<"move_san"/utf8>>, function => <<"from_string"/utf8>>, line => 451}) end, 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 => <<"Invalid file"/utf8>>, module => <<"move_san"/utf8>>, function => <<"from_string"/utf8>>, line => 464}) 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 => <<"Invalid file."/utf8>>, module => <<"move_san"/utf8>>, function => <<"from_string"/utf8>>, line => 476}) 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 => <<"Invalid rank."/utf8>>, module => <<"move_san"/utf8>>, function => <<"from_string"/utf8>>, line => 488}) 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 => <<"Invalid file"/utf8>>, module => <<"move_san"/utf8>>, function => <<"from_string"/utf8>>, line => 464}) 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 => <<"Invalid file."/utf8>>, module => <<"move_san"/utf8>>, function => <<"from_string"/utf8>>, line => 476}) 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 => <<"Invalid rank."/utf8>>, module => <<"move_san"/utf8>>, function => <<"from_string"/utf8>>, line => 488}) 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 => <<"Invalid file"/utf8>>, module => <<"move_san"/utf8>>, function => <<"from_string"/utf8>>, line => 464}) 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 => <<"Invalid file."/utf8>>, module => <<"move_san"/utf8>>, function => <<"from_string"/utf8>>, line => 476}) 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 => <<"Invalid rank."/utf8>>, module => <<"move_san"/utf8>>, function => <<"from_string"/utf8>>, line => 488}) 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 => <<"Invalid file"/utf8>>, module => <<"move_san"/utf8>>, function => <<"from_string"/utf8>>, line => 464}) 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 => <<"Invalid file."/utf8>>, module => <<"move_san"/utf8>>, function => <<"from_string"/utf8>>, line => 476}) 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 => <<"Invalid rank."/utf8>>, module => <<"move_san"/utf8>>, function => <<"from_string"/utf8>>, line => 488}) 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 => <<"Invalid file"/utf8>>, module => <<"move_san"/utf8>>, function => <<"from_string"/utf8>>, line => 464}) 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 => <<"Invalid file."/utf8>>, module => <<"move_san"/utf8>>, function => <<"from_string"/utf8>>, line => 476}) 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 => <<"Invalid rank."/utf8>>, module => <<"move_san"/utf8>>, function => <<"from_string"/utf8>>, line => 488}) 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 => <<"Invalid file"/utf8>>, module => <<"move_san"/utf8>>, function => <<"from_string"/utf8>>, line => 464}) 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 => <<"Invalid file."/utf8>>, module => <<"move_san"/utf8>>, function => <<"from_string"/utf8>>, line => 476}) 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 => <<"Invalid rank."/utf8>>, module => <<"move_san"/utf8>>, function => <<"from_string"/utf8>>, line => 488}) 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 => <<"Invalid file"/utf8>>, module => <<"move_san"/utf8>>, function => <<"from_string"/utf8>>, line => 464}) 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 => <<"Invalid file."/utf8>>, module => <<"move_san"/utf8>>, function => <<"from_string"/utf8>>, line => 476}) 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 => <<"Invalid rank."/utf8>>, module => <<"move_san"/utf8>>, function => <<"from_string"/utf8>>, line => 488}) 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 => <<"Invalid file"/utf8>>, module => <<"move_san"/utf8>>, function => <<"from_string"/utf8>>, line => 464}) 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 => <<"Invalid file."/utf8>>, module => <<"move_san"/utf8>>, function => <<"from_string"/utf8>>, line => 476}) 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 => <<"Invalid rank."/utf8>>, module => <<"move_san"/utf8>>, function => <<"from_string"/utf8>>, line => 488}) 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 => <<"Invalid rank."/utf8>>, module => <<"move_san"/utf8>>, function => <<"from_string"/utf8>>, line => 521}) 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 => <<"Invalid file."/utf8>>, module => <<"move_san"/utf8>>, function => <<"from_string"/utf8>>, line => 533}) 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 => <<"Invalid rank."/utf8>>, module => <<"move_san"/utf8>>, function => <<"from_string"/utf8>>, line => 545}) 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 => <<"Invalid rank."/utf8>>, module => <<"move_san"/utf8>>, function => <<"from_string"/utf8>>, line => 521}) 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 => <<"Invalid file."/utf8>>, module => <<"move_san"/utf8>>, function => <<"from_string"/utf8>>, line => 533}) 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 => <<"Invalid rank."/utf8>>, module => <<"move_san"/utf8>>, function => <<"from_string"/utf8>>, line => 545}) 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 => <<"Invalid rank."/utf8>>, module => <<"move_san"/utf8>>, function => <<"from_string"/utf8>>, line => 521}) 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 => <<"Invalid file."/utf8>>, module => <<"move_san"/utf8>>, function => <<"from_string"/utf8>>, line => 533}) 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 => <<"Invalid rank."/utf8>>, module => <<"move_san"/utf8>>, function => <<"from_string"/utf8>>, line => 545}) 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 => <<"Invalid rank."/utf8>>, module => <<"move_san"/utf8>>, function => <<"from_string"/utf8>>, line => 521}) 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 => <<"Invalid file."/utf8>>, module => <<"move_san"/utf8>>, function => <<"from_string"/utf8>>, line => 533}) 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 => <<"Invalid rank."/utf8>>, module => <<"move_san"/utf8>>, function => <<"from_string"/utf8>>, line => 545}) 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 => <<"Invalid rank."/utf8>>, module => <<"move_san"/utf8>>, function => <<"from_string"/utf8>>, line => 521}) 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 => <<"Invalid file."/utf8>>, module => <<"move_san"/utf8>>, function => <<"from_string"/utf8>>, line => 533}) 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 => <<"Invalid rank."/utf8>>, module => <<"move_san"/utf8>>, function => <<"from_string"/utf8>>, line => 545}) 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 => <<"Invalid rank."/utf8>>, module => <<"move_san"/utf8>>, function => <<"from_string"/utf8>>, line => 521}) 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 => <<"Invalid file."/utf8>>, module => <<"move_san"/utf8>>, function => <<"from_string"/utf8>>, line => 533}) 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 => <<"Invalid rank."/utf8>>, module => <<"move_san"/utf8>>, function => <<"from_string"/utf8>>, line => 545}) 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 => <<"Invalid rank."/utf8>>, module => <<"move_san"/utf8>>, function => <<"from_string"/utf8>>, line => 521}) 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 => <<"Invalid file."/utf8>>, module => <<"move_san"/utf8>>, function => <<"from_string"/utf8>>, line => 533}) 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 => <<"Invalid rank."/utf8>>, module => <<"move_san"/utf8>>, function => <<"from_string"/utf8>>, line => 545}) 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 => <<"Invalid rank."/utf8>>, module => <<"move_san"/utf8>>, function => <<"from_string"/utf8>>, line => 521}) 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 => <<"Invalid file."/utf8>>, module => <<"move_san"/utf8>>, function => <<"from_string"/utf8>>, line => 533}) 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 => <<"Invalid rank."/utf8>>, module => <<"move_san"/utf8>>, function => <<"from_string"/utf8>>, line => 545}) 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] = case Positional_information@1 of [_, _] -> Positional_information@1; _assert_fail@5 -> erlang:error(#{gleam_error => let_assert, message => <<"Assertion pattern match failed"/utf8>>, value => _assert_fail@5, module => <<"move_san"/utf8>>, function => <<"from_string"/utf8>>, line => 572}) end, 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 => <<"Invalid file."/utf8>>, module => <<"move_san"/utf8>>, function => <<"from_string"/utf8>>, line => 582}) 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 => <<"Invalid rank."/utf8>>, module => <<"move_san"/utf8>>, function => <<"from_string"/utf8>>, line => 594}) 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; _ -> {error, invalid_positional_information} end; _ -> {error, invalid_move_string} end.