Computer Chess Club Archives


Search

Terms

Messages

Subject: Very novice question about passing arguments

Author: S J J

Date: 07:03:28 02/05/06



Hi all,

   I am a novice programmer that has managed to get a functioning engine
together.
   In upgrading the code, I've ran into an odd problem that I have not been able
to debug.

   In the Main program after AlphaBetaPly is set to 100, an argument is being
passed to a function by the following statement:

Advance(AlphaBetaPly);


the code for the function is written ...


int Advance(int AlphaBetaPly2)
{

/* Following four lines are to print Argument into "JunkFile3"  */
char fileName[80] = "JunkFile3";
ofstream fout(fileName,ios::app);  // reopen for reading
fout << "\nBefore AlphaBetaPly2 = " << AlphaBetaPly2  << "\n";

AlphaBetaPly2 = 200;

/* Following line prints AlphaBetaPly2 to "JunkFile3" */
fout << "\nBefore AlphaBetaPly2 = " << AlphaBetaPly2 << "\n";



/* Additional code is here   */
)

   Once again, AlphaBetaPly is set to 100, the first time AlphaBetaPly2 is
printed to JunkFile, the value is -409.  After the line AlphaBetaPly2 = 200;,
AlphaBetaPly2 is printed to JunkFile as 200.

   Any tips as to why the passing argument may not be being received correctly?
All tips appreciated.

Thanks,
Steve



This page took 0 seconds to execute

Last modified: Thu, 15 Apr 21 08:11:13 -0700

Current Computer Chess Club Forums at Talkchess. This site by Sean Mintz.