Author Topic: Undo  (Read 22742 times)

0 Members and 1 Guest are viewing this topic.

Offline meishe91

  • Super Ninja
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2946
  • Rating: +115/-11
    • View Profile
    • DeviantArt
Re: Undo
« Reply #90 on: March 03, 2011, 01:14:05 am »
Ok, I'll explain it as best as I can. However I am really tired tonight so I will do it tomorrow after I've gotten some sleep.
Spoiler For Spoiler:



For the 51st time, that is not my card! (Magic Joke)

Offline Builderboy

  • Physics Guru
  • CoT Emeritus
  • LV13 Extreme Addict (Next: 9001)
  • *
  • Posts: 5673
  • Rating: +613/-9
  • Would you kindly?
    • View Profile
Re: Undo
« Reply #91 on: March 03, 2011, 01:16:01 am »
Yes, I am referring to your code posted there, Mr. Builderboy.

Where did i post code? o.O

Offline meishe91

  • Super Ninja
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2946
  • Rating: +115/-11
    • View Profile
    • DeviantArt
Re: Undo
« Reply #92 on: March 03, 2011, 01:18:19 am »
He means my code that I posted here.
Spoiler For Spoiler:



For the 51st time, that is not my card! (Magic Joke)

Offline meishe91

  • Super Ninja
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2946
  • Rating: +115/-11
    • View Profile
    • DeviantArt
Re: Undo
« Reply #93 on: March 03, 2011, 06:30:50 pm »
So the code in question is this:

Code: [Select]
ZStandard
104→Xmax
72→Ymax
ZInteger
ClrDraw
For(A,0,31
Horizontal A
End
"L1(A→u
{100621062,301030,10059.1,20359.1,30759.1,110027.1,120327.1,130727.1,201059.1,201027.1,56.2,156.2,107252.3→L1
For(A,1,dim(L1
iPart(E2fPart(u/E2→Z
iPart(E2fPart(u/E4→X
fPart(u→C
If .1=Ans
Then
iPart(10fPart(u/E5→B
iPart(u/E5
If not(Ans
Pt-On(X,Z,B
If 1=Ans
Pt-Off(X,Z,B
If 2=Ans
Pt-Change(X,Z
End
If .2=C
Then
If X
Horizontal Z
If not(X
Vertical Z
End
If .3=C
Circle(X,Z,iPart(E2fPart(u/E6)),{i
If not(C
Line(iPart(E2fPart(u/E8)),iPart(E2fPart(u/E6)),X,Z,iPart(u/E8
End

First I'll go over the compression.

Each element is checked for it's decimal point via fPart() because the type of command that is graphed is dependant on it.

0=fPart(\Number\): The data is for a Line() command.
.1=fPart(\Number\): The data is for a Pt-On()/Pt-Off()/Pt-Change() command.
.2=fPart(\Number\): The data is for a Horizontal/Vertical command.
.3=fPart(\Number\): The data is for a Circle() command.

Code: (Line() Command Compression) [Select]
123456789
|||||||||These two numbers are the second y-coordinates for the command.
|||||||These two numbers are the second x-coordinates for the command.
|||||These two numbers are the first y-coordinates for the command.
|||These two number are the first x-coordinates for the command.
|This number dictates if the command is turning on the line or turning it off (one if it is turning it on, zero if it is turning it off).


Code: (Pt-On()/Pt-Off()/Pt-Change() Command Compression) [Select]
123456.1
|||||| |Tells the program that it is a Pt-On()/Pt-Off()/Pt-Change() command.
||||||These two numbers are the y-coordinate for the command.
||||These two numbers are the x-coordinate for the command.
||This number dictates if it is a dot, cross, or sqare point that is drawn (one for a dot,
||two for a square, three for a cross; doesn't matter what it is for Pt-Change() since
||it doesn't have a third argument).
|This number dictates if it is a Pt-On()/Pt-Off()/Pt-Change() (zero if it is Pt-On(), one if it is Pt-Off(), two if it is Pt-Change()).

Code: (Horizontal/Vertical Command Compression) [Select]
123.2
||| |This number tells the program that it is a Horizontal/Vertical command.
|||These two numbers are the coordinate number.
|This number dictates whether it is a Horizontal or Vertical command (one for Horizontal, zero for Vertical).

Code: (Circle() Command Compression) [Select]
123456.3
|||||| |This number tells the program that it is a Circle() command.
||||||These two numbers are the y-coordinate.
||||These two numbers are the x-coordinate.
||These two numbers are the radius.

Ok, not to start breaking down the code.

Code: [Select]
ZStandard
104→Xmax
72→Ymax
ZInteger

This just sets the window to Xmin=0,Xmax=94,Ymin=0, and Ymax=62.

Code: [Select]
ClrDraw
For(A,0,31
Horizontal A
End

Clears the graphscreen then fills the bottom half of the screen.

Code: [Select]
"L1(A→u
{100621062,301030,10059.1,20359.1,30759.1,110027.1,120327.1,130727.1,201059.1,201027.1,56.2,156.2,107252.3→L1

This stores the string "L1(A" to the equation variable u. Basically what it does is that each time that variable is called it will execute that "equation" each time. (Though now that I think about it that can probably be replaced with something else.)
The second line is just storing a test list to demonstrate what the program does.

Now we get into the belly of the code.

Code: [Select]
For(A,1,dim(L1
iPart(E2fPart(u/E2→Z
iPart(E2fPart(u/E4→X
fPart(u→C

This starts the loop that loops through the list. Then it stores the thousands and hundrends number to the X variable and the tens and ones numbers to the Z variable, because the Y variable can get erased. Then it stores the decimal point of the current list element to the C variable.

Code: [Select]
If .1=Ans
Then
iPart(10fPart(u/E5→B
iPart(u/E5
If not(Ans
Pt-On(X,Z,B
If 1=Ans
Pt-Off(X,Z,B
If 2=Ans
Pt-Change(X,Z
End

This is the code to display Pt-On()/Pt-Off()/Pt-Change() commands. First it stores what kind of point it is to the B variable then finds out which command it is. It then displays the correct command and type.

Code: [Select]
If .2=C
Then
If X
Horizontal Z
If not(X
Vertical Z
End

This is the code for displaying a Horizontal/Vertical command. Since only one coordinates is used we are able to use the X variable to determine which command it is and execute accordingly.

Code: [Select]
If .3=C
Circle(X,Z,iPart(E2fPart(u/E6)),{i

This code simply displays a circle. It uses the X and Z variables for the coordinates and then directly finds the the radius.

Code: [Select]
If not(C
Line(iPart(E2fPart(u/E8)),iPart(E2fPart(u/E6)),X,Z,iPart(u/E8
End

This code displays a line, or turns one off. It directly finds the first couple of coordinates and then uses the X and Y variables for the second set of coordinates. Then it just finds whether that first number was a one or zero and uses it to turn the line on or off.
The End is then the end of the For() loop.

That explain things better?

I'll also go over it all and try to optimize it some later.
Spoiler For Spoiler:



For the 51st time, that is not my card! (Magic Joke)

Offline meishe91

  • Super Ninja
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2946
  • Rating: +115/-11
    • View Profile
    • DeviantArt
Re: Undo
« Reply #94 on: March 04, 2011, 04:22:57 pm »
Did that help, Freyaday?

Edit:
Can be optimized a little from just scanning over it.

Code: [Select]
ZStandard
104→Xmax
72→Ymax
ZInteger
ClrDraw
For(A,0,31
Horizontal A
End
{100621062,301030,10059.1,20359.1,30759.1,110027.1,120327.1,130727.1,201059.1,201027.1,56.2,156.2,107252.3→L1
For(A,1,dim(L1
L1(A→D
iPart(E2fPart(D/E2→Z
iPart(E2fPart(D/E4→X
fPart(D→C
If .1=Ans
Then
iPart(10fPart(D/E5→B
iPart(D/E5
If not(Ans
Pt-On(X,Z,B
If 1=Ans
Pt-Off(X,Z,B
If 2=Ans
Pt-Change(X,Z
End
If .2=C
Then
If X
Horizontal Z
If not(X
Vertical Z
End
If .3=C
Circle(X,Z,iPart(E2fPart(D/E6)),{i
If not(C
Line(iPart(E2fPart(D/E8)),iPart(E2fPart(D/E6)),X,Z,iPart(D/E8
End
« Last Edit: March 05, 2011, 04:30:18 am by meishe91 »
Spoiler For Spoiler:



For the 51st time, that is not my card! (Magic Joke)

Offline meishe91

  • Super Ninja
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2946
  • Rating: +115/-11
    • View Profile
    • DeviantArt
Re: Undo
« Reply #95 on: March 09, 2011, 04:34:42 pm »
Bump.
Spoiler For Spoiler:



For the 51st time, that is not my card! (Magic Joke)

Offline Freyaday

  • The One And Only Serial Time Killing Catboy-Capoeirista-Ballerino
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1970
  • Rating: +128/-15
  • I put on my robe and pixel hat...
    • View Profile
Re: Undo
« Reply #96 on: March 10, 2011, 10:39:07 pm »
I see, I see! Why this method in particular, like what are its advantages and such? How did you come up with this? I'm not trying to be rude or anything, I'm just curious.
In other news, Frey continues kicking unprecedented levels of ass.
Proud member of LF#N--Lolis For #9678B6 Names


I'm a performer at heart; I stole it last week.
My Artwork!

Offline meishe91

  • Super Ninja
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2946
  • Rating: +115/-11
    • View Profile
    • DeviantArt
Re: Undo
« Reply #97 on: March 10, 2011, 11:45:56 pm »
Well it seems to be relatively fast from the test I did, though I haven't done a list with a lot of stuff so I don't know how long it would take to redraw a list with a hundred elements. But this method also guarantees full use of the 999 list elements (assuming there is enough room in the memory for it).
Spoiler For Spoiler:



For the 51st time, that is not my card! (Magic Joke)

Offline Freyaday

  • The One And Only Serial Time Killing Catboy-Capoeirista-Ballerino
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1970
  • Rating: +128/-15
  • I put on my robe and pixel hat...
    • View Profile
Re: Undo
« Reply #98 on: March 11, 2011, 01:03:13 am »
The [re]drawing looks pretty sweet, right? But how does this insure 999 commands exactly? And how'd you come up with this?
In other news, Frey continues kicking unprecedented levels of ass.
Proud member of LF#N--Lolis For #9678B6 Names


I'm a performer at heart; I stole it last week.
My Artwork!

Offline meishe91

  • Super Ninja
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2946
  • Rating: +115/-11
    • View Profile
    • DeviantArt
Re: Undo
« Reply #99 on: March 11, 2011, 04:43:40 pm »
What do you mean does it look sweet? And it guarantees it because each command only takes up one element and since each list has 999 elements that's how many undos you have. The only reason you'd have less than 999 is if you had low memory and the list won't fit.
Spoiler For Spoiler:



For the 51st time, that is not my card! (Magic Joke)