Atomk / chess-js

The chess game everyone knows and loves, in vanilla JavaScript.

Home Page:https://atomk.github.io/chess-js/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

chess-js

The chess game everyone knows and loves, in vanilla JavaScript. Try it out!

Features

  • Chess variants (6x6, 5x5)
  • Basic AI
  • Basic pawn promotion (always promoted to queens)

Notes

  • The icons used for the pieces are just Unicode characters, they may look different depending on your device/browser. By default they should be displayed as text. Most systems have only an emoji for the pawn, Samsung created an emoji for every single piece. On Microsoft Edge you'll see only the pawn displayed as emoji and the other pieces as text. On Chrome everything seems to work the way it is intended.

    Windows 10 (Chrome) Samsung
    Screenshot on Windows 10 Screenshot on Samsung
  • I used mostly ES6 features (arrow functions, let, const, class, template strings) without using any transpiler, which means some old browsers like Internet Explorer are not supported.

Mistakes

  • Just "going with the flow", not planning many things ahead. This approach is more fun since things are discovered and done step-by-step, but as the project got bigger I realized how planning things ahead would have saved a few of hours of refactoring.
  • Not using classes from the start, or at least modules, to separate responsibilities. I ended up with almost 1000 lines of code in the same scope, a bit of organization is necessary to keep things manageable.

To-do

About

The chess game everyone knows and loves, in vanilla JavaScript.

https://atomk.github.io/chess-js/

License:MIT License


Languages

Language:JavaScript 81.2%Language:CSS 10.6%Language:HTML 8.3%