Skip to content

K0tovsk1y/hexo-triangle-precomputed

Repository files navigation

Hexo-Triangle Precomputed Proofs

This repository contains a precomputed look-up table for a specific game position in Hexogonal Tic-Tac-Toe(Hexo) called triangle. The proof demonstrates that under specific constraints, the attacker wins within 10 moves for almost all possible defender responses(except one).

The Constraint

At each turn, the defender is restricted to choosing one of the 18 best moves for that position, as determined by a simplified value function.

Key Findings

Under this constraint, all allowed first moves lead to an attacker victory within 10 moves, except for one specific case.

Move for which a winning sequence was not found:

Attack can't win example


Installation

To get started, clone the repository and navigate to the project directory:

git clone https://github.com/K0tovsk1y/hexo-triangle-precomputed
cd hexo-triangle-precomputed

How to Check Precomputed Moves

You can explore the proof and play as the defender using the provided interactive viewer:

python viewer.py

Viewer Example: Red hexagons are attacker's colored cells, blue hexagons are defender's colored cells, green are avalible moves.

Viewer Screenshot


Reproducing the Results (Solver)

If you wish to modify the script or recompute the moves yourself, compile and run the C++ solver.

Compilation

g++ -O3 -std=c++17 -o solver basic_solver.cpp -lpthread

Execution

./solver

Example Output:

[13/39] D=(-1,0)+(1,1) -> ALREADY SOLVED
[16/39] D=(-1,0)+(0,-3) -> A WINS
[17/39] D=(-1,2)+(0,-3) -> A WINS
  Saved proof proof_db/move_0016.bin (60694 entries)
  Saved proof proof_db/move_0015.bin (95618 entries)
[8/39] D=(-1,0)+(0,3) -> A WINS
  Saved proof proof_db/move_0007.bin (149992 entries)
[7/39] D=(-1,0)+(0,-2) -> A WINS
[15/39] D=(-1,0)+(-3,4) -> A WINS
....

Note: A full precomputation takes approximately one hour on a standard 8-core CPU.


Notes and Known Limitations

  • AI-Generated Code: Most of the code in this repository was generated by AI; please be aware that bugs may exist.
  • Value Function Bias: The current value function is relatively simple and biased towards defensive moves. This causes a flaw where where certain strong moves (such as -2,1 and -2,2 in the following position) are currently not allowed/considered.

Value Function Flaw Example:

Value Function Flaw example

About

In hexagonal tic tac toe there is such structure called triangle. It is yet unknown whether it is defendable. I precomputed and proofed that within several move restrictions all but one is response does'nt lead to loss.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors