Skip to content
/ hex-ai Public

Various AIs for the board game hex, including Monte Carlo Tree Search with the Tsetlin Machine

License

Notifications You must be signed in to change notification settings

cair/hex-ai

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

22 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

hex-ai

Various AIs for the board game hex, including Monte Carlo Tree Search with the Tsetlin Machine

Install

pip install git+https://github.com/cair/hex-ai.git

Example

from PyHex import Hex11 as Hex

if __name__ == "__main__":
    hg = Hex.HexGame()
    winner = -1

    for game in range(10000000):
        Hex.init(hg)

        player = 0

        while Hex.full_board(hg) == 0:
            position = Hex.place_piece_randomly(hg, player)

            if Hex.winner(hg, player, position):
                winner = player
                break

            player = 1 - player

        if hg.number_of_open_positions >= 75:
            print("\nPlayer %s wins!\n\n" % (winner, ))
            Hex.print(hg)

About

Various AIs for the board game hex, including Monte Carlo Tree Search with the Tsetlin Machine

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published