Click here to Skip to main content
16,011,120 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: FindStringExact().. Pin
Neha22-Mar-02 2:01
Neha22-Mar-02 2:01 
GeneralRe: FindStringExact().. Pin
Tomasz Sowinski22-Mar-02 2:09
Tomasz Sowinski22-Mar-02 2:09 
GeneralRe: FindStringExact().. Pin
Carlos Antollini22-Mar-02 2:15
Carlos Antollini22-Mar-02 2:15 
GeneralRe: FindStringExact().. Pin
Carlos Antollini22-Mar-02 2:17
Carlos Antollini22-Mar-02 2:17 
GeneralRe: FindStringExact().. Pin
Tomasz Sowinski22-Mar-02 2:24
Tomasz Sowinski22-Mar-02 2:24 
GeneralCGridCtrl and Message - IDs Pin
Bernhard22-Mar-02 0:10
Bernhard22-Mar-02 0:10 
GeneralTaking care of scroll position Pin
21-Mar-02 23:52
suss21-Mar-02 23:52 
GeneralMFC Tictactoe alpha-beta pruning bug... Pin
John Cruz21-Mar-02 23:35
John Cruz21-Mar-02 23:35 
can anyone help me find my bug. i wrote a function that would search the tictactoe board for the best possible computer move. i am using alpha beta pruning to optimize my search. the function returns the score from the search and the row and column where the computer should move. ok here is the function... the PossiblePlayerMove function is the same thing but it searches for the best possible player move.

int CComputer::CheckForMoves(const CBoard &rConstBoard,int nDepth, int nAlpha, int nBeta, int &nRow, int &nCol)
{
// Check for invalid data
ASSERT(mnDepth >= 0 && mnDepth <= MAXDEPTH);

// Check if the row and column return is a valid value
ASSERT(nRow < MAXROW && nCol < MAXCOL);

int nScore = 0; // The score from the search
mnDepth = nDepth; // Set the Depth to the new depth.
int Row = nRow; // Copy the Row and Column
int Col = nCol;

// Create a new Board and Copy the values of other board.
CBoard Board = rConstBoard;

// Base Case
if (Winner(Board) || mnDepth == 0)
{
nRow = Row;
nCol = Col;
return Evaluate(Board);
}
else
{
// Try all the possible move on a different Board
// then return the best move.
for (int row = 0; row < MAXROW; row++)
for (int col = 0; col < MAXCOL; col++)
if (Board.IsEmpty(row,col))
{
Board.SetCellValue(row,col,'O');
if (mnDepth == 0) break;
nScore = PossiblePlayerMove(Board,mnDepth - 1,nBeta,nAlpha,Row,Col);

// Set Row and Column
nRow = Row;
nCol = Col;
if (nAlpha < nScore)
nAlpha = nScore;
Board.SetCellValue(row,col,NULL);
if (nAlpha >= nBeta) break;
}
}

return nAlpha;
}

i hope this is enough... by the way.. the possible moves function is the same thing ...

Thank you very much,
John Big Grin | :-D

Aloha from Hawaii Smile | :)
Generalclearing boxs Pin
21-Mar-02 23:33
suss21-Mar-02 23:33 
GeneralRe: clearing boxs Pin
Jon Hulatt22-Mar-02 0:10
Jon Hulatt22-Mar-02 0:10 
GeneralRe: clearing boxs Pin
Christian Graus22-Mar-02 0:27
protectorChristian Graus22-Mar-02 0:27 
GeneralRe: clearing boxs Pin
Tomasz Sowinski22-Mar-02 0:39
Tomasz Sowinski22-Mar-02 0:39 
GeneralRe: clearing boxs Pin
Christian Graus22-Mar-02 0:47
protectorChristian Graus22-Mar-02 0:47 
GeneralRe: clearing boxs Pin
Daniel_Pollard22-Mar-02 1:54
Daniel_Pollard22-Mar-02 1:54 
GeneralRe: clearing boxs Pin
Tomasz Sowinski22-Mar-02 2:10
Tomasz Sowinski22-Mar-02 2:10 
GeneralRe: clearing boxs Pin
Christian Graus22-Mar-02 9:47
protectorChristian Graus22-Mar-02 9:47 
GeneralRe: clearing boxs Pin
Christian Graus22-Mar-02 9:43
protectorChristian Graus22-Mar-02 9:43 
GeneralRe: clearing boxs Pin
22-Mar-02 0:52
suss22-Mar-02 0:52 
GeneralRe: clearing boxs Pin
Tomasz Sowinski22-Mar-02 1:04
Tomasz Sowinski22-Mar-02 1:04 
GeneralRe: clearing boxs Pin
22-Mar-02 1:02
suss22-Mar-02 1:02 
GeneralRe: clearing boxs Pin
Tomasz Sowinski22-Mar-02 1:16
Tomasz Sowinski22-Mar-02 1:16 
GeneralRe: clearing boxs Pin
Nish Nishant22-Mar-02 0:59
sitebuilderNish Nishant22-Mar-02 0:59 
QuestionHow to earse the thing you drawed? Pin
Feng Qin21-Mar-02 23:14
Feng Qin21-Mar-02 23:14 
AnswerRe: How to earse the thing you drawed? Pin
Feng Qin22-Mar-02 0:45
Feng Qin22-Mar-02 0:45 
GeneralNeed Help : HTML Editor Pin
perlz21-Mar-02 22:14
perlz21-Mar-02 22:14 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.