Git Product home page Git Product logo

tictactoe-mcts's Introduction

tictactoe-mcts

This is an experiment using the Monte Carlo Tree Search (MCTS) algorithm. It is used to power the opponent in a game of tic-tac-toe.

Compilation

To build the project, run:

$ go build -o bin/tictactoe-mcts-linux-amd64 ./main

Command Line

These are the supported command line options:

$ ./bin/tictactoe-mcts-linux-amd64 --help
Usage:
  tictactoe-mcts-linux-amd64 [OPTIONS]

Application Options:
  -s, --seed=            The RNG seed used by MCTS (default: 1690791430501)
  -t, --timeout=         The maximum amount of time the MCTS algorithm may take per action (default: 200ms)
  -p, --parallelization= The amount of parallel goroutines to execute for the MCTS algorithm (default: 4)

Help Options:
  -h, --help             Show this help message

Gameplay

In the example below the AI goes first (player "O"), while the human is player "X".

=======
|X|O| |
|O|O|X|
|X|O| |
=======
[2023-07-31 10:06:36] <O> $ 2x2 (explored 123934 nodes in 1002ms)
[2023-07-31 10:06:38] <X> $ 1x1
[2023-07-31 10:06:39] <O> $ 2x1 (explored 9633 nodes in 1001ms)
[2023-07-31 10:06:42] <X> $ 3x2
[2023-07-31 10:06:43] <O> $ 1x2 (explored 957 nodes in 1000ms)
[2023-07-31 10:06:48] <X> $ 1x3
[2023-07-31 10:06:49] <O> $ 3x2 (explored 44 nodes in 1002ms)
[2023-07-31 10:06:49]     $ the winner is player O!

tictactoe-mcts's People

Watchers

Fredrik Nordberg Almroth avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.