FINITE STATE MACHINE: PRINCIPLE AND PRACTICE