Just run a tracking table. Give this program a set of valid inputs and track the current state of each variable for each line of code. If you can't figure it out after the first run, run it a couple more times for different types of input values.
>>11
A small snippet like this surely serves a larger function in a program as big as a game. Even if you figure out what exactly this one function does, you may not understand the use of this part - just like understanding how one cog works in a large machine won't let you understand the machine. You need to understand the cog's purpose - where it is used. When does the program calls this function? What does it returns to the calling function? What other factions does it interacts with? All of these are important questions that need to be answered to figure out the true nature of a piece of code.
For a start, I am not entirely sure why you cannot simply do some guesswork and give this program a number of different inputs that it will accept, seeing if you recognize any pattern. This could give you the lead you need.
>>14
But it looks a like a simple tree or linked list code. I immidiately recognized the binary tree search algorithm, but this place does some circular linking (looped lists), so I became lost.
>>17
I'm not a troll. Imagine, you have cosine function and have no clue about "calculus", how can you determine it's purpose by simple blackbox testing?
>>23-kun I am not >>19. Nevertheless, I'd love to help, but if help came, then everyone is going to want help. The thread has peacefully ended. Ended, it has peacefully.
struct Might look something like this..? plus/minus a lot probably,,
struct libEntity{
libEntity *E, *R, *L; //could be left & right (circular perhaps?), e is up/down?(maybe?)
};
struct entityPair{
libEntry *E, *R;}; //two linked objects? or two pieces of an object? E & R..?
if ( R ) //Got an E.R
{
Result = E->L; //Result E.L ?
R->L = Result; //Set E.R.L as result
}
else //Got no E.R
{
if ( P->R != E )
debugfail(254, "cglib/src/cylibdataentry.cpp");
//skip off to somewhere if P.R !=E
Result = E->L;
P->R = Result; //Same as if got an E.R
if ( R ) //Got an E.R
{
Result = E->L; //Result E.L ?
R->L = Result; //Set E.R.L as result
}
else //Got no E.R
{
if ( P->R != E )
debugfail(254, "cglib/src/cylibdataentry.cpp");
//skip off to somewhere if P.R !=E
Result = E->L;
P->R = Result; //Same as if got an E.R