0.1.5 • Published 2 years ago

@treasure-chess/chess-achievements v0.1.5

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

Calculate achievements for a chess game.

Install

yarn add @treasure-chess/chess-achievements

npm i @treasure-chess/chess-achievements

Usage

Note: only the "Standard" game rule variant is supported.

Arguments:

  • pgn - pocket game notation for the game.
  • playerColor - Either "white" or "black".
import achievementsCalculator from '@treasure-chess/chess-achievements';

const {
  opening,
  score,
  achievements,
  allAchievements
} = achievementsCalculator(pgn, playerColor);

Returns:

  • opening - See /eco-codes.json for the full list.
  • score - Sum of points for the top 3 achievements earned by playerColor.
  • achievements - Top 3 achievements earned by playerColor.
  • allAchievements - All achievements earned by playerColor.

Achievements and Tested Sample PGNs

numbernamedescriptionpoints
0n/a(empty achievement)0
1PlayerPlay a game1
2750+ WinnerWin a game against opponent rated 750+2
3Played 750+Play a game against opponent rated 750+1
41500+ WinnerWin a game against opponent rated 1500+3
5Played 1500+Play a game against opponent rated 1500+2
6Played 2000+Play a game against opponent rated 2000+3
7Big WinnerWin a game against opponent rated 2000+4
8Strongest OpponentPlay a game against opponent rated 2250+4
9Mythic WinnerWin a game against opponent rated 2250+5
10Defeat an IMDefeat an IM4
11Defeat a NMDefeat a NM3
12Defeat a GMDefeat a GM5
13Criss CrossMate with a bishop4
14JoustingMate with a knight4
15Utter DisrespectMate with a pawn4
16Triple Digit ClubComplete a game with more than 100 moves3
17ExcessiveComplete a game with more than 150 moves4
18UltramarathonersComplete a game with more than 250 moves5
19Opening ExpertWin with checkmate in less than 10 moves2
20Don't BlinkWin with checkmate in <5 moves3
21Fool's MateWin with checkmate in 2 moves5
22Leveled FieldDraw with a higher rated player2
23Hello, m'ladyQueen side castle1
24Horse FarmerUnder-promote to a knight3
25Holy PromotionUnder-promote to a bishop5
26The Sneaky PawnEn Passant2
27God-Mode GlitchCheckmate with an En Passant5
28Cutting it CloseDraw when opponent has a queen, without one4
29Déjà VuDraw by repetition1
30The UnderdogDefeat a higher rated player3
31Checkin' You OutPut opponent in check1
32Pawn ShyCapture <4 pawns1
33Pawn ShopperCapture all pawns2
34A Minor ProblemCapture all knights and bishops without losing any.5
35Mr. Marathon ManMove king >20 times1
36Pawn HoarderCapture all pawns without losing any5
37WinnerWin a game2

This one is for testing, and verifying the achievements

AchievementDescriptionExample PGNColor
Scrub DubWin a game11Black
Participation MedalPlay a game8White
Semi-Scrub DubWin a game against opponent rated 750+7Black
Participation MedalPlay a game against opponent rated 750+10White
Mediocre DubWin a game against opponent rated 1500+9Black
Participation MedalPlay a game against opponent rated 1500+6Black
Participation MedalPlay a game against opponent rated 2000+22White
Decent DubWin a game against opponent rated 2000+12Black
Participation MedalPlay a game against opponent rated 2250+2Black
Poggers DubWin a game against opponent rated 2250+2White
Criss CrossMate with a bishop24Black
Horsey Move in LMate with a knight6White
Utter DisrespectMate with a pawn20White
Triple Digit ClubComplete a game with more than 100 moves23White
ExcessiveComplete a game with more than 150 moves16White
Nothing Better to DoComplete a game with more than 250 moves15White
Yeah, I'm GoodWin with checkmate in less than 10 moves13Black
for real, bro?Win with checkmate in <5 moves14White
Fool's MateWin with checkmate in 2 moves12Black
Emotional DubDraw with a higher rated player3White
Hello, m'ladyQueen side castle3White
Horse FarmerUnder-promote to a knight17Black
Troll PromotionUnder-promote to a bishop18White
The Game GlitchedEn Passant5Black
God-Mode GlitchCheckmate with an En Passant9Black
Cutting it CloseDraw when opponent has a queen, without one8Black
Déjà VuDraw by repetition3White
ELO is a MindsetDefeat a higher rated player19White
Checkin' You OutPut opponent in check2White
Pawn ShyCapture <4 pawns3White
Pawn ShopperCapture all pawns15White
A Minor ProblemCapture all knights and bishops without losing any24Black
Mr. Marathon ManMove king >20 times5White
Pawn HoarderCapture all pawns without losing any21Black

🤝 Contributing

Contributions, issues and feature requests are welcome! Please adhere the rToken project community code of conduct.

Add achievements, in order, to the list in index.js. Run tests with the command:

npm run test

Show your support

Give a ⭐️ if this project helped you!

Contributors ✨

👤 Treasure Chess Community maintainers@niftychess.com

📝 License

Copyright © 2021 Nifty Chess, Inc. This project is MIT licensed.


This README was generated with ❤️ by readme-md-generator