Click here to Skip to main content
15,910,981 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: ATL doubt Pin
pba_3-Mar-02 2:52
pba_3-Mar-02 2:52 
GeneralRe: ATL doubt Pin
pba_3-Mar-02 3:13
pba_3-Mar-02 3:13 
Questionhow to new a doc in MDI application in programme?? Pin
benben2-Mar-02 17:40
benben2-Mar-02 17:40 
AnswerRe: how to new a doc in MDI application in programme?? Pin
Roger Allen4-Mar-02 1:16
Roger Allen4-Mar-02 1:16 
GeneralHelp writing a game tree for tictactoe Pin
John Cruz2-Mar-02 17:02
John Cruz2-Mar-02 17:02 
GeneralRe: Help writing a game tree for tictactoe Pin
alex.barylski2-Mar-02 18:32
alex.barylski2-Mar-02 18:32 
GeneralRe: Help writing a game tree for tictactoe Pin
John Cruz2-Mar-02 18:50
John Cruz2-Mar-02 18:50 
GeneralRe: Help writing a game tree for tictactoe Pin
alex.barylski2-Mar-02 23:20
alex.barylski2-Mar-02 23:20 
AI for tic tac toe can be anything from simple as hell and fairly complex.

1) This simplest method of AI is to just iterate the array gameboard and check for NULL's, the first NULL = empty space which means...the computer should pick this spot.

Of course this doesn't leave for very interesting game play (not that tic tac toe would or could)

1) To spice things up a little you could add some more advanced AI and do something like...instead of take the first available spot...search the game board for a potential opponent win and fill that gap before they do, I think this would work best if the computer started second.

2) Then you could use a game tree (i'd never heard of that before). Something I was attempting to do in my comp sci class was actually dynamically store players moves in a db while executing and use this growing db as a method of choosing the next mostly likely win-win scenerio.

The second approach would best be suited for the computer if it starts second...but would provide night and day difference in AI...

If you sit down and think about it for a sec or two you'd probably think of a better way of doing this, but heres just a quick idea on how to implement this.

char move[9];

Then create an array of move's (tree) initialized with X and O's in different places. Use this tree to choose your next move.

The one downside to this method (which I just realised while writting this... Poke tongue | ;-P is that you'd need one 'move' for each possible scenerio...to be able to use this method effectively...thats a whole lot of move[n]={X,O,O,X,O,X,X,O...}

This is only one possible solution to a problem which has many.

"An expert is someone who has made all the mistakes in his or her field" - Niels Bohr
GeneralRe: Help writing a game tree for tictactoe Pin
John Cruz3-Mar-02 0:53
John Cruz3-Mar-02 0:53 
GeneralKeyboard delay time Pin
PJ Arends2-Mar-02 16:29
professionalPJ Arends2-Mar-02 16:29 
GeneralRe: Keyboard delay time Pin
Nish Nishant2-Mar-02 17:37
sitebuilderNish Nishant2-Mar-02 17:37 
GeneralRe: Keyboard delay time Pin
Michael Dunn2-Mar-02 18:59
sitebuilderMichael Dunn2-Mar-02 18:59 
GeneralRe: Keyboard delay time Pin
PJ Arends2-Mar-02 19:28
professionalPJ Arends2-Mar-02 19:28 
GeneralRe: Keyboard delay time Pin
Nish Nishant2-Mar-02 19:24
sitebuilderNish Nishant2-Mar-02 19:24 
GeneralHelp with Array Sort Pin
Loli102-Mar-02 10:41
Loli102-Mar-02 10:41 
GeneralRe: Help with Array Sort Pin
Anders Molin2-Mar-02 11:37
professionalAnders Molin2-Mar-02 11:37 
GeneralRe: Help with Array Sort Pin
Tim Smith2-Mar-02 11:48
Tim Smith2-Mar-02 11:48 
GeneralRe: Help with Array Sort Pin
Nish Nishant2-Mar-02 15:06
sitebuilderNish Nishant2-Mar-02 15:06 
GeneralCListCtrl and Row Height Pin
NodeX2-Mar-02 9:41
NodeX2-Mar-02 9:41 
GeneralRe: CListCtrl and Row Height Pin
alex.barylski2-Mar-02 16:06
alex.barylski2-Mar-02 16:06 
GeneralRe: CListCtrl and Row Height Pin
NodeX2-Mar-02 22:59
NodeX2-Mar-02 22:59 
GeneralRe: CListCtrl and Row Height Pin
Tim Smith3-Mar-02 2:20
Tim Smith3-Mar-02 2:20 
GeneralNeed help with MFC ! ! ! ! Pin
2-Mar-02 8:58
suss2-Mar-02 8:58 
GeneralRe: Need help with MFC ! ! ! ! Pin
Mazdak2-Mar-02 9:20
Mazdak2-Mar-02 9:20 
GeneralRe: Need help with MFC ! ! ! ! Pin
Michael P Butler2-Mar-02 10:07
Michael P Butler2-Mar-02 10:07 

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.