Code:
0→S
{40,41,42,43,44→⌊X
{40,40,40,40,40→⌊Y
1→D
Repeat K=45 or (D=1 and ⌊X(dim(⌊X))=0) or (D=2 and ⌊X(dim(⌊X))=96) or (D=3 and ⌊Y(dim(⌊Y))=0) or (D=4 and 63=⌊Y(dim(⌊Y
randInt(1,96→A
randInt(1,63→B
While not(⌊X(dim(⌊X))=A and B=⌊Y(dim(Y
Repeat K
getKey→K
Pxl-Off(⌊X(1),⌊Y(1
For(X,2,dim(⌊X
⌊X(X→⌊X(X-1
End
⌊X(dim(⌊X)-1)+(D=2)-(D=1→⌊X(dim(⌊X
For(X,2,dim(⌊Y
⌊Y(X→⌊Y(X-1
End
⌊Y(dim(⌊Y)-1)+(D=4)-(D=3→⌊Y(dim(⌊Y
Pxl-On(⌊X(1),⌊Y(1
End
End
End

Why is this giveing me a error:type at line 2?
hexagonnoah2 wrote:

Why is this giveing me a error:type at line 2?

*giving Razz

Funny thing, I found the error and fixed it (it wasn't line 2 that gave an error), but then I had to go do homework, so now I can't find it Shock.
This code won't throw an ERR:DATA TYPE anymore, but it will throw a ERR:DOMAIN, which you might have to figure out by yourself since I don't know what this program does.

Code:

0->S
{40,41,42,43,44->|LX
{40,40,40,40,40->|LY
1->D
Repeat K=45 or (D=1 and |LX(dim(|LX))=0) or (D=2 and |LX(dim(|LX))=96) or (D=3 and |LY(dim(|LY))=0) or (D=4 and 63=|LY(dim(|LY
   randInt(1,96->A
   randInt(1,63->B
   While not(|LX(dim(|LX))=A and B=|LY(dim(|LY
      Repeat K
         getKey->K
         Pxl-Off(|LX(1),|LY(1
         For(X,2,dim(|LX
            |LX(X->|LX(X-1
         End
         |LX(dim(|LX)-1)+(D=2)-(D=1->|LX(dim(|LX
         For(X,2,dim(|LY
            |LY(X->|LY(X-1
         End
         |LY(dim(|LY)-1)+(D=4)-(D=3->|LY(dim(|LY
         Pxl-On(|LX(1),|LY(1
      End
   End
End

If you tell me what this is supposed to do, I'd be happy to help there Very Happy. Otherwise, this will not give ERR:DATA TYPE.
Also, 0->S at the beginning should be replaced with DelVar S.
It's faster and smaller!
Battlesquid wrote:
hexagonnoah2 wrote:

Why is this giveing me a error:type at line 2?

*giving Razz

Funny thing, I found the error and fixed it (it wasn't line 2 that gave an error), but then I had to go do homework, so now I can't find it Shock.
This code won't throw an ERR:DATA TYPE anymore, but it will throw a ERR:DOMAIN, which you might have to figure out by yourself since I don't know what this program does.

Code:

0->S
{40,41,42,43,44->|LX
{40,40,40,40,40->|LY
1->D
Repeat K=45 or (D=1 and |LX(dim(|LX))=0) or (D=2 and |LX(dim(|LX))=96) or (D=3 and |LY(dim(|LY))=0) or (D=4 and 63=|LY(dim(|LY
   randInt(1,96->A
   randInt(1,63->B
   While not(|LX(dim(|LX))=A and B=|LY(dim(|LY
      Repeat K
         getKey->K
         Pxl-Off(|LX(1),|LY(1
         For(X,2,dim(|LX
            |LX(X->|LX(X-1
         End
      |LX(dim(|LX)-1)+(D=2)-(D=1->|LX(dim(|LX
         For(X,2,dim(|LY
            |LY(X->|LY(X-1
         End
         |LY(dim(|LY)-1)+(D=4)-(D=3->|LY(dim(|LY
         Pxl-On(|LX(1),|LY(1
      End
   End
End

If you tell me what this is supposed to do, I'd be happy to help there Very Happy. Otherwise, this will not give ERR:DATA TYPE.

What is the difference between our codes?
It is a snake game.
Have you re-typed the first few lines?

IDK, might help?
Error:Type is caused when you try to perform an operation on a data type that doesn't support the operation. For example, you can add a number, lets say 5, to a string, such as "hello world", becouse adding numbers to strings doesn't make sense. You can however, add two strings together: "hello" + " world" = "hello world".
The error was on line 8.
hexagonnoah2 wrote:


Code:
While not(⌊X(dim(⌊X))=A and B=⌊Y(dim(Y


You were trying to find the dimensions of Y, when it should have been |LY (Or any other list/matrix you want).
Razz
  
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