|
1 |
| -# ChessHue |
| 1 | +ChessHue |
| 2 | +======== |
| 3 | + |
| 4 | +### GUI for analysis of chess games, with automatic move grading. ### |
| 5 | + |
| 6 | +Created to make post-game analysis as convenient as in the browser, but faster. |
| 7 | + |
| 8 | + |
| 9 | + |
| 10 | + |
| 11 | +Unique features |
| 12 | +--------------- |
| 13 | + |
| 14 | +* ChessHue registers `chess://` protocol handler, |
| 15 | + which makes it easy to start the application directly from the browser, |
| 16 | + after any game on sites like Chess.com or Lichess, with the PGN automatically filled in. |
| 17 | + See [below](#running-from-the-browser) for details. |
| 18 | + |
| 19 | +* Engines usually evaluate moves that result in repeating a given position the same as the actual winning moves, |
| 20 | + which makes it harder to see what should've been played to convert the advantage. |
| 21 | + In ChessHue there's an option called "Prevent repetitions", |
| 22 | + which fools the engine into thinking that the position has already appeared twice and so the next repetition would be a draw. |
| 23 | + |
| 24 | +* Other applications classify your moves as mistakes, blunders, etc. |
| 25 | + Since these categories are arbitrary and impossible to define unambiguously, |
| 26 | + ChessHue rates moves using a continuous color scale instead. |
| 27 | + |
| 28 | + |
| 29 | +Requirements |
| 30 | +------------ |
| 31 | + |
| 32 | +* [Node.js](https://nodejs.org/) (tested with version 20) |
| 33 | +* Chess engine: any UCI-compliant engine should theoretically work, |
| 34 | + but only [Stockfish](https://stockfishchess.org/download/) has been tested. |
| 35 | +* OS: any modern OS should theoretically work, but only Windows has been tested. |
| 36 | + |
| 37 | + |
| 38 | +How to use |
| 39 | +---------- |
| 40 | + |
| 41 | +1. Download your favourite chess engine, rename the executable to `engine.exe`, |
| 42 | + and put it in the root folder of the project. |
| 43 | + |
| 44 | +2. Run `npm install` and `npm run build`, then `npm start` to start ChessHue. |
| 45 | + |
| 46 | + |
| 47 | +Running from the browser |
| 48 | +------------------------ |
| 49 | + |
| 50 | +After ChessHue is run once, the next time it can be started using the `chess://` protocol. |
| 51 | +You can pass your PGN in the URL, like `chess://e4 e5/`. |
| 52 | + |
| 53 | +To analyse your games in ChessHue right after they end: |
| 54 | + |
| 55 | +1. Install a browser extension that can inject JavaScript code on any website, |
| 56 | + like [Code Injector](https://github.com/Lor-Saba/Code-Injector). |
| 57 | + |
| 58 | +2. Depending on whether you play on Chess.com or Lichess, set up one of the following snippets to inject: |
| 59 | + |
| 60 | + * Code for Chess.com: |
| 61 | + |
| 62 | + ```js |
| 63 | + document.addEventListener('keydown', e => { |
| 64 | + if (e.key === 'l' && document.querySelector('.game-review-buttons-component')) { |
| 65 | + const nodes = document.querySelectorAll('wc-vertical-move-list [data-ply].node'); |
| 66 | + if (nodes.length > 0) { |
| 67 | + const moves = [...nodes].map(e => e.textContent); |
| 68 | + const clock = document.querySelector('.clock-bottom'); |
| 69 | + const color = clock.classList.contains('clock-black') ? 'b' : 'w'; |
| 70 | + const url = `chess://${moves.join(' ')}/${color}`; |
| 71 | + window.open(url.replace('#', '%23'), '_blank'); |
| 72 | + } |
| 73 | + } |
| 74 | + }); |
| 75 | + ``` |
| 76 | + |
| 77 | + * Code for Lichess: |
| 78 | + |
| 79 | + ```js |
| 80 | + document.addEventListener('keydown', e => { |
| 81 | + if (e.key === 'l' && document.querySelector('.rematch')) { |
| 82 | + const nodes = document.querySelectorAll('l4x kwdb'); |
| 83 | + if (nodes.length > 0) { |
| 84 | + const moves = [...nodes].map(e => e.textContent); |
| 85 | + const clock = document.querySelector('.rclock-bottom'); |
| 86 | + const color = clock.classList.contains('rclock-black') ? 'b' : 'w'; |
| 87 | + const url = `chess://${moves.join(' ')}/${color}`; |
| 88 | + window.open(url.replace('#', '%23').replace(/½\?/g, ''), '_blank'); |
| 89 | + } |
| 90 | + } |
| 91 | + }); |
| 92 | + ``` |
| 93 | + |
| 94 | +3. After your game, press <kbd>L</kbd> to start ChessHue with the moves imported automatically. |
| 95 | + |
| 96 | + Note that the code prevents you from accidentally starting the application during the game. |
0 commit comments