Jump to content

Photo

19 Carrots of Gold

xb demo

52 replies to this topic

#1 sometimes99er OFFLINE  

sometimes99er

    River Patroller

  • 4,225 posts
  • Location:Denmark

Posted Thu Sep 1, 2016 6:33 AM

Exsqueeze me. Bugs Bunny fan art parody. Ha ha ha ...
 
:-D 
 
8)

Edited by sometimes99er, Wed Apr 4, 2018 10:13 PM.


#2 Sinphaltimus OFFLINE  

Sinphaltimus

    River Patroller

  • 2,521 posts
  • Distracted at the Keyboard
  • Location:Poconos, PA

Posted Thu Sep 1, 2016 6:49 AM

That's pretty cool, for a noob, can you explain it line by line?

I get most of it.

Why 9^9?

Sub and subend?

Why call char, display at and sprite? Is that the only way to do 3 colors?

Edited by Sinphaltimus, Thu Sep 1, 2016 6:50 AM.


#3 RickyDean OFFLINE  

RickyDean

    Stargunner

  • 1,117 posts

Posted Thu Sep 1, 2016 6:51 AM

Exsqueeze me
 
:)
 

! 19 Carrots of Gold, 2016.09.01 sometimes99er
100 call screen(11)::call clear::call magnify(3)::call color(9,10,1,10,3,1)
110 call char(97,"000000000000000E0F1F1B3D367860800080808",104,"000000507870F8C")
120 call char(100,"0000000007080810122124434CB0C00038544246829C60202020C")
130 for i=1 to 19::call carrot(i,int(rnd*22),int(rnd*27))::next i::for i=0 to 9^9::next i
140 sub carrot(i,y,x)::display at(y+1,x+1):"ah"; ::display at(y+2,x+1):"bc"; ::call sprite(#i,100,2,y*8+3,x*8+16)::subend
run


Cute, I copied and pasted it into JS99er and let it run. ;-)



#4 sometimes99er OFFLINE  

sometimes99er

    River Patroller

  • Topic Starter
  • 4,225 posts
  • Location:Denmark

Posted Thu Sep 1, 2016 8:42 AM

That's pretty cool, for a noob, can you explain it line by line?


Thanks, and no, it's really basic. ;)
 

I get most of it.


Phew. :)
 

Why 9^9?


Instead of going to a new line with a GOTO looping forever. Squeezing the number of lines. 9^9 is just a really big number.
 

Sub and subend?


You have to look in the manual. Could have used GOSUB, or embedded the code, but SUB is so nice. ;)
 

Why call char, display at and sprite? Is that the only way to do 3 colors?


The short answer. Yes.

You can toggle patterns 60 times a second to get 3 colors (flickers but some combinations are better than others).

;)

Edited by sometimes99er, Thu Sep 1, 2016 8:43 AM.


#5 sometimes99er OFFLINE  

sometimes99er

    River Patroller

  • Topic Starter
  • 4,225 posts
  • Location:Denmark

Posted Thu Sep 1, 2016 8:46 AM

Cute, I copied and pasted it into JS99er and let it run. ;-)


Thanks. Didn't know you could paste in js99er. Cool.

:)

#6 --- Ω --- OFFLINE  

--- Ω ---

    Hexacorerunner

  • 13,924 posts
  • Location:82.102.25.76

Posted Thu Sep 1, 2016 8:52 AM

Neat, not bad for such tight code.  Could you add a bunny?



#7 RickyDean OFFLINE  

RickyDean

    Stargunner

  • 1,117 posts

Posted Thu Sep 1, 2016 9:00 AM

Thanks. Didn't know you could paste in js99er. Cool.

:)

Yep, just highlight the text here and copy, either from the menu, or ctrl C and then go into Exbasic in JS99er.net and cntrl V and wha-La.

 

 

a bastardized english version of the French word "voila" meaning "there it is" 
Often used by morons (me) in an attempt to sound more intelligent than they actually are. 
Incidentally, voila sounds phonetically like whala hence the improper spelling.

Edited by RickyDean, Thu Sep 1, 2016 9:34 AM.


#8 sometimes99er OFFLINE  

sometimes99er

    River Patroller

  • Topic Starter
  • 4,225 posts
  • Location:Denmark

Posted Thu Sep 1, 2016 9:28 AM

Neat, not bad for such tight code.  Could you add a bunny?


Thanks. And yes, I could add a bunny, but it would double the size of the program. And next thing would be to animate the bunny and make it a game. Let's just say it's on my list.

;)

#9 Sinphaltimus OFFLINE  

Sinphaltimus

    River Patroller

  • 2,521 posts
  • Distracted at the Keyboard
  • Location:Poconos, PA

Posted Thu Sep 1, 2016 9:43 AM

Thanks. And yes, I could add a bunny, but it would double the size of the program. And next thing would be to animate the bunny and make it a game. Let's just say it's on my list.

;)


Yeeeah, I just want to animate a little 8x8 character running across the screen...... lol.

#10 sometimes99er OFFLINE  

sometimes99er

    River Patroller

  • Topic Starter
  • 4,225 posts
  • Location:Denmark

Posted Thu Sep 1, 2016 9:49 AM

Yeeeah, I just want to animate a little 8x8 character running across the screen...... lol.


Which you've done so nicely. And it motivated me to look more into platformers.  :thumbsup:

 

7750a699cdf89dd6727e4bb3f586fbaf.jpg


Edited by sometimes99er, Thu Sep 1, 2016 9:51 AM.


#11 --- Ω --- OFFLINE  

--- Ω ---

    Hexacorerunner

  • 13,924 posts
  • Location:82.102.25.76

Posted Thu Sep 1, 2016 10:03 AM

Which you've done so nicely. And it motivated me to look more into platformers.  :thumbsup:

 

I remember boots like those!  :-D

85f2a2114305c16fe27168729420080f.jpg

 

Theme song....



#12 adamantyr OFFLINE  

adamantyr

    Stargunner

  • 1,483 posts

Posted Thu Sep 1, 2016 10:16 AM

Regarding SUB and SUBEND...

 

Subprograms are a unique feature of TI Extended BASIC. Basically, you can write your own subprograms just like CALL HCHAR, CLEAR, SCREEN are. You can pass values into the subprogram, both to use and to pass back values.

 

My favorite use of subprograms, which I do in almost every program:

 

1000 SUB WAIT(W):: FOR I=1 TO W :: NEXT I :: SUBEND

 

A delay subprogram, cuts down on the amount of code space wasted on FOR/NEXT loops

 

1000 SUB SND(S):: ON S GOTO 1010,1020,...

1010 CALL SOUND(100,110,2):: GOTO 1999

...

1999 SUBEND

 

A sound subprogram, all the game's sounds are contained in a single large block and can be called by using an ID number



#13 Sinphaltimus OFFLINE  

Sinphaltimus

    River Patroller

  • 2,521 posts
  • Distracted at the Keyboard
  • Location:Poconos, PA

Posted Thu Sep 1, 2016 10:34 AM

Regarding SUB and SUBEND...
 
Subprograms are a unique feature of TI Extended BASIC. Basically, you can write your own subprograms just like CALL HCHAR, CLEAR, SCREEN are. You can pass values into the subprogram, both to use and to pass back values.
 
My favorite use of subprograms, which I do in almost every program:
 
1000 SUB WAIT(W):: FOR I=1 TO W :: NEXT I :: SUBEND
 
A delay subprogram, cuts down on the amount of code space wasted on FOR/NEXT loops
 
1000 SUB SND(S):: ON S GOTO 1010,1020,...
1010 CALL SOUND(100,110,2):: GOTO 1999
...
1999 SUBEND
 
A sound subprogram, all the game's sounds are contained in a single large block and can be called by using an ID number



Whoa. I only ever used gosub and return in ti xb.

So sub and subend is like a script you can pass arguments to but it's self contained with in the program? (I know it doesn't have to be, they can be called from a file on disk)

Ok, this is something new I need to learn.

Awesome stuff. Thanks!

#14 Sinphaltimus OFFLINE  

Sinphaltimus

    River Patroller

  • 2,521 posts
  • Distracted at the Keyboard
  • Location:Poconos, PA

Posted Thu Sep 1, 2016 10:35 AM

Which you've done so nicely. And it motivated me to look more into platformers.  :thumbsup:
 
7750a699cdf89dd6727e4bb3f586fbaf.jpg

Wow, thanks man. That means a lot coming from you. As for me, I can make them, but I can't wear them. 6' 300 lbs is not graceful enough for wearing them I think. ;)

Edited by Sinphaltimus, Thu Sep 1, 2016 10:36 AM.


#15 adamantyr OFFLINE  

adamantyr

    Stargunner

  • 1,483 posts

Posted Thu Sep 1, 2016 10:40 AM

Whoa. I only ever used gosub and return in ti xb.

So sub and subend is like a script you can pass arguments to but it's self contained with in the program? (I know it doesn't have to be, they can be called from a file on disk)

Ok, this is something new I need to learn.

Awesome stuff. Thanks!

 

Yeah, subprograms are contained in the program. They have to be at the end of the program listing as well, but they can also be outside the pre-scan.

 

Oh, what's pre-scan? Pre-scan is detailed in the little addendum XB manual. Basically, you can cut down on the time for the program to start running by reducing the amount of your program scanned ahead of time for memory allocation.

 

The pattern you typically see of programs using it is the first block of statements are all variable/array declarations and all sub programs (built-in ones) used. That lets the pre-scan know everything it has to allocate memory for. Then it is turned off for the bulk of the program until the end, where any DATA and IMAGE statements are, as well as custom subprograms.



#16 Opry99er OFFLINE  

Opry99er

    Quadrunner

  • 10,731 posts
  • Location:Hustisford, WI

Posted Thu Sep 1, 2016 11:10 AM

Really cool, sometimes99er!!! Hoping for a new Rabbit Trail... One that has a bit of replay value. :D


A challenge for you, Sinphaltimus... Write your own CALL CLEAR subprogram, and replace it in the following code chunk:


100 CALL CLEAR
110 PRINT "I CAN WRITE A NEW SUBPROGRAM!!"
120 END


Replace CALL CLEAR with a SUB of your own design and call it CLR. :D

#17 Sinphaltimus OFFLINE  

Sinphaltimus

    River Patroller

  • 2,521 posts
  • Distracted at the Keyboard
  • Location:Poconos, PA

Posted Thu Sep 1, 2016 11:22 AM

Really cool, sometimes99er!!! Hoping for a new Rabbit Trail... One that has a bit of replay value. :D


A challenge for you, Sinphaltimus... Write your own CALL CLEAR subprogram, and replace it in the following code chunk:


100 CALL CLEAR
110 PRINT "I CAN WRITE A NEW SUBPROGRAM!!"
120 END


Replace CALL CLEAR with a SUB of your own design and call it CLR. :D


I accept. I will complete when I get home from work tonight. Thanks. I would have put it off otherwise.

#18 mizapf ONLINE  

mizapf

    River Patroller

  • 3,606 posts
  • Location:Germany

Posted Thu Sep 1, 2016 12:33 PM

Hmmm ... I tried to paste the BASIC code into my TIImageTool, but since you used lowercase letters, it got all subprogram names wrong ("CALL screen" - "SUBPROGRAM NOT FOUND IN 100"). The command words are uppercased, since they are reserved words, but the names could - in principle - be case-sensitive.

 

However, when I enter text in Extended Basic directly, those strings are always changed to uppercase, also the variable names. Is it correct to assume that all non-quoted strings are changed to uppercase?

 

(Also, I'll have to add some special handling for these interleaved "!" comments because until now I assumed that every line can be parsed as a program line.)



#19 --- Ω --- OFFLINE  

--- Ω ---

    Hexacorerunner

  • 13,924 posts
  • Location:82.102.25.76

Posted Thu Sep 1, 2016 12:40 PM

About that pre-scan that was mentioned.  BITD I had a program, I cannot remember it's name or if it was XB or E/A5, but it would take any XB program, and crunch it down in size, remove all REM statements, change long variable names and add that pre-scan command then spit out some real compact code.

 

Does anyone remember it's name or have a link to the program and documentation in PDF format?



#20 sometimes99er OFFLINE  

sometimes99er

    River Patroller

  • Topic Starter
  • 4,225 posts
  • Location:Denmark

Posted Thu Sep 1, 2016 12:44 PM

Really cool, sometimes99er!!! Hoping for a new Rabbit Trail... One that has a bit of replay value. :D

 

Thanks. Putting on my ...

thinking-cap.gif



#21 Opry99er OFFLINE  

Opry99er

    Quadrunner

  • 10,731 posts
  • Location:Hustisford, WI

Posted Thu Sep 1, 2016 12:47 PM

About that pre-scan that was mentioned.  BITD I had a program, I cannot remember it's name or if it was XB or E/A5, but it would take any XB program, and crunch it down in size, remove all REM statements, change long variable names and add that pre-scan command then spit out some real compact code.
 
Does anyone remember it's name or have a link to the program and documentation in PDF format?



PrescanIt!

#22 sometimes99er OFFLINE  

sometimes99er

    River Patroller

  • Topic Starter
  • 4,225 posts
  • Location:Denmark

Posted Thu Sep 1, 2016 12:50 PM

Hmmm ... I tried to paste the BASIC code into my TIImageTool, but since you used lowercase letters, it got all subprogram names wrong ("CALL screen" - "SUBPROGRAM NOT FOUND IN 100"). The command words are uppercased, since they are reserved words, but the names could - in principle - be case-sensitive.

 

However, when I enter text in Extended Basic directly, those strings are always changed to uppercase, also the variable names. Is it correct to assume that all non-quoted strings are changed to uppercase?

 

Excellent. Good question, sounds plausible, that's all I can say. ;)



#23 Opry99er OFFLINE  

Opry99er

    Quadrunner

  • 10,731 posts
  • Location:Hustisford, WI

Posted Thu Sep 1, 2016 12:51 PM

Sometimes, if you have not yet read it, I HIGHLY suggest you read "Watership Down" for some inspiration. One of my all time favorite books. :)

#24 mizapf ONLINE  

mizapf

    River Patroller

  • 3,606 posts
  • Location:Germany

Posted Thu Sep 1, 2016 1:00 PM

OK, TIMT can now filter out the additional comments; it will only allow a BASIC line without line number when it starts with a ! or REM token and then discard it, hence it will be possible to paste listings with additional non-line comments. For the automatic uppercase translation I'd have to think a bit longer (or you simply stay with uppercase  :)  ).


Edited by mizapf, Thu Sep 1, 2016 1:00 PM.


#25 sometimes99er OFFLINE  

sometimes99er

    River Patroller

  • Topic Starter
  • 4,225 posts
  • Location:Denmark

Posted Thu Sep 1, 2016 1:45 PM

Sometimes, if you have not yet read it, I HIGHLY suggest you read "Watership Down" for some inspiration. One of my all time favorite books. :)

 

Actually I will. ;)
magician_pulling_a_rabbit_out_of_his_hat







Also tagged with one or more of these keywords: xb, demo

0 user(s) are browsing this forum

0 members, 0 guests, 0 anonymous users