diff --git a/Dojo/Canopy2048/Interactions.fs b/Dojo/Canopy2048/Interactions.fs index 6a4f72d..bb5d626 100644 --- a/Dojo/Canopy2048/Interactions.fs +++ b/Dojo/Canopy2048/Interactions.fs @@ -6,12 +6,12 @@ open runner module Interactions = let lost () = - match someElement ".game-message.game-over" with + match someElement <| css ".game-message.game-over" with | None -> false | Some(_) -> true let won () = - match someElement ".game-message.game-won" with + match someElement <| css ".game-message.game-won" with | None -> false | Some(_) -> true diff --git a/Dojo/Canopy2048/Program.fs b/Dojo/Canopy2048/Program.fs index f7b2b8e..5ddc92f 100644 --- a/Dojo/Canopy2048/Program.fs +++ b/Dojo/Canopy2048/Program.fs @@ -39,6 +39,9 @@ open Interactions module program = + configuration.optimizeBySkippingIFrameCheck <- true + configuration.optmizeByDisablingCoverageReport <- true + "starting a game of 2048" &&& fun _ -> printfn "Game started." @@ -143,8 +146,11 @@ module program = move, float(score1)+score2*0.5 ) scores |> List.maxBy snd - let rec play moves = + let sw = System.Diagnostics.Stopwatch.StartNew() + let rec play moves counter = let move = getBestMove 3 (state()) moves + + printfn "%i moves in %f ms" counter sw.Elapsed.TotalMilliseconds printfn "%A" move match fst move with | Left -> press left @@ -154,9 +160,9 @@ module program = if lost() || won() //if gameEnded() then ignore() - else play (shuffle moves) + else play (shuffle moves) (counter + 1) - play [Up; Right; Left; Down] + play [Up; Right; Left; Down] 0 // Just to make sure the test function