anyone bored enough to help me debug some code?

This is a discussion on anyone bored enough to help me debug some code? within the C++ Programming forums, part of the General Programming Boards category; Ive been working at this for the past day and its driving me wild. Basically, all this code is supposed ...

anyone bored enough to help me debug some code?

Ive been working at this for the past day and its driving me wild. Basically, all this code is supposed to do is to take an array of binary data, replace all occurances of 0xff (what I call a 'set byte') with some two-byte value (called the 'expand word'), then restore the array to its original form. The two-byte value is determined by finding a two-byte sequence that is _not_ in the array. This code seems to fail about 1 out of 10 times for reasons unknown. The main function is used to test the functions 'ExpandSetByteInBuffer' and 'RestoreSetByteInBuffer'. The other functions are used within these two. Ive included comments at key areas. Any help will be much appreciated. Oh yeah, by the way, this code is (c) *ClownPimp*

That is exactly why I cant seem to further my chess skills -- my incompleteness in analyzing a situation. I found the bug in my code and you know what, I actually considered that exact situation, but my analysis only accounted for half of the problem! *sigh* Hopefully one day I will learn...