[algogeeks] Re: Tic Tac Toe

2011-06-17 Thread KK
@sunny: This test: if(! ( (countx == counto + 1) || (countx == counto) ) ) cout no endl; prints no if countx counto and this one if(o x) cout no endl; else cout yes endl; prints no if both have won or else

Re: [algogeeks] Re: Tic Tac Toe

2011-06-17 Thread sunny agrawal
no i didn't mean that in first test u checking if count of X should be either equal of one more than that of O and in last u r checking if both are winning or only only one but what i meant is if O has already won but no of moves of X are greater than O the answer should be No but your solution

[algogeeks] Re: Tic Tac Toe

2011-06-17 Thread KK
@sunny: why the answer for the case u mentioned is no.. those are possible set of moves according to me and hence my program outputs yes -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to

Re: [algogeeks] Re: Tic Tac Toe

2011-06-17 Thread sunny agrawal
as you can see in this case no of moves of X are 4 and that of O are 3 as X starts first, after both players has played 3 moves each, O would have already won the game so next move of X is invalid i got your solution AC after adding this condition :) On Fri, Jun 17, 2011 at 2:48 PM, KK

[algogeeks] Re: Tic Tac Toe

2011-06-17 Thread KK
oops !! :) i'll look into that.. thx -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For

Re: [algogeeks] Re: tic tac toe

2011-01-10 Thread Amir hossein Shahriari
i think we can do this if the last move is given and that we have processed the previous moves before, so only O(n) time is required if the last move's column row or diagonal is filled or not -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To

[algogeeks] Re: tic tac toe

2011-01-09 Thread juver++
What do you mean by N term? Is it a size of the matrix N*N? -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algoge...@googlegroups.com. To unsubscribe from this group, send email to

Re: [algogeeks] Re: tic tac toe

2011-01-09 Thread juver++
For each row, column and both diagonals keep track amount of equal marks. Update these counts in O(1) when player makes move. To determine winner, iterater over each column, row and diagonals to check whether there is N equal marks. -- You received this message because you are subscribed to the