An open API service indexing awesome lists of open source software.

https://github.com/cair/hex-ai

Various AIs for the board game hex, including Monte Carlo Tree Search with the Tsetlin Machine
https://github.com/cair/hex-ai

ai hex machine-learning monte-carlo-tree-search tsetlin-machine

Last synced: 29 days ago
JSON representation

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

Awesome Lists containing this project

README

        

# 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
```python
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)
```