A tool for testing starfish

Print draw reason

Changed files
+9 -7
src
starfish_original
+8 -6
src/starfish_testing.gleam
··· 34 34 let #(wins, draws, losses) = tuple 35 35 case outcome { 36 36 Updated -> #(wins + 1, draws, losses) 37 - Draw -> #(wins, draws + 1, losses) 37 + Draw(_) -> #(wins, draws + 1, losses) 38 38 Original -> #(wins, draws, losses + 1) 39 39 } 40 40 }) ··· 55 55 type Outcome { 56 56 Updated 57 57 Original 58 - Draw 58 + Draw(starfish.DrawReason) 59 59 } 60 60 61 61 fn run_game(fen: String, i: Int) -> List(Outcome) { ··· 79 79 80 80 fn print_outcome(outcome: Outcome) -> String { 81 81 case outcome { 82 - Draw -> "it was a draw." 83 82 Original -> "original version won." 84 83 Updated -> "updated version won." 84 + Draw(starfish.FiftyMoves) -> "fifty quiet moves occurred" 85 + Draw(starfish.InsufficientMaterial) -> "there was insufficient material" 86 + Draw(starfish.Stalemate) -> "it was stalemate" 87 + Draw(starfish.ThreefoldRepetition) -> "the position was repeated 3 times" 85 88 } 86 89 } 87 90 ··· 92 95 93 96 fn run_game_loop(game: starfish.Game, configuration: Configuration) -> Outcome { 94 97 case starfish.state(game), configuration { 95 - starfish.Draw(_), _ -> Draw 98 + starfish.Draw(reason), _ -> Draw(reason) 96 99 starfish.BlackWin, UpdatedPlaysBlack | starfish.WhiteWin, UpdatedPlaysWhite -> 97 100 Updated 98 101 starfish.BlackWin, UpdatedPlaysWhite | starfish.WhiteWin, UpdatedPlaysBlack -> ··· 120 123 |> request.set_method(http.Post) 121 124 let assert Ok(response) = httpc.send(request) 122 125 123 - let assert Ok(move) = 124 - starfish.parse_long_algebraic_notation(response.body, game) 126 + let assert Ok(move) = starfish.parse_move(response.body, game) 125 127 move 126 128 }
+1 -1
starfish_original/manifest.toml
··· 27 27 { name = "platform", version = "1.0.0", build_tools = ["gleam"], requirements = [], otp_app = "platform", source = "hex", outer_checksum = "8339420A95AD89AAC0F82F4C3DB8DD401041742D6C3F46132A8739F6AEB75391" }, 28 28 { name = "ranger", version = "1.4.0", build_tools = ["gleam"], requirements = ["gleam_stdlib", "gleam_yielder"], otp_app = "ranger", source = "hex", outer_checksum = "C8988E8F8CDBD3E7F4D8F2E663EF76490390899C2B2885A6432E942495B3E854" }, 29 29 { name = "simplifile", version = "2.3.0", build_tools = ["gleam"], requirements = ["filepath", "gleam_stdlib"], otp_app = "simplifile", source = "hex", outer_checksum = "0A868DAC6063D9E983477981839810DC2E553285AB4588B87E3E9C96A7FB4CB4" }, 30 - { name = "starfish", version = "1.0.0", build_tools = ["gleam"], requirements = ["birl", "gleam_stdlib", "iv"], source = "git", repo = "https://github.com/GearsDatapacks/starfish", commit = "be6743f5e0e6c1219657032ed85c8f40b902cedc" }, 30 + { name = "starfish", version = "1.0.0", build_tools = ["gleam"], requirements = ["birl", "gleam_stdlib", "iv"], source = "git", repo = "https://github.com/GearsDatapacks/starfish", commit = "6d4cc151dd8b2047f52814c3d935b48e79ef081e" }, 31 31 { name = "telemetry", version = "1.3.0", build_tools = ["rebar3"], requirements = [], otp_app = "telemetry", source = "hex", outer_checksum = "7015FC8919DBE63764F4B4B87A95B7C0996BD539E0D499BE6EC9D7F3875B79E6" }, 32 32 { 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" }, 33 33 ]