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

macao

v2.0.1

Published

A general purpose game playing A.I. framework based on the Monte Carlo tree search algorithm.

Downloads

266

Readme

Build Status Coverage Status npm version PRs welcome

Macao is a simple framework that allows the addition of powerful game AI to your JavaScript game with minimal configuration and coding.

Why use Macao

Perhaps:

  1. You are programming a simple game like Tic-Tac-Toe, Connect Four, Nim or the likes and would like to make the game playable against "the computer" without having to code a bunch of if statements, state machines and decision trees.
  2. You're programming a more complicated game like chess, Checkers or Go. Unfortunately, programming an AI player that is able to challenge good human players usually requires imparting the AI with the knowledge of expert players, and you are not. You may know the rules of the game, but you are no Grand Master.
  3. You are developing an entirely original game. Obviously, you know the rules of the game since you are the one who invented it, but do you know the best strategies to employ during play? How can you? Unlike with chess, your game hasn't been played by millions of people over centuries so there are no doubt various ways to play your game that even YOU haven't thought about.
  4. You are building a prototype of a game and, eventually you plan to give it a very complicated AI with detailed expert domain knowledge, gained through weeks of machine learning and written in thousands of lines of code. But for now, you'd really just like to figure out if and how the game works and if it's fun to play.

What Is Macao

Macao is a simple framework that allows the addition of powerful game AI to your JavaScript game with minimal configuration and coding. It is based on the powerful, yet simple, Monte Carlo Tree Search algorithm. Macao makes it possible for you to add AI to your game, even if you are a bad player and don't understand the strategy. All you need to know are the rules of the game, that's it, and that's all Macao needs to know in order to work it's magic.

Although we plan to quickly expand the types of games it supports, at the moment Macao is compatible with two player, turn-based, perfect information, deterministic games. Well, that was a mouthful. Basically this means that it should work with any game similar to Chess, Checkers, Tic-Tac-Toe, Nine Men's Morris etc.

How to use Macao

import { Macao } from "macao";

// Functions that implement the game's rules.
// These functions are provided by you.
const funcs = {
  generateActions,
  applyAction,
  stateIsTerminal,
  calculateReward
};

const config = {
  duration: 30
  // ...
};

const macao = new Macao(funcs, config);

// Somewhere inside your game loop
const action = macao.getAction(state);

For more indepth information on how to use Macao, please see the general documentation.

Installation

npm install macao --save

General Documentation

You can read the general documenation here.

API

You can read the API documentation here.

Contributing

Please take a look at our contributing guidelines if you're interested in helping!

Changelog

See CHANGELOG.md

License

Macao is provided under the MIT License.