implemented recursive algo for marking squares as available to move