Quantcast
Channel: VBForums - CodeBank - Visual Basic 6 and earlier
Viewing all articles
Browse latest Browse all 1529

[VB6] Multithreaded Connect 4 AI

$
0
0
This AI uses The trick's multi threading module to search the game tree using the negamax algorithm. My multi threading implementation is not very efficient, as it creates one thread per column, meaning it can use at most 7 threads, less if columns are full. This still results in a 3-4x speedup over the single threaded version, which you can toggle between. The program will work within the IDE, but multi threading is disabled.

The main thread is not loaded at all during the search, meaning that you can drag the program around smoothly while it is calculating a move. This is accomplished by sending Windows messages from the threads, which the main thread receives and uses to calculate a final move.

While compiling, you can enable all advanced optimizations. I have included two versions. The first one is the standard option, and uses an older version of modMultiThreading that requires a tlb file. The second version does not require a tlb file, but is much slower, even in single threaded mode. If you have any questions about this program, feel free to ask me.
Connect 4 MT.zip
Connect 4 MT NO TLB.zip
Attached Files

Viewing all articles
Browse latest Browse all 1529

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>