johnameyer / cards-ts

A card game framework and various games in Typescript. The framework allows for bot development and playing card games in the terminal or in a browser.
MIT License
7 stars 2 forks source link
card-game card-games cards javascript typescript typescript-library

Cards-TS

[![Github CI](https://img.shields.io/github/actions/workflow/status/johnameyer/cards-ts/ci.yml?logo=github)](https://github.com/johnameyer/cards-ts/actions) [![npm version](https://img.shields.io/npm/v/@cards-ts/core?logo=npm)](https://www.npmjs.com/package/@cards-ts/core) [![GitHub Last Commit](https://img.shields.io/github/last-commit/johnameyer/cards-ts?logo=github)](https://github.com/johnameyer/cards-ts) [![Typescript](https://img.shields.io/github/languages/top/johnameyer/cards-ts?logo=typescript)]() [![Documentation](https://img.shields.io/static/v1?label=docs&message=hosted&color=informational&logo=typescript)](https://johnameyer.github.io/cards-ts)

This is a card game framework and various card game implementations. The core package contains the framework and useful components, including functionality to display a card game in the command line. The various other packages are card game implementations.

Can I Have That is a house variation on Continental Rummy. Hearts and Euchre are trick-taking games. Other implementations of card games or expansions of the core library are welcome.

Getting Started

We use pnpm workspaces to support a number of games on top of the core library. See the documentation pages here or see the wiki articles here.

Running a card game with npx

npx @cards-ts/hearts # or can-i-have-that, etc.

Running a card game locally

Building

pnpm i # typically only needed the first time
pnpm buildall # use "--include-dependencies --scope=@cards-ts/$GAME" to just build the game dependencies

Running

GAME=can-i-have-that # or hearts, etc.
pnpm start --filter=@cards-ts/$GAME

or

GAME=can-i-have-that # or hearts, etc.
cd packages/$GAME
pnpm start

Testing

The tests in spec folder test that each game exports a minimum number of fields and that the bots will be able to complete the game successfully (Run with pnpm start in the folder locally). Each package can also contain a spec folder as well for unit testing components with mocha (Run all with pnpm testall or in a package with pnpm test).

Versioning

We use SemVer for versioning. For the versions available, see the tags on this repository.

Authors

See also the list of contributors who participated in this project.