Chess game in javascript