Skip to content

Commit acba725

Browse files
committed
updates + mona lisa checkmate trophy
1 parent 24cd71c commit acba725

25 files changed

+77977
-43528
lines changed

.prettierignore

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
*.json
2+
pnpm-lock.yaml
23

34
coverage
45
dist

README.md

+5-5
Original file line numberDiff line numberDiff line change
@@ -11,20 +11,20 @@ Your browser makes the request directly to the Lichess API to get the games. The
1111
```bash
1212
git clone https://github.com/fitztrev/rosen-score.git
1313
cd rosen-score
14-
npm install
15-
npm run dev
14+
pnpm install
15+
pnpm run dev
1616
```
1717

1818
Will start a local server at http://localhost:5173/
1919

2020
```bash
2121
## Run the test suite
22-
npm run test
22+
pnpm run test
2323
## or
24-
npm run watch
24+
pnpm run test:watch
2525

2626
## Check code coverage
27-
npm run coverage
27+
pnpm run coverage
2828
open coverage/index.html
2929
```
3030

js/App.vue

+12-1
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@
127127
</div>
128128
</form>
129129

130-
<!-- <RecentUpdates @form-fill="formFill" /> -->
130+
<RecentUpdates @form-fill="formFill" />
131131
</div>
132132

133133
<download-progress
@@ -556,6 +556,14 @@
556556
:trophies="playerTrophiesByType['checkmateAtMoveNumber:4'] || {}"
557557
gameLink="https://lichess.org/u0SKphmW/black"
558558
></accomplishment-score>
559+
<accomplishment-score
560+
@register-new-trophy="onRegisterNewTrophy"
561+
title="Mona Lisa Checkmate"
562+
desc="Checkmate the opponent with all your pieces on their original squares"
563+
:trophies="playerTrophiesByType['monaLisaCheckmate'] || {}"
564+
gameLink="https://www.chess.com/analysis/game/live/121711253019?tab=analysis&flip=false"
565+
youtubeLink="https://www.youtube.com/watch?v=XAlcDWQ6iTM"
566+
></accomplishment-score>
559567
</div>
560568

561569
<h2 class="heading">There's a Funny Line</h2>
@@ -753,6 +761,7 @@ import { rosenTrap } from './goals/rosen-trap'
753761
import { alphabetOpening } from './goals/alphabet-openings'
754762
import { PlayerTrophiesByType, ReportSource, TrophyCacheFile, TrophyCheckResult } from './types/types'
755763
import { formatSinceDate } from './utils/format-since-date'
764+
import { monaLisaCheckmate } from './goals/mona-lisa-checkmate'
756765
757766
const wait = (ms: number) => new Promise((resolve) => setTimeout(resolve, ms))
758767
@@ -965,6 +974,7 @@ export default {
965974
caches.set('https://www.chess.com/member/knvb', '/cache/chesscom/knvb.json')
966975
caches.set('https://www.chess.com/member/magnuscarlsen', '/cache/chesscom/magnuscarlsen.json')
967976
caches.set('https://www.chess.com/member/saltyclown', '/cache/chesscom/saltyclown.json')
977+
caches.set('https://www.chess.com/member/witty_alien', '/cache/chesscom/witty_alien.json')
968978
969979
if (!caches.has(url)) {
970980
return
@@ -1188,6 +1198,7 @@ export default {
11881198
this.checkForTrophy(game, 'winInsufficientMaterial', winInsufficientMaterial(game, fen), game.moves.length)
11891199
this.checkForTrophy(game, 'clutchPawn', clutchPawn(game, fen), game.moves.length)
11901200
this.checkForTrophy(game, 'doubleCheckCheckmate', doubleCheckCheckmate(game, fen), game.moves.length)
1201+
this.checkForTrophy(game, 'monaLisaCheckmate', monaLisaCheckmate(game, fen), game.moves.length)
11911202
},
11921203
},
11931204
}

js/components/AccomplishmentScore.vue

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
class="px-3 py-2 rounded text-center"
44
:class="{
55
'bg-green-600': hasTrophies,
6-
'bg-yellow-300 text-yellow-800 accomplishment-does-not-have-games': !hasTrophies,
6+
'bg-yellow-400 text-yellow-800 accomplishment-does-not-have-games': !hasTrophies,
77
}"
88
>
99
<span @click.prevent="isExpanded = !isExpanded" class="hover:underline cursor-pointer">{{ title }}</span>

js/components/RecentUpdates.vue

+6-24
Original file line numberDiff line numberDiff line change
@@ -2,30 +2,12 @@
22
<div class="border-t border-gray-300 mt-4 text-bold font-bold pt-2">Recent Updates</div>
33
<ul class="text-sm">
44
<li>
5-
<changelog-date :year="2023" :month="4" :day="23"></changelog-date>
6-
- Added support for <strong>Chess.com</strong>
7-
- See
8-
<span class="dotted-underline text-sky-900 cursor-pointer" @click.prevent="formFill('chesscom', 'Hikaru')">Hikaru</span>,
9-
<span class="dotted-underline text-sky-900 cursor-pointer" @click.prevent="formFill('chesscom', 'GothamChess')">GothamChess</span>,
10-
<span class="dotted-underline text-sky-900 cursor-pointer" @click.prevent="formFill('chesscom', 'DanielNaroditsky')"
11-
>DanielNaroditsky</span
12-
>,
13-
<span class="dotted-underline text-sky-900 cursor-pointer" @click.prevent="formFill('chesscom', 'AlexandraBotez')">AlexandraBotez</span>,
14-
and others
15-
</li>
16-
<li>
17-
<changelog-date :year="2023" :month="4" :day="23"></changelog-date>
18-
- Added
19-
<a href="https://lichess.org/g9MdhRYy/black#126" target="_blank" class="dotted-underline text-sky-900 cursor-pointer"
20-
>"Checkmate with 0.1 seconds" trophy</a
21-
>
22-
</li>
23-
<li>
24-
<changelog-date :year="2023" :month="3" :day="17"></changelog-date>
25-
- Added
26-
<a href="https://lichess.org/VwNKF7ie#121" target="_blank" class="dotted-underline text-sky-900 cursor-pointer"
27-
>"Flag Opponent Who Had Mate in 1" trophy</a
28-
>
5+
<changelog-date :year="2024" :month="11" :day="13"></changelog-date>
6+
- Added <strong>Mona Lisa Checkmate</strong> trophy
7+
<br>
8+
&nbsp; Credit to
9+
<span class="dotted-underline text-sky-900 cursor-pointer" @click.prevent="formFill('chesscom', 'KNVB')">GM Aman Hambleton</span>
10+
from Chessbrah. <a href="https://www.youtube.com/watch?v=XAlcDWQ6iTM" class="dotted-underline text-sky-900" target="_blank">See video here</a>
2911
</li>
3012
</ul>
3113
</template>

js/goals/setup-checkmate.ts js/goals/mona-lisa-checkmate.ts

+2-5
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,12 @@
11
import { Game } from 'chess-fetcher'
22
import { TrophyCheckResult } from '../types/types'
3-
import { fenToPosition } from '../utils/fen-to-position'
43

5-
export function originalSetupCheckmate(game: Game, fen: string): TrophyCheckResult {
4+
export function monaLisaCheckmate(game: Game, fen: string): TrophyCheckResult {
65
if (game.result.via !== 'checkmate') {
76
return []
87
}
98

10-
let position = fenToPosition(fen)
11-
12-
if (position.startsWith('rnbqkbnr..K') || position.endsWith('k.....RNBQKBNR')) {
9+
if (fen.startsWith('8/8/8/8/8/8/2k5/RNBQKBNR') || fen.startsWith('rnbqkbnr/2K5/8/8/8/8/8/8')) {
1310
return [
1411
{
1512
color: game.result.winner === 'white' ? 'w' : 'b',

0 commit comments

Comments
 (0)