Code Monkey home page Code Monkey logo

alphazero_gomoku-tensorflow's Introduction

AlphaZero_Gomoku-tensorflow

Forked from junxiaosong/AlphaZero_Gomoku with some changes:

  • rewrited the network code with tensorflow
  • trained with 11 * 11 board
  • added a GUI

Usage

To play with the AI

$ python human_play.py

To train the model:

$ python train.py

Example of Game

Example

there's another interesting implementation of reinforcement learning DQN-tensorflow-gluttonous_snake

alphazero_gomoku-tensorflow's People

Contributors

zouyih avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

alphazero_gomoku-tensorflow's Issues

环境依赖问题

能问下你的版本环境吗?我试过了很多版本的tensorflow都跑不起来

loss计算的问题

在 tf_policy_value_net.py 第54行,定义了每个动作的概率是
self.action_probs = tf.nn.softmax(policy_net_out, name="policy_net_proba"),
第90行定义的loss是
cross_entropy = tf.nn.softmax_cross_entropy_with_logits(logits=self.action_probs, labels=self.mcts_probs)。
但tensorflow文档对 tf.nn.softmax_cross_entropy 这个函数有个warning ,是说不要把softmax的输出给这个函数,因为这个函数内部会自己对logits做一遍softmax……所以这里直接用这个loss是不是不太好

另外,请问model文件夹里的模型是从0开始用这份代码训练的,还是已经训练好的theano/pytorch的模型直接转成tensorflow模型得到的?

训练时长?

请问你训练了多久,电脑配置以及总共对弈了大概多少局?

click部分代码简化问题

尽管不涉及错误,也不影响什么,
双重循环看起来还是很不舒服,毕竟0(1)的问题变成了0(n^2)的问题了,做如下修改比较好:
def click1(self, event): #click1 because keyword repetition
size = self.board.width
current_player = self.board.get_current_player()
if current_player == 1:
# for i in range(size):
# for j in range(size):
i=(event.x)//30
j=(event.y)//30
ri=(event.x)%30
rj=(event.y)%30
i=i-1 if ri<15 else i
j=j-1 if rj<15 else j

        move = self.board.location_to_move((i, j))
        # if move in self.board.availables:
        #     square_distance = math.pow((event.x - self.chess_board_points[i][j].pixel_x), 2) + math.pow((event.y - self.chess_board_points[i][j].pixel_y), 2)                        
            
        #     if (square_distance <= 200):
        self.cv.create_oval(self.chess_board_points[i][j].pixel_x-10, self.chess_board_points[i][j].pixel_y-10, self.chess_board_points[i][j].pixel_x+10, self.chess_board_points[i][j].pixel_y+10, fill='black')
        self.board.do_move(move)

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.