```ClrHome
{4,4}->dim([A]
{4,4}->dim([B]
Fill(0,[A]
0->S
Repeat [A](A,B)=0
randInt(1,4->A
randInt(1,4->B
End
2+2not(randInt(0,9->[A](A,B)
Repeat B=0 or K=45
If [A]!=[B]
Repeat [A](A,B)=0
randInt(1,4->A
randInt(1,4->B
End
2+2not(randInt(0,9->[A](A,B)
Output(8,1,"Score:
Output(8,8,S
For(A,1,4
For(B,1,4
Output(2A-1,4B-3,"
If [A](A,B)!=0
Output(2A-1,4B-3,[A](A,B
End
End
Repeat K
getKey->K
End
[A]->[B]
If K=24 or K=26
[A]^^T->[A]
If K=26 or K=34
Then
rowSwap([A],1,4->[A]
rowSwap([A],2,3->[A]
End
For(A,2,4
For(B,1,4
Matr>list([A],B,L1
A-1->dim(L1
If sum(not(L1))!=0
Then
[A](A,B->[A](A-sum(not(L1)),B
0->[A](A,B
End
End
End
For(A,1,3
For(B,1,4
If [A](A,B)!=0 and [A](A,B)=[A](A+1,B)
Then
S+(ln([A](A,B))/ln(2)+1)[A](A,B->S
2[A](A,B->[A](A,B
0->[A](A+1,B
End
End
End
For(A,2,4
For(B,1,4
Matr>list([A],B,L1
A-1->dim(L1
If sum(not(L1))!=0
Then
[A](A,B->[A](A-sum(not(L1)),B
0->[A](A,B
End
End
End
If K=26 or K=34
Then
rowSwap([A],1,4->[A]
rowSwap([A],2,3->[A]
End
If K=24 or K=26
[A]^^T->[A]
0->B
For(A,1,4
Matr>list([A],A,L1
B+sum(not(L1->B
End
End
If K!=45
Then
Output(10,1,"You lose!
Pause
End```