I have worked out an applet on this. This is based on the heuristic algorithm by Rado Rosu with a major modification that the search is not totally random but utilizes the results from the previous guesses to come up with the next guess when the result total is zero i.e. bw=0, or when bw=n, or bw=n-1, or bw=n-2, or b=n-1 or b=n-2. Although the average number of guesses is slightly greater than the toatl random search, the time taken is cut down considerably, i.e. the average number of combinations checked to solve a code is greatly reduced. Also by using less arrays I have been able to cut down on memeory requirements.
You may check this out at www.geocities.com/rmackwani and submit your comments to email@example.com.