Getting further along now, ran into a new snag. (While I didn't end up using any of your code, Wims, you did lead me into realizing how to get the individual numbers out using $mid, so thanks for that).

I have it so that it's almost playable, save for the snag... Telling them how many numbers they have that aren't correct, but are out of place. I've been testing with the number 4678 for about the past hour or so, and every combination I've tried has ended screwy in some way. I tried using the $count function to check each guessed number against the original, as well as each original number against the guessed number, but if I entered the number 4444 as the guess, it'd come up with 1 correct and 3 out of place. I tried comparing each guessed number to each original number, but that also resulted in it telling me I had 1 correct and 3 out of place. After that, I set it up to compare each of the four guessed numbers to each other, to see if any of those were the same, and if they were, subtracting the number that was the same from the total I got in the previous attempt. (I know, flawed logic, but it got me the right answer in the one situation). On submitting 4444, it did give me the right answer of 1 correct and 0 out of place, but on trying 4111, it told me I had 1 correct and -1 out of place. Is there something obvious I'm missing as a way to compare each number and get an accurate "# out of place" total, or is this going to be far lengthier than I first thought?