Javascript chess board rendering and game analysis