Added AI state graph
Fixed infinite loop