Export the game: copy moves or download PGN

Open
#55 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
72/100
Issue type
Feature
Clarity
Clearly specified
Activity status
Active
Tech stack
javascript
Domain
frontend

Research direction

Read js/game.js:738-785 and js/game.js:232-233 to trace move history and stored notation, then inspect js/game.js:904 and index.html:21-24 for en passant notation and the page controls. Run npm test and npm run lint as the issue describes. Done when the Copy PGN control produces text accepted by a standard PGN viewer, with correct results for checkmate, stalemate, and unfinished games.

Written by the indexing model from the issue text.

Description

enhancement good first issue severity: medium

Summary

SAN is already generated and stored for every move, but the only output is the on-page move list. A finished game cannot be taken to an analysis board, shared or archived.

Where

  • js/game.js:738-785 (updateMoveHistoryDisplay)
  • js/game.js:232-233 (move.notation stored per move)
  • js/game.js:904 (appends e.p., which PGN parsers reject)
  • index.html:21-24

Proposal

Add a "Copy PGN" button that joins the move history into numbered movetext, adds the seven-tag roster with Result derived from the game state, and writes it to the clipboard (fallback: a download). Drop the e.p. suffix in the exported text. PGN import is a larger follow-up and not part of this.

Who benefits

Players who want to review or share a game.

Acceptance criteria

  • The exported text loads in a standard PGN viewer
  • Result is correct for checkmate, stalemate and unfinished games

Getting started

  • Relevant files: js/game.js, index.html
  • How to run tests: npm install, then npm test and npm run lint
  • Related docs: docs/ARCHITECTURE.md, .github/CONTRIBUTING.md

Filed by repo-audit/full-audit at 8a2c86c. Severity: medium. Effort: S. audit-key: enhancement|js/game.js|updateMoveHistoryDisplay

Dominant language
JavaScript
Stars
4
Forks
2
PR merge metrics
No merged PRs in 30d

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from TMHSDigital/Static_Chess

All issues in TMHSDigital/Static_Chess

Similar issues

More JavaScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.