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

pdchess3

v0.0.3

Published

A rudimentary chess engine and command-line interface.

Downloads

19

Readme

pdchess3

pdchess3 : Portable Didactic Chess, incarnation number 3.

A rudimentary chess engine and command-line interface. Written in TypeScript for Node.js and npm.

Obligatory BadgeFest:

build status npm version latest tag npm total downloads watchers stars forks repo dependents pkg dependents commits last commit types install size known vulnerabilities lines of code technical debt maintainability test coverage tested with jest code style: prettier license FOSSA Status

Building pdchess3

To build pdchess3 and install the command-line interface, do this:

npm run all
npm link

Launching pdchess3

After npm link has been run, pdchess3 can be invoked from the command line using this syntax:

pdchess3 [White player configuration] [Black player configuration]

... where each player's configuration is in one of two forms:

  • h: Human. The player's moves will be entered via the standard input.
  • c [max ply]: Computer. The player's moves will be calculated by pdchess's game engine, using 'max ply' as the initial basic maximum lookahead depth.

For example, if you want to play White while the computer plays Black, you could do this:

pdchess3 h c 5

If you want the computer to play a slow game against itself, you could do this:

pdchess3 c 6 c 6

You can use nice to launch the pdchess3 process with a lower priority; e.g.:

nice -n 20 pdchess3 c 5 c 5

Playing pdchess3

A fairly standard command syntax is used to specify moves; e.g.:

  • e2-e4 : An initial pawn move by White
  • Ng8-f6 : An initial knight move by Black
  • Qa1xd8 : A capturing move by a queen
  • O-O : Castle on the kingside
  • O-O-O : Castle on the queenside

Type 'exit' at the move prompt to end the game and exit the app.

Example

$ pdchess3 h c 5

8 rnbqkbnr
7 pppppppp
6  + + + +
5 + + + + 
4  + + + +
3 + + + + 
2 PPPPPPPP
1 RNBQKBNR

  abcdefgh

Move 1: White
> e2-e4

Matched the manual move 'e2-e4' in the opening book.
Elapsed time for this move: 2 milliseconds
White's move: e2-e4

8 rnbqkbnr
7 pppppppp
6  + + + +
5 + + + + 
4  + +P+ +
3 + + + + 
2 PPPP PPP
1 RNBQKBNR

  abcdefgh

Move 1: Black
Opening: Nimzovich Defence
Black: Automated: Using this move from the opening book: b8-c6
Elapsed time for this move: 1 millisecond
Black's move: b8-c6

8 r+bqkbnr
7 pppppppp
6  +n+ + +
5 + + + + 
4  + +P+ +
3 + + + + 
2 PPPP PPP
1 RNBQKBNR

  abcdefgh

Move 2: White
> exit
Exiting...

$

History

  • I witnessed the University of Waterloo host a tournament of Othello (Reversi)-playing programs in 1992; these programs played each other by sending game data over the Internet.
  • After creating my own rudimentary Othello-playing program in C, I chose chess as the next problem domain to tackle. The result was incarnation number 1 of pdchess, which was written in C in 1993. I began the project during my university exams in April. This version had a console interface. I started developing it on the univerity's Unix computers, then e-mailed the source code to my e-mail address at Digital Equipment of Canada in Ottawa, where I worked during the summer of 1993. At Digital, I ported the code to compile and run on the VAX/VMS operating system, and I continued development. In August 1993, I e-mailed the source code back to Waterloo. Just before finishing my final term in April 1994, I copied the source code to a 3.5-inch floppy and took it with me.
  • During the summer of 1994, I modified the code to work on my brand-new computer (an Intel 80486SX PC clone running Windows 3.1, with 640 KB + 3072 KB of RAM and a 360 MB hard drive, plus 3.5-inch and 5.25-inch floppy drives) via Borland Turbo C++ 3.1. I created a GUI for pdchess using Turbo C++'s OWL (Object Windows Library) framework. (OWL was analogous to Microsoft's MFC.)
  • Incarnation number 2 of pdchess was written in C++ in 2002, after I had read Bjarne Stroustrup's book on the language.
  • Incarnation number 3 of pdchess was written in Typescript in Beijing, China in February and March 2020, during the COVID-19 coronavirus pandemic.
  • pdchess is also known to some as 'partly done chess'. :-)

TODO

Jest will set process.env.NODE_ENV to 'test' if it's not set to something else. You can use that in your configuration to conditionally setup only the compilation needed for Jest, e.g.

// babel.config.js
module.exports = api => {
  const isTest = api.env('test');
  // You can use isTest to determine what presets and plugins to use.
  // If isTest then target es2015; else target es6 (to support Angular 10).

  return {
    // ...
  };
};

-> ? Use Webpack, then use Jest to test the Webpacked version of pdchess3?

License

MIT