Computing the number of close to perfect pegs
For each color it is: the min of the total of that color in either string - the number of perfect ones for that color.
For example: if the solution was 12313145 and guess was 12233444.
- For 1, it is min(3,1)-1=0.
- For 2, it is min(1,2)-1=0.
- For 3, it is min(2,2)-1=1.
- For 4, is it min(1,3)-1=0.
- For 5, it is min(1,0)-0=0.
This means there is one color correct but in the wrong position (the other 3) and 4 colors in the right position. There are other ways to compute this that will also work nicely.