Skip to content

Commit

Permalink
Move spinner around the best move calculation
Browse files Browse the repository at this point in the history
  • Loading branch information
FrostyX committed Dec 14, 2024
1 parent 9e6bff0 commit f20a08c
Showing 1 changed file with 7 additions and 11 deletions.
18 changes: 7 additions & 11 deletions src/crooked_rook.gleam
Original file line number Diff line number Diff line change
Expand Up @@ -33,33 +33,29 @@ pub fn main() {
|> ansi.black
|> io.println

let spinner =
spinner.new("Reticulating 3-Dimensional Splines")
|> spinner.with_colour(ansi.yellow)
|> spinner.start

spinner.stop(spinner)
io.println("Done!")

io.println("Opponent is playing white")
io.println("You are playing black")

let game = new_game()

let position = "e2e4"
io.println("First move by the opponent: " <> position)
first_move(game, position)

let spinner =
spinner.new("Calculating best move")
|> spinner.with_colour(ansi.magenta)
|> spinner.start
let best = best_move(game)
spinner.stop(spinner)

io.println("You should play: " <> best)
move(game, best)
case morsey.encode(best) {
Ok(symbols) -> io.println("Morse code: " <> morsey.to_string(symbols))
Error(morsey.InvalidCharacter(char)) ->
io.println_error("Invalid character: " <> char)
}

move(game, best)

let position = ask_move()
move(game, position)

Expand Down

0 comments on commit f20a08c

Please sign in to comment.