Skip to content

Instantly share code, notes, and snippets.

@jasondown
Last active December 30, 2018 17:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jasondown/2caf0580fcd14251b28de3cb2bc7d419 to your computer and use it in GitHub Desktop.
Save jasondown/2caf0580fcd14251b28de3cb2bc7d419 to your computer and use it in GitHub Desktop.
let getMove (gs : GameState) =
let me = gs.Robots |> List.find (fun r -> r.Player = Player.Me)
let mySamples = gs.Samples |> List.filter (fun s -> s.CarriedBy = Player.Me)
let samplesReady = mySamples |> List.filter (canMakeSample me)
let cloudSamples =
gs.Samples
|> List.filter (fun s -> s.CarriedBy = Player.Cloud)
|> List.sortByDescending (fun s -> s.HealthPoints)
match mySamples.Length, samplesReady.Length, cloudSamples.Length, me.Location with
| _, sr, _, Module.Laboratory when sr > 0 ->
produce samplesReady.Head
| _, sr, _, _ when sr > 0 ->
goto Module.Laboratory
| ms, _, cs, Module.Diagnosis when ms = 0 && cs > 0 ->
collect cloudSamples.Head
| ms, _, cs, _ when ms = 0 && cs > 0 ->
goto Module.Diagnosis
| _, _, _, Module.Molecules ->
gather (getRequiredMolecule me mySamples.Head)
| _, _, _, _ ->
goto Module.Molecules
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment