
-----------------------------------
QuantumPhysics
Tue May 22, 2012 4:02 pm

Tic then Tac the Toe
-----------------------------------
Just something i cooked up on my free time. 
Have fun, and play safe :P

-----------------------------------
QuantumPhysics
Tue May 22, 2012 10:25 pm

RE:Tic then Tac the Toe
-----------------------------------
Looking for feedback

-----------------------------------
Zren
Wed May 23, 2012 2:14 am

RE:Tic then Tac the Toe
-----------------------------------

enum bool { false, true};


Waaaaaa-

I don't know much about C++, but there's no way you should need to define a boolean data type. No way...


{
   int *ptr;

   if(player==human1)
      ptr=p1;				// point to appropriate array
   else
      ptr=p2;

   // check for 3 in a Row or 3 in a Column
   if( (ptr

All right. Now imagine TicTacToe is a 7x7 board. What would you do differently? Having only 8 win conditions is useful for grasping all end scenarios, but manually checking each grid cell isn't very practical.

Don't bother coding it, just brainstorm.

-----------------------------------
Raknarg
Wed May 23, 2012 8:28 am

RE:Tic then Tac the Toe
-----------------------------------
@Zren Actually, I don't think C++ has built in booleans. Generally it seems that the programs just use 1 as true and 0 as false, which is basically the same thing.

-----------------------------------
y4y
Wed May 23, 2012 8:13 pm

RE:Tic then Tac the Toe
-----------------------------------
what are you talking about bool is a type in c++.

-----------------------------------
md
Wed May 23, 2012 8:33 pm

Re: RE:Tic then Tac the Toe
-----------------------------------
@Zren Actually, I don't think C++ has built in booleans. Generally it seems that the programs just use 1 as true and 0 as false, which is basically the same thing.

C++ does indeed have a boolean type - it's called "boolean" and it has the values "true" and "false" which are equivalent to 1 and 0 respectively. C didn't have a boolean type for a long time but newer standards do define Boolean and there is a long standing bool.h header which does all the defines for you as well.

-----------------------------------
Raknarg
Thu May 24, 2012 8:33 am

RE:Tic then Tac the Toe
-----------------------------------
Oh, ok then. I just remember hearing that somewhere, I jsut assumed.

-----------------------------------
QuantumPhysics
Fri May 25, 2012 8:17 am

RE:Tic then Tac the Toe
-----------------------------------
Okay guys, haha but what do you think of my program? pretty good? Im thinking of posting my chess vs ai game in a Windows console, it has 3-D visuals and many more options. But im just finishing it up.

-----------------------------------
QuantumPhysics
Fri May 25, 2012 8:18 am

RE:Tic then Tac the Toe
-----------------------------------
Okay guys, haha but what do you think of my program? pretty good? Im thinking of posting my chess vs ai game in a Windows console, it has 3-D visuals and many more options. But im just finishing it up.

-----------------------------------
bl0ckeduser
Fri May 25, 2012 8:34 am

Re: RE:Tic then Tac the Toe
-----------------------------------
C didn't have a boolean type for a long time but newer standards do define Boolean and there is a long standing bool.h header which does all the defines for you as well.
As was mentioned earlier by Raknarg, I think the usual convention in C is to use a nonzero integer (often 1) for true and zero for false. This is how conditional expressions get evaluated, but there are other uses as well.

-----------------------------------
mirhagk
Fri May 25, 2012 10:15 am

RE:Tic then Tac the Toe
-----------------------------------
As for the discussion of whether C++ has booleans, the answer is depends. Some versions have boolean types defined, others don't Actually the enum for true and false is a decent way of doing it, many people use macros for the same thing.

As Zren said you should really code how to solve the solution vs just putting everything in an if statement.
