**RandomGuest wrote:**

**Code:** ```
15->G
```

int(10rand(4->L1

While max(Ans

Input A

int(10fPart(A/10^(5-cumSum(1 or L1->L2

L1≠Ans

Disp {sum(Ans and seq(sum(L2=L1(A)),A,1,4)),sum(not(Ans

DS<(G,1

End

If max(Ans

Disp L1

"YOU "+sub("WIN LOSE",1+4max(Ans),4

A short version of the game MasterMind.

Basically, you have to guess a four-digit code.

**Code:** ```
int(10rand(4->L1
```

It generates a random code and stores it in L1.

**Code:** `Input A`

You input your guess as a four-digit number.

**Code:** ```
int(10fPart(A/10^(5-cumSum(1 or L1->L2
```

This line parses your answer, turning a four-digit number into a list and storing it to L2.

**Code:** ```
L1≠Ans
```

Disp {sum(Ans and seq(sum(L2=L1(A)),A,1,4)),sum(not(Ans

This section compares your guess to the correct answer, and gives two numbers: (1) number of digits that are correct and in the wrong place, and (2) number of digits that are correct and in the right place.

**Code:** `DS<(G,1`

I wonder how many people fainted at this infamous command. It seemed easier than the For( loop.

I made my own version a long time ago.

**Code:** ```
ClrHome
```

"?

Disp "NUMBER:","",Ans,Ans,Ans,Ans

Output(8,1,"RED: 0 WHITE: 0

DelVar TDelVar GDelVar Rint(10rand(4→L1

4→dim(L2

Repeat T=14 or K=45 or R=4

Repeat Ans

getKey

End

Ans(102≠Ans)-13int(Ans/13(2>abs(5-abs(5-abs(Ans-83→K

If Ans=105 and G=4

Then

For(X,1,4

Output(2+X,3+T,L2(X

End

DelVar GT+1→T

sum(L1=L2→R

Output(8,6,Ans

Output(8,16,‾Ans+sum(seq(min(sum(L1=X),sum(L2=X)),X,0,9

Output(1,9," //4 spaces

Else

If Ans≤9 and G≠4

Then

G+1→G

K→L2(Ans

End

If Ans=24 and G

Then

G-1→G

Output(1,Ans+9," //1 space

End

End

For(X,0,G

If X

Output(1,8+X,L2(X

End

End

For(X,1,4

Output(2+X,1,L1(X

End

If K≠45

Then

Output(1,1,"YOU "+sub("WIN! LOSE...",8-7(R=4),7

Pause

End

DelVar GDelVar KDelVar RDelVar TDelVar XDelVar L1DelVar L2ClrHome