-module(status). -compile([no_auto_import, nowarn_unused_vars, nowarn_unused_function, nowarn_nomatch]). -export([to_string/1]). -export_type([draw_reason/0, win_reason/0, three_fold_position/0, status/0]). -type draw_reason() :: stalemate | fifty_move_rule | threefold_repetition | insufficient_material | manual. -type win_reason() :: checkmate | resignation | timeout. -type three_fold_position() :: {three_fold_position, color:color(), board:board_bb(), gleam@option:option(position:position()), castle_rights:castle_rights(), castle_rights:castle_rights(), castle_rights:castle_rights(), castle_rights:castle_rights()}. -type status() :: {draw, draw_reason()} | {win, color:color(), binary()} | {in_progress, integer(), gleam@dict:dict(three_fold_position(), integer())}. -spec to_string(status()) -> binary(). to_string(Status) -> case Status of {in_progress, _, _} -> <<"In Progress"/utf8>>; {draw, _} -> <<"Draw"/utf8>>; {win, _, _} -> <<"Win"/utf8>> end.