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 🙏

© 2025 – Pkg Stats / Ryan Hefner

monkey-music

v1.6.2

Published

Monkey Music

Downloads

87

Readme

Monkey Music Core

Rule engine for Monkey Music Challenge.

Monkey Music Challenge is an AI- and pathfinding programming competition, where monkeys battle it out in a virtual 2D-djungle over who can collect the most songs, albums and playlists.

Your mission is to write a program to control a monkey. You win by scoring the most points. Read on to find out more...

How to play

Your the game takes place in a virtual 2D-world, looking something like this:

Your program reads this 2D-world from a JSON object, which in the above case would look like this:

{
  "layout": [
    ["album", "wall", "playlist", "wall", "album"],
    ["empty", "song", "song", "song", "empty"],
    ["empty", "empty", "user", "empty", "empty"],
    ["empty", "wall", "playlist", "wall", "empty"],
    ["empty", "monkey", "song", "monkey", "empty"]
  ],
  "remainingTurns": 10,
  "isGameOver": false,

  "score": 0,
  "position": [4, 1],
  "inventory": [],
  "inventorySize": 3,
  "buffs": {}
}

The game is turn based. At the start of every turn, your program receives a new JSON object with the current state of the 2D-world.

At the end of every turn, your program sends a JSON command telling your monkey what to do next. The computation time during each turn is limited, use it wisely.

Commands

You control your monkey by sending one of three different commands: move, for moving around the level use, for using items in your inventory and idle for doing nothing at all.

Move

The following are valid move commands:

{"command": "move", "direction": "left"}
{"command": "move", "direction": "right"}
{"command": "move", "direction": "up"}
{"command": "move", "direction": "down"}

The move command both moves your monkey around the world, and lets it interact with its surroundings.

For example, in this scenario:

{
  "layout": [["monkey", "empty"]],
  "position": [0, 0]
}

issuing the command:

{"command": "move", "direction": "right"}

would result in your monkey moving one step to the right, as such:

{
  "layout": [["empty", "monkey"]],
  "position": [0, 1]
}

Picking up items

Your monkey can pick up items by moving to them.

For example, in this scenario:

{
  "layout": [["monkey", "song"]],
  "position": [0, 0],
  "inventory": []
}

issuing the command:

{"command": "move", "direction": "right"}

would result in your monkey picking up the song to its right, as such.

{
  "layout": [["monkey", "empty"]],
  "position": [0, 0],
  "inventory": ["song"]
}

Note that when picking up an item, your monkey remains at its current position.

Items can only be picked up while your monkey's inventory is smaller than the inventorySize specified in the game state. If the inventory is full, you will not be able to move to an item.

Dropping off music items

You score points by collecting songs, albums and playlists. Your monkey must first pick them up, then carry them in its inventory to the nearest user. The user will reward your monkey for any collected music with points.

The user rewards the following points for different music items:

  • song: 1 point
  • album: 2 points
  • playlist: 4 points

For example, in this scenario:

{
  "layout": [["monkey", "user"]],
  "position": [0, 0],
  "inventory": ["song", "album", "playlist"],
  "score": 0
}

issuing the command:

{"command": "move", "direction": "right"}

would result in your monkey trading in all currently carried music items for points, as such:

{
  "layout": [["monkey", "user"]],
  "position": [0, 0],
  "inventory": [],
  "score": 7
}

Tackling other monkeys

If another monkey is in your way, you can tackle it! A tackled monkey will be unable to do anything else for the remainder of the turn, and you also have a 50% chance of stealing something from your opponent's inventory. Watch out for thieves!

For example, in this scenario, where your opponent's monkey stands at position [0, 2]:

{
  "layout": [["monkey", "monkey", "empty"]],
  "position": [0, 0],
  "inventory": []
}

issuing the command:

{"command": "move", "direction": "right"}

would (if you get to move before your opponent) result in your monkey tackling its opponent, and also (possibly) stealing one of its items, as such:

{
  "layout": [["empty", "monkey", "monkey"]],
  "position": [0, 1],
  "inventory": ["album"]
}

Move order

You and your opponent might try to tackle each other during the same turn. The monkey that gets to move first is decided by random chance, but if your program replied faster than your opponent's program, your monkey will have a (slightly) greater chance of moving first!

Opening doors

The world is full of open-doors and closed-doors. They are controlled through interacting with levers.

For example, in the following scenario:

{
  "layout": [["open-door", "lever"],
             ["closed-door", "monkey"]],
  "position": [1, 1]
}

issuing the command

{"command": "move", "direction": "up"}

Would open all the closed-doors and close all the open-doors:

{
  "layout": [["closed-door", "lever"],
             ["open-door", "monkey"]],
  "position": [1, 1]
}

Entering tunnels

Tunnels connect different parts of the world with each other.

Every tunnel has a number, such as tunnel-1, tunnel-2 etc. There are always two of every tunnel on every level, and my moving inside a tunnel, your monkey will pop up at the other end.

For example, in the following scenario:

{
  "layout": [["tunnel-1", "monkey", "wall", "user"],
             ["wall", "empty", "tunnel-1", "song"]],
  "position": [0, 1]
}

issuing the command:

{"command": "move", "direction": "left"}

would give the following outcome:

{
  "layout": [["tunnel-1", "empty", "wall", "user"],
             ["wall", "empty", "monkey", "song"]],
  "position": [1, 2]
}

Note that your monkey cannot move into a tunnel if the exit is blocked by another monkey.

Use

With the use command, your monkey can consume an item in its inventory.

There are 2 different types of items: bananas and traps.

Bananas

Bananas give a positive speedy buff to your monkey.

For example, in the following scenario:

{
  "layout": [["monkey", "empty", "song"]],
  "position": [0, 0],
  "inventory": ["banana"],
  "buffs": {}
}

issuing the command:

{"command": "use", "item": "banana"}

would give the following outcome:

{
  "layout": [["monkey", "empty", "song"]],
  "position": [0, 0],
  "inventory": [],
  "buffs": {"speedy": 6}
}

By eating a banana, your monkey will obtain a speedy buff for the 6 upcoming turns.

While your monkey is speedy, you can make multiple moves per turn by sending move commands with an array of several directions, like this:

{"command": "move", "directions": ["left", "up"]}

which in the above scenario, would result in the following outcome:

{
  "layout": [["empty", "monkey", "empty"]],
  "position": [0, 0],
  "inventory": ["song"],
  "buffs": {"speedy": 5}
}

As we can see, the monkey made two moves, and the duration of the speedy buff was decreased by one turn.

A maximum of 2 moves per turn is allowed while speedy. Remember to use the "directions" argument instead of the singular "direction"!

Traps

Traps are offensive items, that mess up the lives of your opponents.

Traps are initially not armed, they can be picked up by your monkey, as such:

{
  "layout": [["monkey", "trap", "monkey"]],
  "position": [0, 0],
  "inventory": []
}
{"command": "move", "direction": "right"}
{
  "layout": [["monkey", "empty", "monkey"]],
  "position": [0, 0],
  "inventory": ["trap"]
}

You must then choose a strategic location to set your trap.. choose wisely!

{"command": "move", "direction": "right"}
{"command": "use", "item": "trap"}
{"command": "move", "direction": "left"}
{
  "layout": [["monkey", "empty", "monkey"]],
  "position": [0, 0],
  "inventory": []
}

As we can see, armed traps are invisible to all players, but don't worry, you can't fall victim to your own traps!

When your opponent moves to the same position as your trap, they will be stunned for 6 turns, also losing an item from its inventory. Moahaha!!

Idle

For the situtations where you need to remain still and plot evil plans, the idle command is just what you need:

{"command": "idle"}

License

Copyright © 2014 Oscar Söderlund and Anton Lindgren.

Distributed under the MIT License.

Monkey designed by Patrik Göthe.

Overworld sprites by Buch.

Custom sprites by Johan Brook.