When game ends, stop the loop
Fix dir switch on predict.
Changed an assignment by reference to a copy by value