RE: Help with coding
- Posted by Travis Weddle <Weddle at tcia.net> Jul 26, 2001
- 344 views
Irv--ok, instead of using the fn = open("moves.txt", "r") to open a file with moves in it, how would i use the Open command in the file menu to open a file, so i won't have to change coding for each file that i want to view? Thanks, I appreciate it! irvm at ellijay.com wrote: > On Sunday 22 July 2001 12:49, Travis Weddle wrote: > > > Thanks Irv, u are a great help in this--i think i have a final two > > questions for you, what exactly do u mean by "pointer" (if u have not > > noticed, i'm very new at this)? And where can i find Judith's IDE? I > > searched for it, but cannot find it. > > If you read in a list of "moves", and save them in a sequence, > you might have a sequence like: > { {11,15},{15,20},{20,22},{22,24} } > > where 11 is the first source location, and 15 the first destination, > and so on. Let's say you name this sequence "move". > > To point to which move you are currently interested in, you need to > declare an integer variable: call it anything you want. For example: > > integer current > > current = 1 > > now, to refer to the first move on the list of moves, you'd say: > move[current] -- which is the same as saying move[1]. > or {11,15} > > The next move on the list would be move[2], so, > > current += 1 -- now current holds the value 2 > move[current] -- same as move[2], which is: > {15,20} > > So, you use the pointer into the list of moves to select the move > you're interested in, and send that move to your routine which > handles ..erm... moves. > > You can get Judith's IDE from RDS' Recent Contributions page, or > directly from > http://www2.txcyber.com/~camping/judith.html > Be sure you have the correct version of Win32Lib to go with that. > > Regards, > Irv > > > Trav