Where is a link to C++ minimax source code
I am looking for a simple minimax c++ source. I want to use it for Tic Tac Toe. I have found a lot explanations of it, psuedo code, etc., but no clear cut source code. I found alpha-beta pruning (I think) combined with minimax, but this seemed to be more than I was looking for. I want a "simple" source of it, before I go and try to re-invent the wheel myself. I have looked, I simply can''t find it. Thanks.
int MinMax(int depth){ int best = -INFINITY; int val; if (depth <= 0) return Evaluate(); GenerateLegalMoves(); while (MovesLeft()) { MakeNextMove(); val = -MinMax(depth - 1); UnmakeMove(); if (val > best) best = val; } return best;}
quote: Original post by Russell
int MinMax(int depth){ int best = -INFINITY; int val; if (depth <= 0) return Evaluate(); GenerateLegalMoves(); while (MovesLeft()) { MakeNextMove(); val = -MinMax(depth - 1); UnmakeMove(); if (val > best) best = val; } return best;}
Thanks Russell. Very straightforward.
Ferretman
ferretman@gameai.com
www.gameai.com
From the High, Cold, Snowy Mountains of Colorado
Ferretman
ferretman@gameai.com
From the High Mountains of Colorado
GameAI.Com
Ok.. Mini Max:
#define max(a,b)(a>b?b:a)
btw, this was a joke HOWEVER i didnt know this boards didnt take
html or i write crappy such since i have no idea how html works oh.. and ignore this post please you damn flamers about posting stupid stuff that is to smart for a cat without a dogs washerroom and my speakers need soms sleep because theyve been awake for to long hah! iam not the first one to write about my speakers instead of myself when it comes to viagra and sex and similair.
and have a good day
[edited by - stefandxm on May 29, 2002 3:31:48 AM]
#define max(a,b)(a>b?b:a)
btw, this was a joke HOWEVER i didnt know this boards didnt take
html or i write crappy such since i have no idea how html works oh.. and ignore this post please you damn flamers about posting stupid stuff that is to smart for a cat without a dogs washerroom and my speakers need soms sleep because theyve been awake for to long hah! iam not the first one to write about my speakers instead of myself when it comes to viagra and sex and similair.
and have a good day
[edited by - stefandxm on May 29, 2002 3:31:48 AM]
--mega!--
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement