why was chess invented