A tool for testing starfish

Update to new `Move` format

Changed files
+5 -18
src
+5 -18
src/starfish_testing.gleam
··· 6 6 import gleam/list 7 7 import gleam/string 8 8 import simplifile as file 9 - import starfish 9 + import starfish.{type Move} 10 10 import starfish/internal/board 11 - import starfish/internal/move.{type Legal, type Move} 12 11 13 12 const fen_file = "silversuite.fen" 14 13 ··· 106 105 } 107 106 } 108 107 109 - fn get_best_move( 110 - game: starfish.Game, 111 - configuration: Configuration, 112 - ) -> Move(Legal) { 108 + fn get_best_move(game: starfish.Game, configuration: Configuration) -> Move { 113 109 let url = case game.to_move, configuration { 114 110 board.White, UpdatedPlaysWhite | board.Black, UpdatedPlaysBlack -> 115 111 "http://0.0.0.0:8000/move" ··· 124 120 |> request.set_method(http.Post) 125 121 let assert Ok(response) = httpc.send(request) 126 122 127 - let assert Ok(move) = starfish.parse_long_algebraic_notation(response.body) 128 - coerce_move(move) 129 - } 130 - 131 - fn coerce_move(move: Move(move.Valid)) -> Move(Legal) { 132 - case move { 133 - move.Capture(from:, to:) -> move.Capture(from:, to:) 134 - move.Castle(from:, to:) -> move.Castle(from:, to:) 135 - move.EnPassant(from:, to:) -> move.EnPassant(from:, to:) 136 - move.Move(from:, to:) -> move.Move(from:, to:) 137 - move.Promotion(from:, to:, piece:) -> move.Promotion(from:, to:, piece:) 138 - } 123 + let assert Ok(move) = 124 + starfish.parse_long_algebraic_notation(response.body, game) 125 + move 139 126 }