Add a flip board option

Open
#57 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
76/100
Issue type
Feature
Clarity
Clearly specified
Activity status
Active
Tech stack
css, html, javascript
Domain
frontend, web-dev

Research direction

Read js/board.js around createBoard and the keyboard handler, then inspect settings wiring in js/main.js, the toggles in index.html, and board styling in css/board.css. Run npm test and npm run lint as the issue describes. Done when the flip toggle persists after reload and the coordinates and arrow-key movement match the displayed orientation.

Written by the indexing model from the issue text.

Description

enhancement good first issue severity: low

Summary

The board is always drawn with White at the bottom. With two people sharing one device, Black always plays upside down, and a flip option becomes necessary once a player can choose Black against a computer.

Where

  • js/board.js:16-27 (createBoard appends squares in a fixed order)
  • index.html:28-57 (settings panel, four toggles, none for orientation)

Proposal

Add a "Flip board" toggle, persisted like the other settings. Squares carry data-row and data-col and lookups go through getSquareElement, so flipping can be done in presentation only: a class on the board that reverses the grid order, or a reversed append order in createBoard. Check that coordinate labels and the arrow-key directions in the keyboard handler (js/board.js:111-127) follow the visual orientation. Optional: flip automatically each turn.

Who benefits

The player with the black pieces.

Acceptance criteria

  • A toggle flips the board and the choice survives a reload
  • Coordinates and arrow keys match what is on screen

Getting started

  • Relevant files: js/board.js, js/main.js, index.html, css/board.css
  • 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: low. Effort: S. audit-key: enhancement|js/board.js|createBoard.orientation

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.