Dynamic Monte-Carlo simulation of electrochemical switching of a conducting polymer film