Calculator Community > Grammer

Grammer Examples

(1/2) > >>

Xeda112358:
Okay, so at request, I started this topic for example codes :) I will try to post a link in this post when I add new codes. The first one is a bouncing circle:

--- Code: ---.0:Return
1→X→Y→B→C
Repeat getKey(15
Circle(Y,X,12,1   ;Draws a circle of radius 12 using pxl-On
DispGraph
ClrDraw
X+B→X
If >95            ;Since negative numbers are really big (>32768), this tests if it is negative, too
-B→B
Y+C→Y
If >63
-C→C
End
Stop

--- End code ---

saintrunner:
85 bytes!! Wow that is sweet!

Xeda112358:
Okay, here is an example using the latest Grammer features for grayscale-- a grayscale cursor!

--- Code: ---
π9872→P            ;This sets P equal to 9872h. This will be the location of the other buffer.
ClrDrawP           ;Clears the buffer at P
Disp ºP            ;Sets the buffer at P as the gray buffer
Lbl ".→Z           ;Locates label named "." and stores that to Z. Better to search once than every loop!
0→X→Y
Repeat getKey(15   ;repeats the loop until clear is pressed
Repeat 1           ;repeats until 1 is not zero (so it only cycles once). This is a great trick.
..                 ;This is a label. Sub routines use the End statement to end and so does Repeat >.>
Line(X,Y,6,6,2,P   ;Draws an inverted filled rectangle at X,Y of size 6x6 on the buffer P (the gray buffer)
Line(X,Y,6,6,2     ;This inverts the same region on the main buffer.
End                ;Ends the repeat loop/subroutine
DispGraph          ;Updates the LCD (in grayscale)
prgmZ              ;executes the sub routine pointed to by Z
getKey(56          ;tests the delete key
If +getKey(9       ;tests if Ans or getKey(9 is valid
Line(X,Y,6,6,1-getKey(56   ;draws a white rectangle if delete is pressed, black otherwise
X+getKey(3
-getKey(2→X
Y+getKey(1
-getKey(4→Y
End
Stop

--- End code ---

CRSRGRAY is 143 bytes on calc >.>

DJ Omnimaga:
Looks really great. :)

Snake X:
danggit guys lol you make me want to get back into calc programming XD

But that's pretty awesome though that you can do that with such little coding

Navigation

[0] Message Index

[#] Next page

Go to full version