added loop for attaks and solved bug for going out of board boundries