>> There is no child or parent, there is one class...
I know that. But the OP was talking about inheritance, so I got confused about what he meant.
Printable View
>> There is no child or parent, there is one class...
I know that. But the OP was talking about inheritance, so I got confused about what he meant.
WORKS!!!Code:int minimax__depth = 0;
class minimax
{
public:
minimax();
minimax *ply;
char board[20];
int depth;
void look_ahead();
};
minimax::minimax(){
depth = minimax__depth;
minimax__depth++; }
void minimax::look_ahead()
{
}
But,
Prog locks up.Code:if(ply.depth == 0) Beep(2000,100);
if(ply.ply[0].depth == 1) Beep(2000,100);
Also, locks up.Code:if(ply.depth == 0) Beep(2000,100);
if(ply.ply[0].depth == 1) Beep(2000,100);
I'm guessing that (in the ply.ply[0].depth) it's not trying to access ply's ply. Just ply.
Renaming my lead ply to ply1 would fix that, but, not when I want to do this for an example:
ply.ply[0].ply[2].ply[1].ply[0].depth
What should I do now?
That doesn't make any sense. Since ply is a pointer,
should not compile.Code:if(ply.depth == 0) Beep(2000,100);
if(ply.ply[0].depth == 1) Beep(2000,100);
It does though.
I learned that a compiler will see *char_var the same as char_var[infinite].
>I learned that a compiler will see *char_var the same as char_var[infinite].
...
What is the compiler you are using?
ply is a pointer. To access its member you do ply->depth. Not ply.depth.
okay using ply.ply->depth compiles but still locks up.
Using Dev-C++.
>> I'm guessing that (in the ply.ply[0].depth) it's not trying to access ply's ply. Just ply.
This still remains true, how can I get around that?
You are not reading anyone replies. so... good luck with your program
>> You are not reading anyone replies. so... good luck with your program
What do you mean I'm not reading anyone replies!!!
I have tried your suggestions, and they DON'T WORK.
Okay, so ply is a POINTER. Got it.
Where does that leave me?
Actually, now that I think of it, I am probably going about this whole thing the wrong way.
Thanks for the help guys, sorry all it did was show me that I'm doing it wrong. :rolleyes: