State Pattern Learning