Below is a snippet of my algorythm for working out the black and white pieces on a mastermind board. Spritenum holds the difficulty selected. wCount white markers bCount black markers.
now if i use the test data
1,2,3,4 for the 4 correct solutions
1,5,5,1 shows 1 black 1 white
1,2,5,5 shows 2 black as it should
3,3,6,6 shows 1 white
1,1,1,1 shows 1 black 1 white
I dont beleive the exit is working any help would be greatly appreciated
function checkGuess (spriteNum as integer,cols as integer,rows as integer)
wCount=0:bCount=0
dim flag[maxcol]
for t=1 to spriteNum:flag[t]=0:next t
for slot = 1 to spriteNum
if (guess[slot] = comp[slot])
inc bCount
else
for s = 1 to spriteNum
if (s <> slot) and (guess[slot] = comp[s]) and (flag[s] <> 1)
inc wCount
flag[s]=1
exit
endif
next s
endif
next slot
if (bCount+wCount)>0 then putMarker(bCount,wCount,(cols*32),rows * 32)
endfunction
</div>
fubar