Hello, getting "err: undefined" on this line:
:SortA(L2,L1
Any ideas? I'm following someone else's code and I know it works, but I'm having constant problems.
When you get an Undefined error, that means a variable somewhere in the line of code doesn't have any data stored in it. Remember, all lists need to be created before they can be used.

Now that we've narrowed down the issue to the variables L1 or L2 (Note: they could both be an issue) you need to check which list is undefined. On the homescreen, press [2nd]>[1] to pull up L1 then press [enter]. If you get an Invalid Dimension error, then you know L1 is an issue. Now press [2nd]>[2] to pull up L2 then press [enter]. If you get an Invalid Dimension error then you know L2 is an issue. Now that you know which variable is a problem, you can create the list(s) above that line in the program.
TheLastMillennial wrote:
When you get an Undefined error, that means a variable somewhere in the line of code doesn't have any data stored in it. Remember, all lists need to be created before they can be used.

Now that we've narrowed down the issue to the variables L1 or L2 (Note: they could both be an issue) you need to check which list is undefined. On the homescreen, press [2nd]>[1] to pull up L1 then press [enter]. If you get an Invalid Dimension error, then you know L1 is an issue. Now press [2nd]>[2] to pull up L2 then press [enter]. If you get an Invalid Dimension error then you know L2 is an issue. Now that you know which variable is a problem, you can create the list(s) above that line in the program.


Thank you for the help, but it's someone else's code so I wouldn't know how to do that.

Code:
:identity(4→[A]
:cumSum(binomcdf(7,0
:augment(Ans,Ans→L1
:rand(16→L2
:SortA(L2,L1
:ClrHome
:For(Y,1,4
:For(X,1,4
:Output(Y,2X,"?
:L1(X+4Y+4→[A](Y,X
:End:End
:DelVar W
:DelVar S1→Y
:DelVar T1→X
:For(A,1,8
:For(B,0,1
:Repeat K=21 and [A](Y,X)(Y≠S or X≠T
:Output(Y,2X-1,">
:Repeat Ans
:getKey→K
:End
:Output(Y,2X-1,"
:max(1,min(4,X+(Ans=26)-(Ans=24→X
:max(1,min(4,Y+(K=34)-(K=25→Y
:End
:Output(Y,2X,sub("ABCDEFGH",[A](Y,X),1
:If not(B:Then
:Y→S:X→T
:End
:End
:rand(30
:If [A](Y,X)=[A](S,T:Then
:0→[A](Y,X
:Output(Y,2X,"
:0→[A](S,T
:Output(S,2T,"
:Else
:A-1→A
:Output(Y,2X,"?
:Output(S,2T,"?
:End
:W+1→W
:End
:Disp "Score:
:Pause W
:ClrHome:"
Just another heads-up, when supplying code, do this:
[codе]
your code here
[/codе]

And you can edit your post so that the new code block will look more organized.
I took a look at the code, its a neat little memory game Very Happy It uses a lot of pretty obscure optimizations so whoever wrote it is definitely a 1337 golfer Laughing
The code is wrong though. The undefined error is because you copied and pasted it and the ʟ1/ʟ2 tokens got turned into L1 and L2. Make sure you replace all of those with the list variables ([2nd]+[1] and [2nd]+[2]). There is also a math error.
This line:

Code:
:L1(X+4Y+4→[A](Y,X

should be

Code:
:L1(X+4Y-4→[A](Y,X

(the "+4" should be "-4")
Finally, make sure that on this line:

Code:
Output(Y,2X-1,"

There is a space after the double quotes. Without it, the cursor won't be erased as you move around.
  
Register to Join the Conversation
Have your own thoughts to add to this or any other topic? Want to ask a question, offer a suggestion, share your own programs and projects, upload a file to the file archives, get help with calculator and computer programming, or simply chat with like-minded coders and tech and calculator enthusiasts via the site-wide AJAX SAX widget? Registration for a free Cemetech account only takes a minute.

» Go to Registration page
Page 1 of 1
» All times are UTC - 5 Hours
 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

 

Advertisement