some nice 2d fighting game code for sanitizing controller input and pattern matching