There's a simple digital number lock. After each button press the lock checks if the previous four presses constitute the correct code. I.e. typing 44445 tests two codes: 4444 and 4445. You must brute force it with a code golfed program.
Rules
- Your program must test numbers by printing ASCII digits 0-9 to standard output. Other output, if any, will be ignored.
- The program must be deterministic. If you need "random" numbers, you must use a deterministic generator with a well defined seed.
- Infinite output beyond all 10^4 codes is allowed. Opening the lock is considered to stop the program.
Scoring
- Calculate the average digits of output needed to crack the lock. I.e. search the output string for every possible four digit sequence and record where it first appears.
- Add the source code length in bytes. The program must be fully functional, you are not allowed to omit imports or other boilerplate.
Score = Average digits to crack + codelength in bytes
Example entry
Python, 35 bytes.
for i in range(9001):print '%.4d'%i
Score: 8444.9837 + 35 = 8479.9837
Other
Simple, stupid Python program to verify score of an output string:
d = {}
s = ''.join(c for c in s if '0' <= c <= '9')
for i in range(len(s)-4):
t = s[i:i+4]
if t in d:
continue
d[t] = i + 4
if len(d) == 10000:
break
print sum(d.values()) / 10000.