npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

analyze-chess-games

v1.7.10

Published

Download your chess games in bulk and discover what sorts of mistakes you make most often.

Downloads

8

Readme

Analyze Your Chess

Download your chess games in bulk and discover what sorts of mistakes you make most often.

Install

Run npm i analyze-chess-games.

Create cards

Node.js

const { analyzeChessGames } = require('analyze-chess-games')
const { cards, report } = await analyzeChessGames({
    user: 'felice_golfing',
    count: 100, // Optional number of cards to make
    games:  100, // Optional number of games to analyze
    engineDepth: 18, // Optional engine depth
    blunderThresholdCentipawns: 200, // Optionanal blunder threshold in centipawns
    quiet: false, // Turn off progress bars?
})

Alternately, using Promise syntax:

const { analyzeChessGames } = require('analyze-chess-games')
analyzeChessGames({
    user: 'felice_golfing',
    count: 100, // Optional number of cards to make
    games:  100, // Optional number of games to analyze
    engineDepth: 18, // Optional engine depth
    blunderThresholdCentipawns: 200, // Optionanal blunder threshold in centipawns
    quiet: false // Turn off progress bars?
}).then(({cards, report})=>{
    // Do stuff
})

Here cards is an array of cards from the mistakes you've made, and report is a document with some high-level insights about your play.

CLI

Run

analyze-chess-games analyze --user <chess.com username>  [-t <time control, eg 600 or 600+10>]
[-g <number of games to analyze>] [-d <engine depth>] [-b <centipawn threshold for blunders>] [-c <number of cards] 
[-o output file for cards] [-p output file for report] [-k cache file to write to] [-j cache file to read from]
[--quiet]

For example:

analyze-chess-games analyze --user felice_golfing
-c 100 -o cards.json

The analysis will be performed in parallel in the cloud (up to about 100 games at a time) so even though game analysis can take a while, you won't have to wait too long!

You can run analyze-chess-games help for the complete list of commands.

Development

You will want to create a .env file in the root directory with some parameters. Here is an example file you could use:

CACHE_ANALYSIS=cache/analysis.json
BLUNDER_THRESHOLD_CENTIPAWNS=200
ENGINE_ANALYSIS_DEPTH=18
CHESS_SITE=chess.com
CHESS_USERNAME=felice_golfing
GAME_HISTORY_COUNT=5

LAMBDA_FUNCTION_DEPLOY=blunder-invariants-analyze

Deploy to Lambda

While you can perform analysis locally, this can be slow. So, if you have an AWS account, you can create a Lambda function there named "blunder-invariants-analyze" (or whatever value you set for LAMBDA_FUNCTION_DEPLOY in your .env) and then run bash scripts/deploy_analysis_lambda.sh to set up the lambda function there. (This assume that you have the AWS CLI installed).

Then, you can set the environment variable ANALYZE_IN_LAMBDA=1 to significant speed up analysis. As a rule of thumb, you can can expect a speedup of around 50X (which means you can analyse 50X more games!)