Skip to content

Commit

Permalink
Publish 0.11.3 to npm
Browse files Browse the repository at this point in the history
PS's sim engine is now available on npm!

sim/README.md describes how to use it:

https://github.com/smogon/pokemon-showdown/blob/master/sim/README.md
  • Loading branch information
Zarel committed Oct 21, 2020
1 parent bbb550b commit 2faa3d6
Show file tree
Hide file tree
Showing 3 changed files with 68 additions and 6 deletions.
61 changes: 61 additions & 0 deletions .npmignore
@@ -0,0 +1,61 @@
/test

/config/*
!/config/formats.ts
/logs/*
/test/modlogs
/node_modules
/eslint-cache
/server/chat-plugins/private
/server/chat-plugins/private.js
/server/chat-plugins/*-private.js
npm-debug.log
.eslintcache
.eslintcache-no-types
package-lock.json
/tools/set-import/sets
databases/*.db*

# visual studio live share
.vs

# boilerplate #
###############

.DS_Store

# editor temp files
*~
.idea/

tmp/**/*
*.lock
*.DS_Store
*.swp
*.out
*.pyc
*.pyo
.installed.cfg

downloads
dist

# egg related
develop-eggs
*.egg-info
*.egg
*.EGG
*.EGG-INFO
src/*.egg-info
eggs
fake-eggs

# django
local_settings.py

# SCM
.hg
.bzr
.svn

pip-log.txt
5 changes: 2 additions & 3 deletions package.json
@@ -1,8 +1,8 @@
{
"name": "pokemon-showdown",
"preferGlobal": true,
"description": "The server for the Pokémon Showdown battle simulator",
"version": "0.11.2",
"version": "0.11.3",
"main": ".sim-dist/index.js",
"dependencies": {
"probe-image-size": "^5.0.0",
"sockjs": "0.3.20",
Expand Down Expand Up @@ -62,7 +62,6 @@
"url": "http://www.meltsner.com"
}
],
"private": true,
"license": "MIT",
"devDependencies": {
"@types/cloud-env": "^0.2.1",
Expand Down
8 changes: 5 additions & 3 deletions sim/README.md
Expand Up @@ -3,12 +3,14 @@ Simulator

Pokémon Showdown's simulator API is implemented as a `ReadWriteStream`. You write player choices to it, and you read protocol messages from it.

`npm install pokemon-showdown`

```js
const Sim = require('Pokemon-Showdown/sim');
const Sim = require('pokemon-showdown');
stream = new Sim.BattleStream();

(async () => {
for await (let output of stream) {
for await (const output of stream) {
console.log(output);
}
})();
Expand All @@ -18,7 +20,7 @@ stream.write(`>player p1 {"name":"Alice"}`);
stream.write(`>player p2 {"name":"Bob"}`);
```

The stream can be accessed from other programming languages using standard IO:
The stream can also be accessed from other programming languages using standard IO:

```bash
echo '>start {"formatid":"gen7randombattle"}
Expand Down

0 comments on commit 2faa3d6

Please sign in to comment.