Skip to content

Instantly share code, notes, and snippets.

@IntegerMan
Created October 6, 2019 03:21
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 IntegerMan/8eeb5649436b05f462ae3c50ffac9978 to your computer and use it in GitHub Desktop.
Save IntegerMan/8eeb5649436b05f462ae3c50ffac9978 to your computer and use it in GitHub Desktop.
let tryParseInput (info:ConsoleKeyInfo) =
match info.Key with
| ConsoleKey.LeftArrow -> Some (Action MoveLeft)
| ConsoleKey.RightArrow -> Some (Action MoveRight)
| ConsoleKey.UpArrow -> Some (Action MoveUp)
| ConsoleKey.DownArrow -> Some (Action MoveDown)
| ConsoleKey.NumPad7 | ConsoleKey.Home -> Some (Action MoveUpLeft)
| ConsoleKey.NumPad9 | ConsoleKey.PageUp -> Some (Action MoveUpRight)
| ConsoleKey.NumPad1 | ConsoleKey.End -> Some (Action MoveDownRight)
| ConsoleKey.NumPad3 | ConsoleKey.PageDown -> Some (Action MoveDownRight)
| ConsoleKey.NumPad5 | ConsoleKey.Spacebar | ConsoleKey.Clear -> Some (Action Wait)
| ConsoleKey.X -> Some Exit
| ConsoleKey.R -> Some (Action Restart)
| _ -> None
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment