Rewriting blacksmith ai to fsm