Missile Launchers with F#
- Posted: Jan 25, 2010 at 6:48 AM
- 713 Views
Chris Smith had a talk at the CodeMash conference in January 2010 titled “Being an Evil Genius with F# and .NET”. Chris created a post about his talk and doing
Computer Vision, Speech Recognition, and shooting missiles at people all with F#!
Here is a bit of his speech recognition code using the System.Speech.dll:
let recognizerEvent = getWordRecognizer() // Main handler - convert spoken text into RL commands let handleWord spokenText = printfn "Recognized Word: %s" spokenText let action = match spokenText with | "up" // Has a hard time recognizing this :( | "north" -> MoveUp(20) | "down" -> MoveDown(20) | "left" -> MoveLeft(20) | "right" -> MoveRight(20) | "fire" -> Fire | _ -> NoOp performAction rocketLauncher action |> ignore // Exit handler - specifically look for exit/quit let terminateLoop = ref false let terminateLoopHandler = function | "exit" | "quit" -> terminateLoop := true | _ -> () // Hook up event handlers recognizerEvent.Add(handleWord) recognizerEvent.Add(terminateLoopHandler) while terminateLoop.Value = false do System.Threading.Thread.Yield() |> ignore ()
Chris happily provided the source code as well, RocketLauncher_v1.0.zip.
Comments have been closed since this content was published more than 30 days ago, but if you'd like to continue the conversation,
please create a new thread in our Forums,
or
Contact Us and let us know.
Follow the Discussion
Oops, something didn't work.
What does this mean?
Following an item on Channel 9 allows you to watch for new content and comments that you are interested in. You need to be signed in to Channel 9 to use this feature.What does this mean?
Following an item on Channel 9 allows you to watch for new content and comments that you are interested in and view them all on your notifications page.sign up for email notifications?