This is an archived, read-only copy of the United-TI subforum , including posts and topic from May 2003 to April 2012. If you would like to discuss any of the topics in this forum, you can visit Cemetech's TI-BASIC subforum. Some of these topics may also be directly-linked to active Cemetech topics. If you are a Cemetech member with a linked United-TI account, you can link United-TI topics here with your current Cemetech topics.

This forum is locked: you cannot post, reply to, or edit topics. TI-Basic => TI-BASIC
United-TI Archives -> TI-Basic
 
    » Goto page Previous  1, 2, 3, 4, 5, 6, 7  Next
» View previous topic :: View next topic  
Author Message
cjgone
Aw3s0m3


Active Member


Joined: 24 May 2006
Posts: 693

Posted: 22 Feb 2009 05:36:17 pm    Post subject:

Sad, I can't understand these crazy optimizations. In fact, I don't get how to make snake with no lists. =(
Back to top
Weregoose
Authentic INTJ


Super Elite (Last Title)


Joined: 25 Nov 2004
Posts: 3976

Posted: 22 Feb 2009 05:44:31 pm    Post subject:

In Button Masher, I would change that Repeat 20=randInt(10,30 to While int(21rand. ;)

Since "geometric mean" is a popular search phrase that leads people to my website, I've been needing an excuse to post one.

This works for lists of positive reals only: 10^(mean(log(Ans


Last edited by Guest on 11 Jul 2010 06:17:32 pm; edited 1 time in total
Back to top
nitacku


Advanced Member


Joined: 23 Aug 2005
Posts: 408

Posted: 22 Feb 2009 09:17:58 pm    Post subject:

cjgone wrote:
Sad, I can't understand these crazy optimizations. In fact, I don't get how to make snake with no lists. =(

I'm not sure how to create a snake game without using a list either.
Is there a snake game which accomplishes this?

As for the optimizations, I have found that studying other authors source code is the best way to learn. That is one of the reasons why I am posting five minute programs. They are small enough to be coded directly by hand and they reinforce active learning through practice and critical thinking.
Back to top
calc84maniac


Elite


Joined: 22 Jan 2007
Posts: 770

Posted: 23 Feb 2009 01:12:46 am    Post subject:

I have made one without lists before...
Back to top
N.cruz


Newbie


Joined: 17 Feb 2009
Posts: 7

Posted: 23 Feb 2009 07:28:23 am    Post subject:

Snipes17 wrote:
Quote:
RE: Luby

hi I have a doubt... where can I fond the "LKEY" ...

is it the letter "L" ??

thks


The "LKey" is a list. The little L in front of Key is found in the list menu (2nd+Stat) under the "Ops" header. Then spell out "Key". Does that help?


So I have to put that little L and then write the word "KEY" with the <ALPHA> function?

correct me if I were wrong please

THKS
Back to top
darkstone knight


Advanced Member


Joined: 07 Sep 2008
Posts: 438

Posted: 23 Feb 2009 10:17:18 am    Post subject:

yep..

use uppercase letters
Back to top
mr. sir


Newbie


Joined: 21 Feb 2008
Posts: 41

Posted: 23 Feb 2009 04:55:42 pm    Post subject:

Well, when I have a list I need to type in over and over, it becomes kind of a pain. So I usually use the SetUpEditor function, run the program once, then the list will appear in the menu and I won't have to type the LKEY in over and over again: I can just use the name in the menu.
Back to top
TI-newb


Member


Joined: 24 Dec 2008
Posts: 158

Posted: 23 Feb 2009 10:20:36 pm    Post subject:

Nitacku, i have been playing the snake game and it's awsome! but is it possible to make it in a graph screen? for that would free up more room and make it easier to play. anyways your awsome!

another cool Five Minute Program would be a clock, i do not know if it is possible, but like, displaying an actual clock (circle, with the Hour hand, Minute hand and the seconds). but i do not know if that can be done in 5 minutes. but i'm just placing suggestions out there.
Back to top
SonicBoom95


Member


Joined: 31 Jan 2008
Posts: 237

Posted: 24 Feb 2009 08:35:58 am    Post subject:

[quote name='TI-newb' post='131587' date='Feb 24 2009, 04:20 AM']Nitacku, i have been playing the snake game and it's awsome! but is it possible to make it in a graph screen? for that would free up more room and make it easier to play. anyways your awsome!

another cool Five Minute Program would be a clock, i do not know if it is possible, but like, displaying an actual clock (circle, with the Hour hand, Minute hand and the seconds). but i do not know if that can be done in 5 minutes. but i'm just placing suggestions out there.[/quote]

First question: Yes. Yes it can. I'm a bit on the time-pressed side, so I can't decipher nitacku's optimizations right now, to change the grid size and such. (Though if I had gotten any sleep last night, it might have helped. Darn you Touhou 10.) The change itself is a theoretically simple one. Just change the grid size, and change the place where the graphics are being placed. In fact, collision detection might become a LOT easier...in fact, I can see a way to entirely rewrite this with graph screen. <nerdity>We can make it better. Faster. Stronger.</nerdity>

Second question: a. Yes. b. No.
Back to top
TI-newb


Member


Joined: 24 Dec 2008
Posts: 158

Posted: 24 Feb 2009 09:58:05 pm    Post subject:

i have made a clock so far, and uhm, if u don't mind can u display the snake game on grids? cause im still like a beginner and do not know much.. im starting to learn about Lists and Strings
Back to top
nitacku


Advanced Member


Joined: 23 Aug 2005
Posts: 408

Posted: 25 Feb 2009 02:25:07 am    Post subject:

Ok, here is the Snake game modified for the Graph screen.
The code is nearly identical to the Homescreen version.
The only differences between the two versions is the code I colored orange.

Snake [Graph Screen]
PlotsOff
AxesOff
GridOff
FnOff
ClrDraw

6→X
4→Y
0→Z
4.06→θ
SetUpEditor L1 //this is the list
{Ans,Ans,Ans→L1
26
Repeat max(Y+.01X=L1
If Ans=24 or Ans=26
Then
Ans-25→A
DelVar B
End
If Ans=34 or Ans=25
Then
int(.25(Ans-29→B
DelVar A
End
If Y+.01X=θ
Then
Z+1→Z
Repeat not(max(Ans=L1
randInt(0,9)+.01randInt(0,22
End
Ans→θ
Text(6int(Ans),400fPart(Ans),"+
augment(L1,{Y+.01X→L1
End
Text(6int(L1(1)),400fPart(L1(1)),"░░░ //3 spaces
∆List(cumSum(augment(L1,{Y+.01X→L1
Y+B
Ans-10((Ans>9)-(Ans<0→Y
X+A
Ans-23((Ans>22)-(Ans<0→X
Text(6Y,4X,"O
getKey
End
ClrHome
Disp "CRASHED!","SCORE:
Output(2,8,Z

It's actually possible to make this game go even faster now that it is on the Graph screen.
Instead of keeping track of all the snake links, only the first and last would need to be known.
Collisions would be detected by using the pxl-Test( command.
If you like, I can post that version as well :P

TI-newb wrote:
i have made a clock so far, and uhm, if u don't mind can u display the snake game on grids? cause im still like a beginner and do not know much.. im starting to learn about Lists and Strings
If you want to display a grid, you can add the following code to the top of the program, however the grid is going to be erased as the snake moves around the screen.
0→Xmin
0→Ymin
.25→∆X
.16→∆Y
...
GridOn //Replace GridOff
...


btw, I'll also post the code to the clock program tomorrow.


Last edited by Guest on 21 Jun 2010 11:56:44 pm; edited 1 time in total
Back to top
TI-newb


Member


Joined: 24 Dec 2008
Posts: 158

Posted: 25 Feb 2009 08:02:45 pm    Post subject:

[quote name='TI-newb' post='131596' date='Feb 24 2009, 09:58 PM']i have made a clock so far, and uhm, if u don't mind can u display the snake game on grids? cause im still like a beginner and do not know much.. im starting to learn about Lists and Strings[/quote]


What i meant was, If u dont' mind can u display the snake game on 'Graphs' ?" i was uhm. tired xD but u still did it on graph ! that is cool, i can't wait till i try it out.
Back to top
nitacku


Advanced Member


Joined: 23 Aug 2005
Posts: 408

Posted: 25 Feb 2009 11:02:13 pm    Post subject:

Here is the code to create an analog clock for those of you who own a TI-84+/SE calc.

Analog Clock
ZStandard
ZSquare
FnOff
AxesOff
GridOff
PlotsOff
ClrDraw
Radian
DelVar X
DelVar Y
DelVar θ
SetUpEditor L1
Circle(0,0,10,{i //imaginary number i
Circle(0,0,9.3,{i //imaginary number i
Repeat getKey=45
πgetTime/30→L1 //pi * getTime (function only available on TI-84+/SE)
If θ≠Ans(3
Then
If Y≠Ans(2
Then
If .4X≠Ans(1
Then
Line(0,0,5sin(X),5cos(X),0
2.5Ans(1→X
End
Line(0,0,7sin(Y),7cos(Y),0
L1(2→Y
End
Line(0,0,8sin(θ),8cos(θ),0
L1(3→θ
Line(0,0,8sin(Ans),8cos(Ans
Line(0,0,7sin(Y),7cos(Y
Line(0,0,5sin(X),5cos(X
End
End
ClrDraw
ClrHome


Last edited by Guest on 21 Jun 2010 11:57:41 pm; edited 1 time in total
Back to top
exponation


Newbie


Joined: 27 Feb 2009
Posts: 1

Posted: 27 Feb 2009 04:42:48 am    Post subject:

Uhh... sorry for being confused... but whenever I attempt to run snake, it says there's a syntax error in the "(Ans,Ans,Ans->L1" line. the error occurs specifically on the comma between the second and third ans. can anyone help me out?
Back to top
darkstone knight


Advanced Member


Joined: 07 Sep 2008
Posts: 438

Posted: 27 Feb 2009 05:27:56 am    Post subject:

its {, not (
Back to top
SonicBoom95


Member


Joined: 31 Jan 2008
Posts: 237

Posted: 27 Feb 2009 08:28:54 am    Post subject:

Hey, Nitacku. I've been poring over how you could optimize the code on Snake, by only keeping track of the first and last positions of the snake. Trouble is, doing that seems to require keeping track of everything in the middle...so, it seems like it would be just a simple conditional swap from max(.....=L1) to something involving pxl-Test.

Am I wrong?
Back to top
Weregoose
Authentic INTJ


Super Elite (Last Title)


Joined: 25 Nov 2004
Posts: 3976

Posted: 27 Feb 2009 01:31:26 pm    Post subject:

If you take a one-pixel-thin snake body that walks two pixels at a time, then there would only be one pixel to touch the end of the tail.
Back to top
Ed H


Member


Joined: 30 Nov 2007
Posts: 138

Posted: 27 Feb 2009 06:56:39 pm    Post subject:

Here is a snake program that uses no lists. I wrote this a while ago, and I'm not sure if this is the latest version. It's pretty playable; try it!
Back to top
TI-newb


Member


Joined: 24 Dec 2008
Posts: 158

Posted: 27 Feb 2009 08:07:49 pm    Post subject:

exponation wrote:
Uhh... sorry for being confused... but whenever I attempt to run snake, it says there's a syntax error in the "(Ans,Ans,Ans->L1" line. the error occurs specifically on the comma between the second and third ans. can anyone help me out?



okay, lemme tell u, instead of using "(" you have to use '{'
{ is used for Lists, and " is used to strings, since L1 is a List, you have to type down, {Ans,Ans,Ans,->L1
Back to top
nitacku


Advanced Member


Joined: 23 Aug 2005
Posts: 408

Posted: 27 Feb 2009 09:45:19 pm    Post subject:

Ed H wrote:
Here is a snake program that uses no lists. I wrote this a while ago, and I'm not sure if this is the latest version. It's pretty playable; try it!

Ah, yes. Pxl-test does make this possible.
But I wonder if a snake game can be created without using lists and pxl-test... and matrices as well


Last edited by Guest on 27 Feb 2009 09:47:49 pm; edited 1 time in total
Back to top
Display posts from previous:   
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
    » Goto page Previous  1, 2, 3, 4, 5, 6, 7  Next
» View previous topic :: View next topic  
Page 2 of 7 » All times are UTC - 5 Hours

 

Advertisement