Login [Register]
Don't have an account? Register now to chat, post, use our tools, and much more.
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
nitacku


Advanced Member


Joined: 23 Aug 2005
Posts: 408

Posted: 15 May 2009 01:54:38 am    Post subject:

TI-newb wrote:
nikkaku. How about you make us a Graph Screen Menu that can be inserted into another program.

I'm almost done mine. but i wanna see how you would do it.

Alright, I finally got around to creating this.

Graph Screen Menu

[generic window setup]
FnOff
GridOff
AxesOff
PlotsOff
0→Xmin
0→Ymin
1→∆X
1→∆Y

0→A //this controls the x coordinate position of the menu
0→B //this controls the y coordinate position of the menu
{4,2,3→L1 //this list controls the number of items per menu
"Title 1 Title 2 Title 3 →Str1 //each title name must be 10 characters in length
"Item 1.1 Item 1.2 Item 1.3 Item 1.4 Item 2.1 Item 2.2 Item 3.1 Item 3.2 Item 3.3 →Str2 //each item name must be 10 characters in length
1→θ
Repeat max(Ans={21,45,105
θ+(Ans=26)-(Ans=24
Ans-dim(L1)((Ans>dim(L1))-not(Ans→θ
ClrDraw
For(Z,-1,L1
cumSum(L1
If Z>-1
Then
If Z
Then
sub(Str2,10Z+10Ans(θ)-10L1(θ)-9,10
Else
"<"+sub(Str1,10θ-9,10)+">
End
Text(B+8Z+1,A+9-7not(Z),Ans
End
54-B-8Z
Line(A+1,Ans,A+49,Ans
End
63-B-8Z
Line(A,61-B,A,Ans
Line(A+50,61-B,A+50,Ans
1→X
Repeat max(Ans={21,24,26,45,105
If Ans
Then
Text(8X+1,8A+2,"░░░░░ //5 spaces
X+(Ans=34)-(Ans=25
Ans-L1(θ)((Ans>L1(θ))-not(Ans→X
Text(8X+1,8A+2,"*
End
getKey
End
End


When this loop exits, Ans will hold the latest key press (so 45 means Clear was pressed if you want to quit the program), θ holds the current menu number, and X holds the current menu item.



IAmACalculator wrote:
@nitaku: Could you maybe annotate one or two of those programs for me? I'm still (!) trying to break out of my TI-Basic n00b box, and while I now have an 89, many things still apply from the Z80 series. I think having a small and elegant program explained would help me and some of the other beginners.

Alright, below is the annotated version of Racer:

ClrHome

This loop prepares the Disp "bump". It outputs a few Disp " so that the screen will scroll when a Disp " is executed.
For(θ,0,13
Disp " //no space
Output(8,5,"*░░░░░░* //6 spaces
End
Initiate the list and the variables
SetUpEditor L1 //this is the list
7→dim(L1
Fill(5.7,L1 //this is the list of obstacle positions (integer) and separation (decimal)
8→X //this is the vehicle position
5→Y //this holds the current position of the obstacles
7→θ //this holds the current separation of the obstacles
DelVar Z //this is the counter. It increments by 1 each iteration

Begin the game loop
This will repeat until the vehicle position equals or exceeds the position of an obstacle
Repeat X≤int(Ans) or X≥int(Ans)+10fPart(Ans [color=#9acd32]//check vehicle position versus obstacle positions[/color]
Z+1→Z //increment counter
θ-not(fPart(.03Ans→θ [color=#9acd32]//decrease separation of obstacles if counter is a multiple of 100[/color]
getKey
X+(Ans=26)-(Ans=24→X //increase car position if right arrow is pressed, decrease if left arrow is pressed
Y+int(2-3rand //generate random integer of either -1, 0, or 1
Ans-(Ans+θ>16)+not(Ans→Y //add the random integer to the current obstacle position & correct resultant value if value places obstacles off screen
Disp " //no space [color=#9acd32]//scroll the screen up one line[/color]
Output(1,X,8 [color=#9acd32]//display vehicle at its position[/color]
Output(8,Ans,"* //display left obstacle
Output(8,Ans+θ,"* //display right obstacle
//shift list by 1 element and add new obstacle position to end of list
∆List(cumSum(augment(L1,{Ans+.1θ→L1
For example a list that looks like {4,7,3,9,2} would become {7,3,9,2} and then a new value is added to the end of the list so: {7,3,9,2,1}

Ans(1 //put the value of the 8th row (same row as vehicle) obstacle position into Ans
The Repeat loop will use this value and compare the integer part and the decimal part with the vehicle position.
int(Ans) gives the left obstacle position. int(Ans)+10fPart(Ans) gives the right obstacle position.
If the vehicle position equals or exceeds the obstacle positions, the vehicle has crashed and it's game over
End
Output(4,1,"Crash! Score:
Output(4,14,Z


Last edited by Guest on 22 Jun 2010 12:01:17 am; edited 1 time in total
Back to top
TI-newb


Member


Joined: 24 Dec 2008
Posts: 158

Posted: 15 May 2009 09:03:56 pm    Post subject:

oh wow. i really wanna try out your graph menu XD. Mine is less complicated but the items can be whatever length... thats the only better thing about my menu lol. 1 sec. lemme try out this prgm

If you want to see my Graph Menu. go to Ti-Basic Forums. then check my Graph Menu subject.

Nitacku. im getting a Syntax Error at "<"+sub(Str1,10θ-9,10),">


Last edited by Guest on 15 May 2009 09:28:14 pm; edited 1 time in total
Back to top
darkstone knight


Advanced Member


Joined: 07 Sep 2008
Posts: 438

Posted: 16 May 2009 03:09:46 am    Post subject:

"<"+sub(Str1,10θ-9,10)+">
Back to top
nitacku


Advanced Member


Joined: 23 Aug 2005
Posts: 408

Posted: 17 May 2009 01:10:32 pm    Post subject:

The comma should be a plus as darkstone knight pointed out.
(I corrected the error in the code)


Last edited by Guest on 17 May 2009 01:11:47 pm; edited 1 time in total
Back to top
nitacku


Advanced Member


Joined: 23 Aug 2005
Posts: 408

Posted: 02 Jun 2009 11:21:12 pm    Post subject:

New 5 minute program!

This is a minesweeper game on the homescreen in under 500 bytes (488 to be exact). I was trying to code the game using only the variables X, Y & θ, but I had to bring in A & B for the counting loop. This might seem longer than a 5 minute program, but I bet if you type fast enough it can be coded in 5 minutes Razz.

The game is programmed to generate 13 mines. If you would like to modify the code to generate more mines, increase the orange 12 in the For loop (line #4) and decrease the orange114 in the Repeat loop (line #21) by the same value that you increased the 12.

TinyMine[Minesweeper]
ClrHome
{18,10→dim([A]
Fill(1,[A]
For(X,0,12
Repeat 1=[A](Y,Ans
randInt(2,17→Y
randInt(2,9
End
2→[A](Y,Ans
End
-[A]→[A]
For(X,1,16
For(Y,1,8
Output(Y,X,"= //this is the character used for the tiles
End
End
DelVar θ
3→X
2→Y
24
Repeat Ans=45 or θ>114
If Ans
Then
If Ans=21 or Ans=105
Then
If -2=[A](X,Y
Then
For(X,2,17
For(Y,2,9
Output(Y-1,X-1,sub(" *",1+([A](X,Y)=-2),1 //there is a space before the asterisk
End
End
Output(4,2,"DEATH EXPLODE! //trying to be creative here
Stop
End
θ+(0>[A](X,Y→θ
1
For(A,-1,1
For(B,-1,1,1+not(A
Ans+(-2=[A](X+A,Y+B
End
End
Ans→[A](X,Y
End
Output(Y-1,X-1,sub("= 12345678",1+([A](X,Y)>0)abs([A](X,Y)),1 //there is a space after the equals sign
If Ans=26 or Ans=24
Then
X+(Ans-25
Ans+16((Ans<2)-(Ans>17→X
Else
Y+(Ans=34)-(Ans=25
Ans+8((Ans<2)-(Ans>9→Y
End
Output(Y-1,X-1,"+ //this is the character used for the cursor
End
getKey
End
ClrHome
If Ans≠45
Output(4,4,"EXCELLENT. //winning message


Last edited by Guest on 22 Jun 2010 12:02:29 am; edited 1 time in total
Back to top
TI-newb


Member


Joined: 24 Dec 2008
Posts: 158

Posted: 03 Jun 2009 08:13:02 am    Post subject:

Looools. When you wrote the 'Five Minute Programs' as the title of this topic. i thought u meant 5 minutes to make, type of programs.
Looks good. Although i don't have any time right now to put it on my calculator(cause ihave school in like.. Now). i will get it later XD and try it out.


Last edited by Guest on 03 Jun 2009 08:14:21 am; edited 1 time in total
Back to top
Galandros


Active Member


Joined: 29 Aug 2008
Posts: 565

Posted: 03 Jun 2009 08:38:01 am    Post subject:

[quote name='TI-newb' post='133997' date='Jun 3 2009, 02:13 PM']When you wrote the 'Five Minute Programs' as the title of this topic. i thought u meant 5 minutes to make, type of programs.[/quote]
Me too.

Making a minesweeper with 5 variables (matrix counts) makes a fun challenge.
Back to top
dxfan101010


Member


Joined: 31 Mar 2008
Posts: 194

Posted: 03 Jun 2009 05:14:08 pm    Post subject:

Great game. Nice and short.
Back to top
ztrumpet


Active Member


Joined: 06 May 2009
Posts: 555

Posted: 05 Jun 2009 02:16:51 pm    Post subject:

I really like Tinymine.

Here's a program I just made. I was messing around with scrolling the screen with Disp" and this game happened. It's very fast. Good luck getting a score over 5 on an 84+SE!

Code:
DelVar S
ClrHome
For(A,1,7
Disp " (No space after ")
End
For(A,1,25
randInt(1,3->B
randInt(0,2
Disp 3Ans+B
60+10(3-Ans)+1+B
For(B,1,7
Disp " (No space after ")
If getkey=Ans
S+1->S
End
End
Disp "SCORE:
Output(7,7,S

Call it whatever you want. I don't have a name for it. Smile


Last edited by Guest on 05 Jun 2009 02:18:17 pm; edited 1 time in total
Back to top
TI-newb


Member


Joined: 24 Dec 2008
Posts: 158

Posted: 06 Jun 2009 03:34:07 pm    Post subject:

what are we supposed to do?.. i see random numbers flying up my screen. but no matter whatbuttons i press itdoesn'tdo anything..\

can u explain the gameplay?
Back to top
ztrumpet


Active Member


Joined: 06 May 2009
Posts: 555

Posted: 06 Jun 2009 04:35:56 pm    Post subject:

Sorry. Press the number you see flying up the screen. If you get it before it reaches the top, your score will increase by one.
Back to top
woodswolf


Advanced Newbie


Joined: 26 Feb 2009
Posts: 53

Posted: 06 Jun 2009 04:56:25 pm    Post subject:

lol nice xP

score: 26 on first try

40 on second, but I guess I cheat xP


Last edited by Guest on 06 Jun 2009 04:58:53 pm; edited 1 time in total
Back to top
ztrumpet


Active Member


Joined: 06 May 2009
Posts: 555

Posted: 06 Jun 2009 05:04:13 pm    Post subject:

How did you get so high? Smile
If you typed it exactly as I did the max score would be 25.
Back to top
woodswolf


Advanced Newbie


Joined: 26 Feb 2009
Posts: 53

Posted: 06 Jun 2009 05:46:34 pm    Post subject:

Well, this has the exact same problem as I was facing in V.1 of my first real game called: Whack A Mole. Moles could appear on the same spot simultaneously so doubling tapping could get you more points. As far as that goes, I can spam my buttons before the numbers disappear, getting multiple points out of one number. Thats why I said:"I guess I cheat".
Back to top
Eeems


Advanced Member


Joined: 25 Jan 2009
Posts: 277

Posted: 06 Jun 2009 05:47:57 pm    Post subject:

that's why you get rid of the spamming! add in a hit/not hit thing so that they can't spam the buttons
Back to top
ztrumpet


Active Member


Joined: 06 May 2009
Posts: 555

Posted: 06 Jun 2009 06:10:25 pm    Post subject:

I don't know. Because I use ans and it's updated with the score every time you hit a number, you can't get points for the same number more than once. Me thinks you changed the for loop on the 6th line or incremented the score by more than one.
Back to top
woodswolf


Advanced Newbie


Joined: 26 Feb 2009
Posts: 53

Posted: 06 Jun 2009 06:11:47 pm    Post subject:

you think wrong, I made an exact copy of your game.
Back to top
ztrumpet


Active Member


Joined: 06 May 2009
Posts: 555

Posted: 06 Jun 2009 07:08:05 pm    Post subject:

?????????????????????????????????????
I have no idea what happened. Oh well. [whiteout]Like it will stay on my calculator for long. (If your reading this, I have much better games than this game. Like Tinymine.)[/whiteout]


Last edited by Guest on 12 Jul 2010 01:12:11 am; edited 1 time in total
Back to top
TI-newb


Member


Joined: 24 Dec 2008
Posts: 158

Posted: 07 Jun 2009 10:33:13 am    Post subject:

Lol.igot the score 175.
Back to top
dxfan101010


Member


Joined: 31 Mar 2008
Posts: 194

Posted: 08 Jun 2009 01:04:59 am    Post subject:

lolz i got 174 *darn* i missed 1
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 4 of 7 » All times are GMT - 5 Hours

 

Advertisement