Bizarre Tic Tac Toe!

This is a discussion on Bizarre Tic Tac Toe! within the C Programming forums, part of the General Programming Boards category; I am trying to develope this tic tac toe game etc. and to check if there are three '1's or ...

Bizarre Tic Tac Toe!

I am trying to develope this tic tac toe game etc. and to check if there are three '1's or three '2's in a row I wrote the fuction check
I am trying many combinations of ways to check this but none really work, how would you design check?
1 = player1 or X
2 = player2 or O

The possibilities I have tried are layed out in commented lines
The code is really spread and confusing because it is late and I don't want to write more possibilites and post all the other ways I have tried.

You can then check the match a few ways. You can simply shift off the first nine bits if you want to check the other player, or just mask off the remaining bits if you want to check the first player.

Another way to do it would be to just exclude the bits you want and check the value. If you mask off the first three bits, the value with them all set is 7. So if you shift over nine places first, then mask the first three, if it is 7, your second player wins.

Originally posted by QuestionC The problem is.. well, consider this.
Let's say that row abc has 1 X, 1 O, and 1 blank. The score of that row will add up to 1 + 2 + 0 = 3, so it will register as a victory for player 1.

It seems to me that the way to do this, using the least amount of modification, would be to make each of Player 2's marks worth -1 points.

What is this a reply to? Not to bit shifts. I'm not sure who you're replying to, because this doesn't fit the pattern of anyone's reply.

However, Using simple math like your example would be another way of doing it. -1/0/1