Created
October 6, 2019 03:22
-
-
Save IntegerMan/e91e19fcbb304cff24bbdef6040ea223 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[<EntryPoint>] | |
let main argv = | |
printfn "F# Console Application Tutorial by Matt Eland" | |
let getRandomNumber = | |
let r = Random() | |
fun max -> (r.Next max) + 1 | |
let world = makeWorld 13 13 getRandomNumber | |
let mutable state = { World = world; Player = world.Squirrel } | |
let mutable simulating: bool = true | |
while simulating do | |
let player = state.World.Squirrel | |
let userCommand = getUserInput(state.World) |> tryParseInput | |
match userCommand with | |
| None -> printfn "Invalid input" | |
| Some command -> | |
match command with | |
| Exit -> simulating <- false | |
| Action gameCommand -> state <- playTurn state player getRandomNumber gameCommand | |
0 // return an integer exit code |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment