diff --git a/src/starfish_testing.gleam b/src/starfish_testing.gleam index 18789df..450b426 100644 --- a/src/starfish_testing.gleam +++ b/src/starfish_testing.gleam @@ -34,7 +34,7 @@ pub fn main() -> Nil { let #(wins, draws, losses) = tuple case outcome { Updated -> #(wins + 1, draws, losses) - Draw -> #(wins, draws + 1, losses) + Draw(_) -> #(wins, draws + 1, losses) Original -> #(wins, draws, losses + 1) } }) @@ -55,7 +55,7 @@ pub fn main() -> Nil { type Outcome { Updated Original - Draw + Draw(starfish.DrawReason) } fn run_game(fen: String, i: Int) -> List(Outcome) { @@ -79,9 +79,12 @@ fn run_game(fen: String, i: Int) -> List(Outcome) { fn print_outcome(outcome: Outcome) -> String { case outcome { - Draw -> "it was a draw." Original -> "original version won." Updated -> "updated version won." + Draw(starfish.FiftyMoves) -> "fifty quiet moves occurred" + Draw(starfish.InsufficientMaterial) -> "there was insufficient material" + Draw(starfish.Stalemate) -> "it was stalemate" + Draw(starfish.ThreefoldRepetition) -> "the position was repeated 3 times" } } @@ -92,7 +95,7 @@ type Configuration { fn run_game_loop(game: starfish.Game, configuration: Configuration) -> Outcome { case starfish.state(game), configuration { - starfish.Draw(_), _ -> Draw + starfish.Draw(reason), _ -> Draw(reason) starfish.BlackWin, UpdatedPlaysBlack | starfish.WhiteWin, UpdatedPlaysWhite -> Updated starfish.BlackWin, UpdatedPlaysWhite | starfish.WhiteWin, UpdatedPlaysBlack -> @@ -120,7 +123,6 @@ fn get_best_move(game: starfish.Game, configuration: Configuration) -> Move { |> request.set_method(http.Post) let assert Ok(response) = httpc.send(request) - let assert Ok(move) = - starfish.parse_long_algebraic_notation(response.body, game) + let assert Ok(move) = starfish.parse_move(response.body, game) move } diff --git a/starfish_original/manifest.toml b/starfish_original/manifest.toml index eaeb7c3..0c9b3f2 100644 --- a/starfish_original/manifest.toml +++ b/starfish_original/manifest.toml @@ -27,7 +27,7 @@ packages = [ { name = "platform", version = "1.0.0", build_tools = ["gleam"], requirements = [], otp_app = "platform", source = "hex", outer_checksum = "8339420A95AD89AAC0F82F4C3DB8DD401041742D6C3F46132A8739F6AEB75391" }, { name = "ranger", version = "1.4.0", build_tools = ["gleam"], requirements = ["gleam_stdlib", "gleam_yielder"], otp_app = "ranger", source = "hex", outer_checksum = "C8988E8F8CDBD3E7F4D8F2E663EF76490390899C2B2885A6432E942495B3E854" }, { name = "simplifile", version = "2.3.0", build_tools = ["gleam"], requirements = ["filepath", "gleam_stdlib"], otp_app = "simplifile", source = "hex", outer_checksum = "0A868DAC6063D9E983477981839810DC2E553285AB4588B87E3E9C96A7FB4CB4" }, - { name = "starfish", version = "1.0.0", build_tools = ["gleam"], requirements = ["birl", "gleam_stdlib", "iv"], source = "git", repo = "https://github.com/GearsDatapacks/starfish", commit = "be6743f5e0e6c1219657032ed85c8f40b902cedc" }, + { name = "starfish", version = "1.0.0", build_tools = ["gleam"], requirements = ["birl", "gleam_stdlib", "iv"], source = "git", repo = "https://github.com/GearsDatapacks/starfish", commit = "6d4cc151dd8b2047f52814c3d935b48e79ef081e" }, { name = "telemetry", version = "1.3.0", build_tools = ["rebar3"], requirements = [], otp_app = "telemetry", source = "hex", outer_checksum = "7015FC8919DBE63764F4B4B87A95B7C0996BD539E0D499BE6EC9D7F3875B79E6" }, { name = "wisp", version = "1.8.0", build_tools = ["gleam"], requirements = ["directories", "exception", "gleam_crypto", "gleam_erlang", "gleam_http", "gleam_json", "gleam_stdlib", "houdini", "logging", "marceau", "mist", "simplifile"], otp_app = "wisp", source = "hex", outer_checksum = "0FE9049AFFB7C8D5FC0B154EEE2704806F4D51B97F44925D69349B3F4F192957" }, ]