
Public
Like
connect4_ai
Val Town is a collaborative website to build and scale JavaScript apps.
Deploy APIs, crons, & store data – all from the browser, and deployed in milliseconds.
Viewing readonly version of main branch: v1225View latest version
A parallel connect4 AI player written in a webgpu shader.
Does a minimax evaluation on the current game state, looking 8 moves ahead at all possible game states. Expands the tree out 3 levels which results in 343 game states, those are then each evaluated on a gpu thread to check 5 more moves ahead. All in all it looks at 5,764,801 different game states to make it's decision.
Runs pretty quickly on an M series mac or on a computer with a good gpu. Can be kinda slow if you only have an integrated gpu and probably doesn't work at all on most phones. I basically just wrote it to work well on my computer, I could probably tune it to run better on the device it's loaded on.