--> Grammer 2-The APP --> -->

Author Topic: Grammer 2-The APP  (Read 165975 times)

0 Members and 1 Guest are viewing this topic.

Offline Xeda112358

  • they/them
  • Project Author
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 4704
  • Rating: +719/-6
  • Calc-u-lator, do doo doo do do do.
    • View Profile
Re: Grammer 2-The APP
« Reply #285 on: March 13, 2012, 08:49:36 am »
The array is stored elsewhere. As long as you have a pointer to the array, you are fine :) The location is generally a fixed location for the duration of the program, though.

Offline nxtboy III

  • LV8 Addict (Next: 1000)
  • ********
  • Posts: 795
  • Rating: +26/-1
  • NXT!
    • View Profile
    • Program NXT
Re: Grammer 2-The APP
« Reply #286 on: March 13, 2012, 08:55:26 am »
???
I'm confused....
So how does it check collision with the particle and a solid pixel? Does it have an array of particle locations??

EDIT: Could you maybe show me some psuedo code for the particle and how it moves?

EDIT2: I made a similar program to partex 2 for my NXT, and it runs slower than on the calc. But doesn't an NXT have a faster processor (or maybe not)? The NXT's processor is newer and is running at 48 Mhz,and is 32-bit.
« Last Edit: March 13, 2012, 08:57:49 am by nxtboy III »

Offline Xeda112358

  • they/them
  • Project Author
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 4704
  • Rating: +719/-6
  • Calc-u-lator, do doo doo do do do.
    • View Profile
Re: Grammer 2-The APP
« Reply #287 on: March 13, 2012, 03:03:02 pm »
Wow O.O 48Hz is 8 times faster than the calc. Okay, some pseudo code...
Make a finite array of, say, 12 elements. This is the data for 6 particles. The elements are:
{X1,Y1,X2,Y2,X3,Y3,X4,Y4,X5,Y5,X6,Y6}

So loop through the particles like this:
For the first particle, get (X1,Y1). Test the pixel below that coordinate. If it is empty, do Pxl-Off on the original, Pxl-On to the new location and change Y1. If it is not empty, randomly select left or right to test first. If it is empty, move there, adjusting pixel states and updating X1. If that is not available, check the other left/right and do the same. Finally, if that isn't empty, either, do nothing.

Since the particle should not be starting on any already made pixels, it never occupies an already occupied space and so it does not delete any original contents. It only deletes itself from frame to frame. In BASIC, I did this:

Code: [Select]
{3,3,3,3,3,3→L1    ;Y-coordinates
Ans→L2              ;X-coordinates
Repeat getKey=45
For(A,1,6
L2(A→X
L1(A→Y
If pxl-Test(Ans+1,X
Then                     ;This checks left/right
2randInt(0,1)-1→B   ;B becomes 1 or -1
If pxl-Test(Y,X+B
-B→B
If not(pxl-Test(Y,X+B
Then
Pxl-Off(Y,X
X+B→L2(A
Pxl-On(Y,Ans
End
Else
Y+1→L1(A
Pxl-Off(Y,X
Pxl-On(Ans,X
End
End
End

You will see it doesn't go nearly as fast in BASIC which is why I did it in ASM >.>

Offline nxtboy III

  • LV8 Addict (Next: 1000)
  • ********
  • Posts: 795
  • Rating: +26/-1
  • NXT!
    • View Profile
    • Program NXT
Re: Grammer 2-The APP
« Reply #288 on: March 13, 2012, 03:15:12 pm »
Hmm... On my NXT I did something similar and it is slower...

Offline Xeda112358

  • they/them
  • Project Author
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 4704
  • Rating: +719/-6
  • Calc-u-lator, do doo doo do do do.
    • View Profile
Re: Grammer 2-The APP
« Reply #289 on: March 13, 2012, 03:17:37 pm »
I also wrote the code in assembly and for things like this, the process can be really sped up. I am not sure how other languages compare.

Offline Xeda112358

  • they/them
  • Project Author
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 4704
  • Rating: +719/-6
  • Calc-u-lator, do doo doo do do do.
    • View Profile
Re: Grammer 2-The APP
« Reply #290 on: March 21, 2012, 10:17:26 am »
With very little time to code for Grammer (school and TI-Concours) I don't have much of an update to offer. However, I do these two features for the Text( command that I thought might be useful:

Setting the coordinates:
Text(Y,X with no extra argument will set the coordinate position
Relative coordinates:
Text(+Y,+X,... Grammer now preloads the last text coordinates in Ans before reading the argument. That way, if you want to do something like superscript or subscript, you can do +2 or -2 or something for the Y coordinate. Then directly after, you can set the coordinates again. So as an example:
Code: [Select]
ClrDraw            ;Clears graph screen and sets text coordinates to zero
Text(2,,"ax        ;Displays text at Y=2, leave X unchanged
Text(-2,,"2        ;Draws the 2 as a superscript (though really, you could use 0 instead of -2 in this case)
Text(+2,,"bx+c     ;Draws the rest back down 2 pixels
As a note, that is minus 2, not negative 2. Also, you see the trick that is new for Text( where you have no argument between the commas. That is essentially "+0" and was not a trick previously available.

Anyways, I am wondering if this is okay for folks?

EDIT: Also, read two posts below before downloading this. I plan to have another release later today with a lot more features than this.

Offline nxtboy III

  • LV8 Addict (Next: 1000)
  • ********
  • Posts: 795
  • Rating: +26/-1
  • NXT!
    • View Profile
    • Program NXT
Re: Grammer 2-The APP
« Reply #291 on: March 21, 2012, 10:24:16 am »
Woa, that's cool. That's a good idea! So that could make it easier to make moving text, wouldn't it?

Offline Xeda112358

  • they/them
  • Project Author
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 4704
  • Rating: +719/-6
  • Calc-u-lator, do doo doo do do do.
    • View Profile
Re: Grammer 2-The APP
« Reply #292 on: March 21, 2012, 10:43:50 am »
Hmm, I'm not sure, but it does definitely help text graphics. Pretty much, the Text( command has its own section/chapter thing in the tutorial because it has soooo many things that can be done and so many manipulations.

I am also working on a third font option that will use 4x6 font, but it will draw to pixel coordinates. That way, you can combine the variable size font with the fixed font to get better math looking results. I was also thinking of letting the Text( command with no arguments return the current cursor position. I was thinking also of adding the ability to do something like →AB where B would be loaded with the results of Ans and A would be loaded with Theta'. That way, you could do Text(→XY to get the X and Y coordinates in X and Y and also get overflows into other vars. For example, 348*567→AB would load the upper 16-bits of the multiplication to A and the lower 16-bits to B. Finally, I was thinking of adding a new syntax where instead of using A', you can use lowercase A, as well to mean the same thing. That might also cause less clutter in the program editor, too, if you can do →a instead of →A'.

Also, I plan to add all this today.

EDIT: Displaying the small fixed size font at pixel coordinates is now able to be done. This outputs with OR logic as a warning. You will need to do Output(2 to access this method.
EDIT2: Text( without arguments now returns the coordinates as Ans=Y, Theta'=X
Also, you can now do things like →AB :D
EDIT3:→a is now a valid way to do →A' (Still not able to use lowercase anywhere else in place of primes)
EDIT4:Now you can do math with the lowercase letters instead of primes and use them as arguments :)

Offline Yeong

  • Not a bridge
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 3739
  • Rating: +278/-12
  • Survivor of Apocalypse
    • View Profile
Re: Grammer 2-The APP
« Reply #293 on: March 21, 2012, 06:47:05 pm »
yay, updates!
I love the →a part since it'll save some spaces (not the size, though :P)
also, is →AB for 32-bit numbers?
Sig wipe!

Offline Xeda112358

  • they/them
  • Project Author
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 4704
  • Rating: +719/-6
  • Calc-u-lator, do doo doo do do do.
    • View Profile
Re: Grammer 2-The APP
« Reply #294 on: March 21, 2012, 09:30:01 pm »
Yes, it is  :) I am waiting for the "Latest Grammer Updates" thread to be unlocked because an admin locked it >.>

Anyways, so →AB is useful when a function returns info in theta', too. For example, like above, multiplication returns the 16-bit overflow in theta', so if you want it all in one 32-bit number, just use two vars. Plus, now you can do something like A*B→aA.

Anyway, for now, here is the app :) (have fun!)

Offline Xeda112358

  • they/them
  • Project Author
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 4704
  • Rating: +719/-6
  • Calc-u-lator, do doo doo do do do.
    • View Profile
Re: Grammer 2-The APP
« Reply #295 on: April 08, 2012, 10:33:12 am »
So I finally found the motivation to code and I just "gray enabled" Tangent(. Now you can shift other buffers in your desired direction :) (This is in response to one of Yeong's old requests). Now, there are a few things that I have been meaning to add, but I have forgotten what they were, so for now, I will try to clean up the readme a bit more .__.

Offline Yeong

  • Not a bridge
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 3739
  • Rating: +278/-12
  • Survivor of Apocalypse
    • View Profile
Re: Grammer 2-The APP
« Reply #296 on: April 09, 2012, 06:10:28 pm »
Ooh. :)
Is the syntax for arbitrary tangent same as the other's? (Extra syntax, I mean)
Sig wipe!

Offline Xeda112358

  • they/them
  • Project Author
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 4704
  • Rating: +719/-6
  • Calc-u-lator, do doo doo do do do.
    • View Profile
Re: Grammer 2-The APP
« Reply #297 on: April 09, 2012, 09:15:26 pm »
Yep, just add the buffer argument to the end :)

Offline DJ Omnimaga

  • Clacualters are teh gr33t
  • CoT Emeritus
  • LV15 Omnimagician (Next: --)
  • *
  • Posts: 55943
  • Rating: +3154/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • Dream of Omnimaga Music
Re: Grammer 2-The APP
« Reply #298 on: April 09, 2012, 09:23:50 pm »
Nice update Xeda. And I assume the text updates are mostly for custom Input routines, right?

Offline Xeda112358

  • they/them
  • Project Author
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 4704
  • Rating: +719/-6
  • Calc-u-lator, do doo doo do do do.
    • View Profile
Re: Grammer 2-The APP
« Reply #299 on: April 09, 2012, 09:30:24 pm »
The main reason for those was that I wanted to easily be able to do pretty-print styled writing :) It also allows for much finer control for text effects, especially for inputs and menus.

 

\n\t\t\t\t\t\t\t\t\t
<' + '/div>\n\t\t\t\t\t\t\t\t\t