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

splinterlands-simulator

v3.0.28

Published

Simulator for battles in the Splinterlands game

Downloads

47

Readme

Splinterlands Simulator

Simulator for battles in the Splinterlands game.

NPM package

GitHub

Installation and Setup

To install via NPM use:

npm install splinterlands-simulator

A simple game can be created like so

const mylor = new GameSummoner(/* id */ 259, /* level */ 3);
const nectarQueen = new GameMonster(/* id */ 226, /* level */ 2);
const teamOne = new GameTeam(mylor, [nectarQueen]);

const tarsa = new GameSummoner(/* id */ 440, /* level */ 2);
const chicken = new GameMonster(/* id */ 131, /* level */ 1);
const forgottenOne = new GameMonster(/* id */ 404, /* level */ 1);
const teamTwo = new GameTeam(tarsa, [chicken, forgottenOne]);

const rules = new Set([Ruleset.BACK_TO_BASICS, Ruleset.LOST_LEGENDARIES]);
const game = new Game(teamOne, teamTwo, rules, /* shouldLog */ true);
game.playGame();

const winner = game.getWinner();
const logs = game.getBattleLogs();

Configuration

The Game constructor takes in shouldLog as an optional fourth parameter. If set to true, the game logs can be retrieved using game.getBattleLogs(). This returns an array of BattleLogs. The logs will contain the action, and the snapshot of the relevant monsters after the action has taken place.

It is recommended to get the cards using https://api2.splinterlands.com/cards/get_details and creating GameSummoner/GameMonsters using the cards directly. Instantiating a GameSummoner/GameMonster using card ID relies on a local version of the cards that is not guaranteed to be up to date.

Samples

Simulator Accuracy

This simulator is not guaranteed to be 100% accurate and there are bugs with it. The simulator logic was based on playing the game and making educated guesses on how the simulator was working. There are still many edge cases that are still missing and need to be solved. If you find a bug feel free to open a PR or open an issue. If you would like to discuss the simulator you can join us on the Splintertools discord

Feature requests

For feature requests open an issue

Contributing Code

See our Contributions readme

If you would like to contribute to the code base, please make pull requests to the feature branch. The feature branch will be merged to master ~once a week, and the NPM package will automatically be updated.