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
- Host: GitHub
- URL: https://github.com/cair/hex-ai
- Owner: cair
- License: mit
- Created: 2019-09-18T09:46:06.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2021-07-26T20:03:12.000Z (almost 4 years ago)
- Last Synced: 2025-02-04T21:45:12.892Z (3 months ago)
- Topics: ai, hex, machine-learning, monte-carlo-tree-search, tsetlin-machine
- Language: C
- Homepage:
- Size: 22.5 KB
- Stars: 0
- Watchers: 6
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
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 Hexif __name__ == "__main__":
hg = Hex.HexGame()
winner = -1for 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
breakplayer = 1 - player
if hg.number_of_open_positions >= 75:
print("\nPlayer %s wins!\n\n" % (winner, ))
Hex.print(hg)
```