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

gavel.js

v0.9.1

Published

An adjudicator for the rules of the Diplomacy board game implemented in coffee script.

Downloads

3

Readme

What is This?

Gavel is a library which adjudicates orders in the game Diplomacy. It was written for use with the Dead Potato application which is currently still in development. The implementation is based loosely on The Math of Adjudication by Lucas Kruijswijk.

Developer Documentation

Important Conventions

The variables from, to, target, supporter, and convoyer by convention denote a region (just like you would expect in the regular game). type typically denotes the type of an order (MOVE, SUPPORT, CONVOY).

Modules

CycleException: Used to indicate that a cycle has occurred in the sequence of recursive calls in the course of order resolution.

CycleGuard: Implementation allows us to kick off a mutual recursion and then detect and handle scenarios where a cyclic recursion occurred. Intended to simplify situations which are naïvely recursive but where cycles can occur in the recursion. In this way, we can outline a strategy for dealing with these cycles and keep the underlying recursion simple.

DATC: Handles running the DATC compliancy tests which are a series of published tests intended to verify new adjudication tools. They can be found here.

Engine: A facade into the underlying functionality of the library. Should contain a minimum of its own functionality and should be mosty focused on integrating other components.

Resolver: Responsible for low level adjudication of orders according to the rules. Doesn't know about orders formats, map data, etc. except via other components but is solely responsible for the logical aspects of adjudication.

Contains attackStrength, defendStrength, holdStrength, holdStrength, preventStrength, support which correspond to the described values in The Math of Adjudication.

Resolver.ordersWhere: Fast way to get orders with certain constraints. When we call this function it's almost always to find other orders that will affect the order currently being adjudicated. As such, we almost never want to consider the current order in our results so we take it as the first argument which makes the function signature slightly more confusing but is much more convenient.

describe: Convert logics to human readable text to use as output for testing. E.g. some object describing orders gets translated into "Turkey Moves A to Romania".

parseOrder: What it sounds like - parse orders provided in a text format and convert them to useful objects. Primarily useful for testing.

Board: Passed to the engine to give it information about the map and the current state of the game. Tells the engine everything that it needs to know except for what the rules of the game are and how to resolve them. E.g. answers questions about which regions are adjacent to which, which player owns which units, etc.