First, the code:

```
int(10rand(4 -> L1
While max(Ans
Input A
int(10fPart(A/10^({4,3,2,1 -> L2
L1≠Ans
Disp {sum(Ans and seq(sum(L2=L1(A)),A,1,4)),sum(not(Ans
End
"YOU_WIN //underscore=space
```

Basically, it's you vs. the computer. The computer picks a random code (a random 4-digit number) and expects you to find it. When prompted, give your guess as a four-digit number. Also, if your guess is something like 0013, 13 will also do the same thing. It then outputs two numbers: The number of digits that are in the solution but are in the wrong place, and the number of digits that are in the solution but are in the right place. Once you guess the right code, it displays a win message.

Two questions:

(1) What would be the best (i.e. shortest) way to implement a limited number of guesses?

(2) Do you think this is good enough to go on the Games page, under Routines?