zoukankan      html  css  js  c++  java
  • Artificial Intelligence Minimax and Alpha Beta Pruning code

    function alphabeta(node, depth, α, β, Player)        

        if depth = 0 or node is a terminal node

            return the heuristic value of node

        if Player = MaxPlayer

            for each child of node

                α := max(α, alphabeta(child, depth-1, α, β, not(Player) ))    

                if β ≤ α

                    break                             (* Beta cut-off *)

            return α

        else

            for each child of node

                β := min(β, alphabeta(child, depth-1, α, β, not(Player) ))    

                if β ≤ α

                    break                             (* Alpha cut-off *)

            return β

    (* Initial call *)

    alphabeta(origin, depth, -infinity, +infinity, MaxPlayer)

  • 相关阅读:
    【月度盘点】《金秋10月》
    selenium简单使用
    数据解析模块BeautifulSoup简单使用
    爬虫简介
    SQLAlchemy简介
    Flask Blueprint
    Flask基于websocket的简单聊天室
    Flask send_file request
    初识Flask
    Python pip简单使用
  • 原文地址:https://www.cnblogs.com/pugang/p/2508215.html
Copyright © 2011-2022 走看看