How to control an actor move by different combination?

For example, if the player touch the iphone left area three time and right area one time then the actor will move to right a step then stop , touch the iphone right area three time and left area one time then the actor will move to left a step then stop, if the combination incorrect,then it won't move.
it is possible to make this function?
it is possible to make this function?