implement polygon gate with condition expression