Skip to content

Concepts

Philippe Vaillancourt edited this page May 21, 2018 · 4 revisions

At its core, Macao is a general game playing AI for JavaScript games. It is based on the Monte Carlo Tree Search algorithm.

Macao requires almost no configuration to add to your project. To get started you only need to understand its Core Concepts:

This document is intended to give a high-level overview of these concepts, while providing links to detailed concept specific use cases.

When programming your game, you will have to decide upon an object type to store the state of the game. Macao doesn't get in your way when it comes to deciding on the shape of your game state object. The only thing it asks of you is that you store game states in a JavaScript object, and that the object has a property named player. The player property should store a player identification, it could be a string or a number, whatever you prefer. Each game state should have an associated player property that identifies the player having just played... the player responsible for making the game state what it is.

Here are a few examples of game state objects that would be compatible with Macao:

const gameState = {
  board: [0, 1, 0, 0, 1, 0]
  player: 1
}

const otherGameState = {
  myBoard: [
    ['X', 'O', 'X'],
    ['O', 'X', 'O'],
    ['X', 'O', 'X']
  ],
  player: 'X'
}

const yetAnotherGameState = {
  gameBoard: 446 //bitboard
  someCondition: true
  someOtherCondition: false
  somePropertyThatYouNeedToTrack: 67
  player: 2
}

As you can see, the game state object can take pretty much any shape you like, as long as it has a player property.

Clone this wiki locally