Optimized some loops in getStateValue and added a timeout to play the
best already-discovered move