bridge.js

Javascript model for contract (duplicate) bridge

Usage no npm install needed!

<script type="module">
  import bridgeJs from 'https://cdn.skypack.dev/bridge.js';
</script>

README

bridge

Travis build status Coverage Status npm version

A javascript model for contract (duplicate) bridge.

The change log is automatically produced with the help of semantic-release.

Getting started

bridge.js is available for both node.js and the browser. Most modern browsers are supported. If you want to know if your browser is compatible, run the online test suite.

Install with npm

> npm install bridge.js --save

Node

Include the package

var bridge = require('bridge.js')

Use it to deal a random game

var hands = new bridge.Deck()
    .shuffle()
    .deal(bridge.seat.west);
console.log(hands.north)

Browser

Include the package from your project

<script src="./node_modules/bridge.js/dist/bridge.min.js" type="text/javascript"></script>

or from the unpkg CDN

<script src="https://unpkg.com/bridge.js/dist/bridge.min.js"></script>

This will provide bridge as a global object, or define it if you are using AMD.

<script>
  var hands = new bridge.Deck()
      .shuffle()
      .deal(bridge.seat.west);
  alert("North's hand  " + hands.north);
</script>