Author Topic: Etch-A-Sketch project: Completed  (Read 17335 times)

0 Members and 1 Guest are viewing this topic.

Offline Happybobjr

  • James Oldiges
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2325
  • Rating: +128/-20
  • Howdy :)
    • View Profile
Re: Project... i'll need help
« Reply #45 on: June 16, 2010, 11:32:35 am »
As for the program, does it absolutely requires that mod, though? Or can we play normally with keypad?

To clear the screen you will need the mod.
but, you can edit the code to have a button clear the screen.

EDIT: btw on Omnimaga, the double-posting limit is 6 hours, so you would have been allowed to bump your topic with your edit :P

wait what?

Oh I meant the Snake game he posted
i didn't post a snake game. that is just the name i am using right now XD
it is really the etch-e-sketch
it is easyer for me to remember it by that name. I started this project with just a snake game in mind ( w/o a mod ).

School: East Central High School
 
Axe: 1.0.0
TI-84 +SE  ||| OS: 2.53 MP (patched) ||| Version: "M"
TI-Nspire    |||  Lent out, and never returned
____________________________________________________________

Offline calcdude84se

  • Needs Motivation
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2272
  • Rating: +78/-13
  • Wondering where their free time went...
    • View Profile
Re: Project... i'll need help
« Reply #46 on: June 16, 2010, 11:43:55 am »
habbybob: what DJ was saying was that double-posting is allowed providing it has been at least six hours.
"People think computers will keep them from making mistakes. They're wrong. With computers you make mistakes faster."
-Adam Osborne
Spoiler For "PartesOS links":
I'll put it online when it does something.

Offline ztrumpet

  • The Rarely Active One
  • CoT Emeritus
  • LV13 Extreme Addict (Next: 9001)
  • *
  • Posts: 5712
  • Rating: +364/-4
  • If you see this, send me a PM. Just for fun.
    • View Profile
Re: Project... i'll need help
« Reply #47 on: June 16, 2010, 01:35:08 pm »
As for the program, does it absolutely requires that mod, though? Or can we play normally with keypad?

To clear the screen you will need the mod.
but, you can edit the code to have a button clear the screen.
Oh, okay.  I guess it was Kerm's that also used [Clear]. :)

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: Project... i'll need help
« Reply #48 on: June 16, 2010, 02:14:08 pm »
habbybob: what DJ was saying was that double-posting is allowed providing it has been at least six hours.
Yeah what Calcdude84se said. Basically if you need to post an update, but nobody replied yet and it has been over 6 hours, feel free to post a new reply instead of having to just edit your last post.

Offline Happybobjr

  • James Oldiges
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2325
  • Rating: +128/-20
  • Howdy :)
    • View Profile
Re: Project... i'll need help
« Reply #49 on: June 16, 2010, 04:23:14 pm »
ok good to know about the double posting.
It won't be hard to edit the code to have a button clear the screen.
just find the spot in the code you want and add.

:if getkey(??) and (G=??)
:clrdraw
:end

if you don't have the and G=??  part, strange errors occur.
earlier befog i did these when i held down - it increased the speed and moved the courser or whatever right !?!?!?!??!
School: East Central High School
 
Axe: 1.0.0
TI-84 +SE  ||| OS: 2.53 MP (patched) ||| Version: "M"
TI-Nspire    |||  Lent out, and never returned
____________________________________________________________

Offline Happybobjr

  • James Oldiges
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2325
  • Rating: +128/-20
  • Howdy :)
    • View Profile
Re: Project... i'll need help
« Reply #50 on: June 17, 2010, 05:33:28 pm »
help plz

can anyone optimize this

Code: [Select]
.EESKETCH
Full
diognosticoff
DispGraph
ClrDraw
0->S->O->P+1->L+9->X->Y+90->A
Text(82,0,A|>Dec
Text(1,0,L|>Dec
Repeat G=15
getKey->G
asm(DB00E6036F2600)->I
If I=0:For(J,0,L):Pxl-Off(rand^96,rand^65):End:DispGraph:End
If X<95 and getKey(3):X+1->X:sub(A):End
If Y>7 and getKey(4):Y-1->Y:sub(A):End
If X>0 and getKey(2):X-1->X:sub(A):End
If Y<62 and getKey(1):Y+1->Y:sub(A):End
If G>4
While getKey(29) and (G=29):If L>1:L-1->L:Text(1,0,L|>Dec):Pause 125:End:End
While getKey(21) and (G=21):If L<255:L+1->L:Text(1,0,L|>Dec):Pause 125:End:End
While getKey(10) and (G=10):Text(82,0,A|>Dec):A+1->A:Pause 110:End
While getKey(11) and (A>1) and (G=11):A-1->A:Pause 110:Text(82,0,A|>Dec):End
If G=13 and getKey(13):StorePic :X->O:Y->P:End
If G=12 and getKey(12):RecallPic :O->X:P->Y:DispGraph:End
If G=56 and getKey(56):ClrDraw:DispGraph:End
If G=14 and getKey(14):DrawInv :DispGraph:End
End
End
Lbl A
Pxl-On(X,Y):DispGraph:Pause A
Return
Normal

i do need the disp graph.
it clears the screen by bringing it to the buffer
« Last Edit: June 17, 2010, 05:41:59 pm by happybobjr »
School: East Central High School
 
Axe: 1.0.0
TI-84 +SE  ||| OS: 2.53 MP (patched) ||| Version: "M"
TI-Nspire    |||  Lent out, and never returned
____________________________________________________________

Offline meishe91

  • Super Ninja
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2946
  • Rating: +115/-11
    • View Profile
    • DeviantArt
Re: Project... i'll need help
« Reply #51 on: June 17, 2010, 05:38:29 pm »
Well I'm not very good at optimizing Axe right now but I don't think you need that DispGraph on the fourth line since you haven't put anything on the buffer yet. Could be wrong though.
Spoiler For Spoiler:



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

Offline nemo

  • LV9 Veteran (Next: 1337)
  • *********
  • Posts: 1203
  • Rating: +95/-11
    • View Profile
Re: Project... i'll need help
« Reply #52 on: June 17, 2010, 05:42:12 pm »
Code: [Select]
If X<95 and getKey(3):X+1->X:sub(A):End
If Y>7 and getKey(4):Y-1->Y:sub(A):End
If X>0 and getKey(2):X-1->X:sub(A):End
If Y<62 and getKey(1):Y+1->Y:sub(A):End

can be
Code: [Select]
If X>0 and (X<95
getKey(3)-getKey(2)+X->X
sub(A)
End
If Y<62 and (Y>7
getKey(1)-getKey(4)+Y->Y
sub(A)
End

that way you're only calling the subroutine twice.. because think about it, all four of your if-conditionals have the possibility of being true simultaneously, so you'd be calling the subroutine A 3 unnecessary times.
Code: [Select]
While getKey(29) and (G=29):If L>1:L-1->L:Text(1,0,L|>Dec):Pause 125:End:End

or, more readably:

While getKey(29) and (G=29)
If L>1
L-1->L
Text(1,0,L|>Dec)
Pause 125
End:End

can be
Code: [Select]
While L>1 and getKey(29)
L-1->L
Text(1,0,L>Dec
Pause 125
End

because if L is not greater than 1, nothing in the while loop happens and is therefore useless, so i put L>1 as a conditional for the loop to be checked against. however, if you want getkey(29) to halt program execution even when L<1, my optimization is useless.
Similar optimizations can be made to the while loops nearby that section in the code.
« Last Edit: June 17, 2010, 05:51:00 pm by nemo »


Offline Happybobjr

  • James Oldiges
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2325
  • Rating: +128/-20
  • Howdy :)
    • View Profile
Re: Project... i'll need help
« Reply #53 on: June 17, 2010, 05:50:32 pm »
nope. causes to get stuck in corners
School: East Central High School
 
Axe: 1.0.0
TI-84 +SE  ||| OS: 2.53 MP (patched) ||| Version: "M"
TI-Nspire    |||  Lent out, and never returned
____________________________________________________________

Offline Happybobjr

  • James Oldiges
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2325
  • Rating: +128/-20
  • Howdy :)
    • View Profile
Re: Project... i'll need help
« Reply #54 on: June 17, 2010, 05:56:26 pm »
Code: [Select]
If X<95 and getKey(3):X+1->X:sub(A):End
If Y>7 and getKey(4):Y-1->Y:sub(A):End
If X>0 and getKey(2):X-1->X:sub(A):End
If Y<62 and getKey(1):Y+1->Y:sub(A):End

can be
Code: [Select]
If X>0 and (X<95
getKey(3)-getKey(2)+X->X
sub(A)
End
If Y<62 and (Y>7
getKey(1)-getKey(4)+Y->Y
sub(A)
End

that way you're only calling the subroutine twice.. because think about it, all four of your if-conditionals have the possibility of being true simultaneously, so you'd be calling the subroutine A 3 unnecessary times.
Code: [Select]
While getKey(29) and (G=29):If L>1:L-1->L:Text(1,0,L|>Dec):Pause 125:End:End

or, more readably:

While getKey(29) and (G=29)
If L>1
L-1->L
Text(1,0,L|>Dec)
Pause 125
End:End

can be
Code: [Select]
While L>1 and getKey(29)
L-1->L
Text(1,0,L>Dec
Pause 125
End

because if L is not greater than 1, nothing in the while loop happens and is therefore useless, so i put L>1 as a conditional for the loop to be checked against. however, if you want getkey(29) to halt program execution even when L<1, my optimization is useless.
Similar optimizations can be made to the while loops nearby that section in the code.


with the l one: nope
youe must have the if g=29 also
it prevents strange errors
School: East Central High School
 
Axe: 1.0.0
TI-84 +SE  ||| OS: 2.53 MP (patched) ||| Version: "M"
TI-Nspire    |||  Lent out, and never returned
____________________________________________________________

Offline nemo

  • LV9 Veteran (Next: 1337)
  • *********
  • Posts: 1203
  • Rating: +95/-11
    • View Profile
Re: Project... i'll need help
« Reply #55 on: June 17, 2010, 05:56:51 pm »
screw it then; i might as well make a useful optimization even if small. this monster:
Code: [Select]
0->S->O->P+1->L+9->X->Y+90->A

can be turned into this monster:

Code: [Select]
0->S->O->P+1->L+9->X->Y^2->A
where ^2 means 2 (squared sign)


Offline calcdude84se

  • Needs Motivation
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2272
  • Rating: +78/-13
  • Wondering where their free time went...
    • View Profile
Re: Project... i'll need help
« Reply #56 on: June 17, 2010, 05:59:20 pm »
Is the generated code actually smaller though? I'd think an add would be faster and smaller than squaring it. This isn't BASIC :P
I should look over the code myself for optimizations...
"People think computers will keep them from making mistakes. They're wrong. With computers you make mistakes faster."
-Adam Osborne
Spoiler For "PartesOS links":
I'll put it online when it does something.

Offline nemo

  • LV9 Veteran (Next: 1337)
  • *********
  • Posts: 1203
  • Rating: +95/-11
    • View Profile
Re: Project... i'll need help
« Reply #57 on: June 17, 2010, 06:01:35 pm »
touche. this is not basic. squaring makes the code larger by 35 bytes.


Offline Happybobjr

  • James Oldiges
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2325
  • Rating: +128/-20
  • Howdy :)
    • View Profile
Re: Project... i'll need help
« Reply #58 on: June 17, 2010, 07:44:19 pm »
Code: [Select]
  Etch-E-Sketch + Clear By Shake
Version: 1.2.1
Compiler: Axe 3.0
Coded by: James Oldiges of Happybobjr Productions.
Code assistance by: Quigibo found at: http://www.omnimaga.org/index.php?action=profile;u=321

/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\

History:
I was at school one day, trying to learn the newest version of Axe.
As always I am stubborn and want to learn by trial-and-error.
To start off with I just tried to learn the syntax of the commands.
(In Ti-Basic with pxl-on command it is pxl-on(Y, X)
I am thinking Why The!?!?!?
So I just made a simple program to display what the pixel location was (adjustable by arrow keys)
Well I screwed up. It didn't delete the previous pxl. .. Oops.
So I started drawing for a while, having a good laugh with my friends during math.
My teacher was reviewing so my friends and I didn't need to pay full attention (as long as we were being quiet)
So I updated the program of course to add features like; Clearing the screen
Adjustable speed
Save and restore
And other such goodies.

Then one of my friends came over (one listening to the review, who just finished) asked if a made a real etch-e-sketch.
Sarcastically I shook it and accidently bumped the delete button. The screen cleared :P.
It was funny since he thought the shaking did it.
Eventually we told him what happened.
Right then I made it my project for the whole summer to create an attachment that would clear the screen.

/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\

Description:
This Etch-E-Sketch is a first of its kind that looks for the I/O port for a command to clear the screen.
Yes KermMartian did make a similar program and attachment as the same time as me.

/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\

Key codes

+ increases the number of milliseconds between repetition. Thus, slowing the etching speed.
- Decreases the number of milliseconds between repetition. Thus, increasing the etching speed.

/ (divide) Saves the current picture s you may recall it again later (not stowed into pic).
* (multiply) recalls a previously stowed picture. (If had not yet stowed one, clears screen and puts curser at 0, 0

( Decreases the number of pixels removed when shaken (requires attachment)
) increases the number of pixels removed when shaken (requires attachment)

^ (carrot key) shows inverse of the picture.
Del clears screen.
Clear quits program. (Do a double clear for kicks and giggles.)

/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\

Notes:

Because this is a newer program, it is safer to do a Garbage-collect after each use
Should work on:
Ti-83
Ti-83+
Ti-83+ silver
Ti-84
Ti-84+
Ti-84+ silver.

/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/
/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/

     Motion Detection

Up there is only the program. Now you will find the heart and soul of this project, the motion detector.

/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\

About:
Ok so I started out with no information.  I didn't know how to approach this.
I realized it must be possible to detect something in the I/O port, but I didn't know how.
The other thing I did not understand is the making of a 2.5mm male jack.
The jack it turns out has 3 parts. Ground, Left, and Right.
The two in the middle are Ground, the ones next to those are Right, and the tips are Left.
In Axe, Quigibo informed me, you can check for four different occurrences; Left high, left low, right high, and left low.

At start without anything connected, there will be left high and right high.
Left/Right will become low when Left/Right is connected to Ground.

The code Quigibo gave me was: asm(DB00E6036F2600)
This stores a result into ans. (I think not 100% sure about this.)
So if you do asm(DB00E6036F2600)->var, you can have a piece of code depending on the answer.

So then, after tinkering and destroying my 2 2.5mm male jacks, I rushed off to Radio Shack.
"Tell me if you, a Radio Shack", quote from Kungpow, a notoriously funny movie. Well back to the point.
So at Radio Shack I am having no luck finding what I need.
After about 10 min. a guy who worked there asked if he could help.
He could. So then I told him what I needed and he found it, sort of.
He could only find a 2.5mm jack (mono) which only has left and ground.
I am thrilled. This will make soldering everything much easier. 2 for $3.50, what a deal!

Ok Now I have everything. And was good to start building.

Thanks to KermMartian for help with;
Workings and design on 2.5 mm jack and information about most efficient build for project.

Found at: http://www.cemetech.net/forum/profile.php?mode=viewprofile&u=2

\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/

Contact information:  Email is [email protected]
School: East Central High School
 
Axe: 1.0.0
TI-84 +SE  ||| OS: 2.53 MP (patched) ||| Version: "M"
TI-Nspire    |||  Lent out, and never returned
____________________________________________________________

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: Project... i'll need help
« Reply #59 on: June 17, 2010, 11:54:50 pm »
Nice readme so far

Make sure to name the file ignoreme.txt, though, so more people will read it :P