Boston-based obstacle racing company Spartan Race Inc. has reached an agreement to purchase its former rival, Tough Mudder, through a Chapter 11 proceeding.