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

walnut-chess

v0.1.11

Published

DSL for generating chess problem cards

Downloads

2

Readme

🌰 Walnut - DSL for generating chess problem cards

Build Status codecov

Walnut is a DSL (domain specific language) for generating chess problem cards. Walnut supports algebraic chess notation, so the language is intuitively understandable. You can generate cards in different formats whether graphic or html.

DSL

Cards are generated via creating .walnut source code file. Currently DSL contains 3 parts:

  • LOCALIZATION localization configuration. You can choose english - latin letters(EN) or russian(RU) - Cyrillic
  • COLORS colors configuration with standard hex string colors (squares, pieces, border, symbols)
  • WHITE POS, BLACK POS declaration of pieces on board via algebraic notaion
LOCALIZATION: EN
COLORS:
  white squares: #f9c48d
  black squares: #84271d
  white pieces: #c38748
  black pieces: #150503
  border: #a73a2f
  symbols: #efefef

WHITE POS: Ra1,Nb1,Bc1,Qd1,Ke1,Bf1,Ng1,Rh1,a2,b2,c4,d2,e2,f2,g2,h2
BLACK POS: Ra8,Nb8,Bc8,Qd8,Ke8,Bf8,Ng8,Rh8,a7,b7,c7,d7,e7,f7,g7,h7

You can skip specification of LOCALIZATION, it will default to EN. Also you can skip specification of COLORS, walnut default theme will be used. So at minimum you source file would look as following:

WHITE POS: Ra1,Nb1,Bc1,Qd1,Ke1,Bf1,Ng1,Rh1,a2,b2,c4,d2,e2,f2,g2,h2
BLACK POS: Ra8,Nb8,Bc8,Qd8,Ke8,Bf8,Ng8,Rh8,a7,b7,c7,d7,e7,f7,g7,h7

CLI

To generate cards you can use our command line interface, it does not require you to write any additional code. Basic command is walnut-chess, you can run it straight from terminal if you use unix os, if you use Windows you can add npx walnut-chess to run it from terminal. Or you can also create npm script with the command:

"scripts": {
  "walnut:start": "walnut-chess"
}

Arguments:

  • --help - see all avavilable attributes and their purpose.
  • --source or -s - specify path to source code .walnut file
  • --out or -o - specify path and file name of output file
  • --size - specify the size of a card in pixels (for image outputs only)
  • --html - generate into html file
  • --jpeg - generate into jpeg file
  • --png - generate into png file
  • --tiff - generate into tiff file
  • --webp - generate into webp file
  • --xml - generate into xml file
  • --json - generate into json file
  • --version - check package version

Note: json and xml output files contain output from our parser and could be used for development or other transformations, all other output options create ready visual chess cards.

Examples

  • Let's look in the default example from above:
LOCALIZATION: EN
COLORS:
  white squares: #f9c48d
  black squares: #84271d
  white pieces: #c38748
  black pieces: #150503
  border: #a73a2f
  symbols: #efefef

WHITE POS: Ra1,Nb1,Bc1,Qd1,Ke1,Bf1,Ng1,Rh1,a2,b2,c4,d2,e2,f2,g2,h2
BLACK POS: Ra8,Nb8,Bc8,Qd8,Ke8,Bf8,Ng8,Rh8,a7,b7,c7,d7,e7,f7,g7,h7
  • Now we can change some colors:
LOCALIZATION: EN
COLORS:
  white squares: #f1f1f1
  black squares: #403b35
  white pieces: #b9b9b9
  black pieces: #c78a00
  border: #131313
  symbols: #7d691e

WHITE POS: Ra1,Nb1,Bc1,Qd1,Ke1,Bf1,Ng1,Rh1,a2,b2,c4,d2,e2,f2,g2,h2
BLACK POS: Ra8,Nb8,Bc8,Qd8,Ke8,Bf8,Ng8,Rh8,a7,b7,c7,d7,e7,f7,g7,h7
  • Here is an example with Russian localization and four knights game
LOCALIZATION: RU
COLORS:
  white squares: #f9c48d
  black squares: #84271d
  white pieces: #c38748
  black pieces: #150503
  border: #a73a2f
  symbols: #efefef

WHITE POS: Ла1,Кв3,Св1,Фг1,Крд1,Се1,Ке3,Лз1,а2,б2,в2,г4,д2,е2,ж2,з2
BLACK POS: Ла8,Кв6,Св8,Фг8,Крд8,Се8,Ке6,Лз8,а7,б7,в7,г5,д7,е7,ж7,з7