0.1.1 • Published 7 years ago

goita-ai-sample v0.1.1

Weekly downloads
1
License
MIT
Repository
github
Last release
7 years ago

Goita AI Sample

This sample shows how to implement Goita AI based on goita-core.

Build Status

Install

npm install goita-ai-sample

Using this module

  • To use the RandomAI class in a TypeScript file -
import * as Goita from "goita-core";
import { RandomAI } from "goita-ai-sample";
const history = "12345678,12345679,11112345,11112345,s1,113,2p,3p,431,1p,2p,315";
const board = Goita.Board.createFromString(history);
const ai = new RandomAI();
const chosenMove = ai.chooseMove(board.toThinkingInfo());

board.playMove(chosenMove);
  • To use the RandomAI class in a JavaScript file -
const Goita = require('goita-core');
const RandomAI = require('goita-ai-sample').RandomAI;

const history = "12345678,12345679,11112345,11112345,s1,113,2p,3p,431,1p,2p,315";
const board = Goita.Board.createFromString(history);
const ai = new RandomAI();
const chosenMove = ai.chooseMove(history);

board.playMove(chosenMove);