Coder Social home page Coder Social logo

gomoku's Introduction

How to run

Install

$ git clone https://github.com/LouisCaixuran/gomoku.git
$ cd gomoku

If use CLI:

$ sudo pip3 install -r requirements.txt
$ sudo python3 setup.py install

Use CLI:

$ play-go -h

 usage: play-go [-h] [--size SIZE] [--simulate_time SIMULATE_TIME]
                {1,2,3,4} {1,2,3,4}

 gomoku program

 positional arguments:
   {1,2,3,4}             1.Human; 2.MCTS; 3.Random; 4.Expert
   {1,2,3,4}             1.Human; 2.MCTS; 3.Random; 4.Expert

 optional arguments:
   -h, --help            show this help message and exit
   --size SIZE           The Board size,default is 8*8
   --simulate-time SIMULATE-TIME
                         The MCTS playout simulation time,default is 2s

Choose a player to play

If you want to play with Expert, you can run:

 $ play-go 1 4
     
     0   1   2   3   4   5   6   7

 0   -   -   -   -   -   -   -   -

 1   -   -   -   -   -   -   -   -

 2   -   -   -   -   -   -   -   -
 
 3   -   -   -   -   -   -   -   -

 4   -   -   -   -   -   -   -   -

 5   -   -   -   -   -   -   -   -

 6   -   -   -   -   -   -   -   -

 7   -   -   -   -   -   -   -   -
 The Current player: 1
 please enter action:

Auto test diffent players ability

If you want to test MCTS vs Expert , you can run:

$ play-go  2 4

     0   1   2   3   4   5   6   7

 0   -   -   -   -   O   O   -   -

 1   -   -   -   O   -   -   O   X

 2   -   -   -   -   X   -   O   -

 3   -   -   -   X   X   O   -   -

 4   -   -   X   X   X   X   X   -

 5   -   O   -   -   O   -   -   -

 6   -   -   O   -   -   -   -   -

 7   -   -   -   -   -   -   -   -
 The Current player: 2
 player1: O, last action: 0 4
 player2: X, last action: 4 6
 2  wins

Change the chess board size

If you want to change the chess board size from '88' to '1515', you can run :



$ play-go 1 4  --size 15

     0   1   2   3   4   5   6   7   8   9   10  11  12  13  14

 0   -   -   -   -   -   -   -   -   -   -   -   -   -   -   -

 1   -   -   -   -   -   -   -   -   -   -   -   -   -   -   -

 2   -   -   -   -   -   -   -   -   -   -   -   -   -   -   -

 3   -   -   -   -   -   -   -   -   -   -   -   -   -   -   -

 4   -   -   -   -   -   -   -   -   -   -   -   -   -   -   -

 5   -   -   -   -   -   -   -   -   -   -   -   -   -   -   -

 6   -   -   -   -   -   -   -   -   -   -   -   -   -   -   -

 7   -   -   -   -   -   -   -   -   -   -   -   -   -   -   -

 8   -   -   -   -   -   -   -   -   -   -   -   -   -   -   -

 9   -   -   -   -   -   -   -   -   -   -   -   -   -   -   -

 10  -   -   -   -   -   -   -   -   -   -   -   -   -   -   -

 11  -   -   -   -   -   -   -   -   -   -   -   -   -   -   -

 12  -   -   -   -   -   -   -   -   -   -   -   -   -   -   -

 13  -   -   -   -   -   -   -   -   -   -   -   -   -   -   -

 14  -   -   -   -   -   -   -   -   -   -   -   -   -   -   -
The Current player: 1
please enter action:

Change MCTS playout simuelation time

The ability of MCTS player can improve when the simulation time is increased.

If you want to change simuelation time to 10s(default 2s), you can run:

$ play-go 2 4 -- simulate_time 10

    0   1   2   3   4   5   6   7

 0   -   -   -   -   -   -   -   -

 1   -   -   -   -   -   -   -   -

 2   -   -   -   -   -   O   -   -

 3   -   -   -   -   X   -   -   -

 4   -   -   -   -   -   -   -   -

 5   -   -   -   -   -   -   -   -

 6   -   -   -   -   -   -   -   -

 7   -   -   -   -   -   -   -   -
The Current player: 2
player1: O, last action: 2 5
player2: X, last action: 3 4

For developers

Any new code to committed should pass the unit tests.

Run the code for develop:

 $ sudo python3 setup.py develop

 $ sudo pyhthon3 run.py -h 

Run the unit test:

 $ sudo pytest 

gomoku's People

Contributors

louiscaixuran avatar xiaocarl avatar

Watchers

James Cloos 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.