reference JoahG/chess.js