Qbasicnews.com
October 21, 2019, 04:53:23 AM
 Pages: 1 [2] 3 4 ... 15
 Author Topic: Challenge....  (Read 63121 times)
Dav
Ancient Guru

Posts: 709

 « Reply #15 on: January 29, 2003, 11:50:59 AM »

Played around with it a bit more (since I had 2 more lines to use )

In this version, PALETTE is used both to make the gradient pallette and as a method for delay.  Ball size is increased.

Big BLUE balls....

Code:

1  SCREEN 13
2  FOR c% = -1 TO 63
3    IF c% = -1 THEN A\$ = MKI\$(RND * 320) + MKI\$(RND * 200) + CHR\$(8) ELSE PALETTE c%, c% * 65536
4  NEXT
5  FOR z% = RND * 54 TO 0 STEP -1
6     MID\$(A\$, 5, 1) = CHR\$(ASC(MID\$(A\$, 5, 1)) + 1)
7     IF INKEY\$ = "" THEN CIRCLE (CVI(MID\$(A\$, 1, 2)), CVI(MID\$(A\$, 3, 2))), z%, ASC(MID\$(A\$, 5, 1)) ELSE END
8     IF z% = 0 THEN GOTO 2 ELSE PAINT (CVI(MID\$(A\$, 1, 2)), CVI(MID\$(A\$, 3, 2))), ASC(MID\$(A\$, 5, 1))
9  NEXT

- Dav
 Logged

BlueKeyboard
Wandering Guru

Posts: 337

 « Reply #16 on: January 29, 2003, 03:01:28 PM »

Quote from: "Agamemnus"
Cool screensaver. Putting the variables in a string can save you at least 2 lines of code.

Interesting screensaver Keyboard. But no exit condition?

Thx :bounce:, in the QB IDE just press CTRL+Break.
(But it doesn't work if you compile it).
 Logged

relsoft
*/-\*

Posts: 3927

 « Reply #17 on: January 30, 2003, 02:31:01 AM »

Wow!!!! These savers a great!!!!

Keep it up!!!

I would prolly post a Plasma when I get to code.  Haven't code for 2 weeks 'cept for an hour yesterday.

My plasma would use Sin Additions. ie. Slow as hell

;*)
 Logged

y smiley is 24 bit.

Genso's Junkyard:
http://rel.betterwebber.com/
Neo
Na_th_an

Posts: 2150

 « Reply #18 on: January 30, 2003, 08:15:19 AM »

 Logged
Antoni Gual
Na_th_an

Posts: 1434

 « Reply #19 on: January 30, 2003, 08:14:12 PM »

Here is my screen saver. See if your eyes can stand it..

Code:

1 SCREEN 13
2 t% = RND * 345
3 WAIT &H3DA, 8
4 FOR i% = 0 TO 199
5 FOR j% = 0 TO 319
6 k% = ((k% + t% XOR j% XOR i%)) AND &HFF
7 PSET (j%, i%), k%
8 NEXT j%, i%
9 IF LEN(INKEY\$) THEN END ELSE GOTO 2
 Logged

Antoni
Agamemnus
x/ \z

Posts: 3491

 « Reply #20 on: January 30, 2003, 08:53:38 PM »

whoah!
 Logged

Peace cannot be obtained without war. Why? If there is already peace, it is unnecessary for war. If there is no peace, there is already war."

Visit www.neobasic.net to see rubbish in all its finest.
Antoni Gual
Na_th_an

Posts: 1434

 « Reply #21 on: January 30, 2003, 09:07:56 PM »

Rel: Can I post more than once?

Code:

1 IF re THEN CLEAR  ELSE SCREEN 13
2 x = RND * 320
3 y = RND * 199
4 im2 = im * im
5 im = 2 * re * im + (y / 100 - 1)
6 re = re * re - im2 + (x / 120 - 1.9)
7 iter% = iter% + 1
8 IF ABS(re) + ABS(im) > 2 OR iter% > 254 THEN PSET (x, y), iter% ELSE GOTO 4
9 IF LEN(INKEY\$) = 0 THEN GOTO 1
 Logged

Antoni
wizardlife
Na_th_an

Posts: 1456

 « Reply #22 on: January 30, 2003, 10:25:48 PM »

Quote from: "LooseCaboose"
Heres a Matrix like screen saver. I cant get it down to 9 lines with the palette changing code so Ill make that optional.

Code:

1 screen 12
2 FOR k = 1 TO 33 STEP 8
3   FOR i = 1 TO 6
4     COLOR INT(RND * 15) + 1
5     LOCATE 29, (i + k - 1) * 2
6     IF k = 33 AND i = 6 THEN PRINT INT(RND * 10) ELSE PRINT INT(RND * 10);
7   NEXT
8 NEXT
9 IF INKEY\$ = "" THEN GOTO 1

You could lose one line by using poke (\$B800) instead of locate, colour, and print...

Oh wait, I'm retarded... you'd still need a def seg... nevermind.
 Logged

wizardlife
Na_th_an

Posts: 1456

 « Reply #23 on: January 30, 2003, 11:40:54 PM »

Okay, here's my (tentative) entry:

Code:

1 RANDOMIZE TIMER
2 DEF SEG = &HB800
3 vars& = 40 + (12 * 256) + (2 * 65536)
4 IF PEEK(((vars& AND 255) + ((vars& \ 256 AND 255) * 80)) * 2) = 32 THEN POKE (((vars& AND 255) + ((vars& \ 256 AND 255) * 80)) * 2), 219 ELSE POKE (((vars& AND 255) + ((vars& \ 256 AND 255) * 80)) * 2), 32
5 IF (vars& \ 65536) = 0 THEN vars& = vars& - 256 ELSE IF (vars& \ 65536) = 1 THEN vars& = vars& + 1 ELSE IF (vars& \ 65536) = 2 THEN vars& = vars& + 256 ELSE vars& = vars& - 1
6 IF (vars& \ 256 AND 255) < 1 THEN vars& = vars& + (65536 + 256) ELSE IF (vars& \ 256 AND 255) > 23 THEN vars& = vars& + (65536 - 256) ELSE IF (vars& AND 255) < 1 THEN vars& = vars& + 65536 + 1 ELSE IF (vars& AND 255) > 78 THEN vars& = vars& +  65536 - 1
7 IF RND > .95 THEN vars& = vars& + 65536
8 IF vars& > 262144 THEN vars& = vars& - 262144
9 IF INKEY\$ = "" THEN GOTO 4 'edit d'oh!

Only as interesting as snake savers get... you may have to slow it down a little. I couldn't think of a really foolproof way to do a delay in one line. I could drop the randomize timer and make it square root 79 every cycle or something... but that'd be different on everyone's machine. No colour, couldn't fit it in.  :cry:

edit: notepad pulled a wierd line-wrap thing on me.

edit 2: I renumbered the lines just before I saved and it threw off the GOTO. (After twenty minutes of debugging, do I ever feel sheepish...)
 Logged

toonski84
__/--\__

Posts: 2567

 « Reply #24 on: January 31, 2003, 12:07:32 AM »

Code:
1 SCREEN 13
2 FOR x = 0 TO ATN(1) * 8 STEP ATN(1) / 2
3 LINE (160 + COS(a - x) * 70, 100 + SIN(a - x) * 70)-(160 + COS(ATN(1) * 2 + x) * 70, 100 + SIN(ATN(1) * 2 + x) * 70), c MOD 8
4 LINE (160 + COS(a - x) * 50, 100 + SIN(a - x) * 50)-(160 + COS(ATN(1) * 2 + x) * 50, 100 + SIN(ATN(1) * 2 + x) * 50), a MOD 8
5 c = (c + 1) MOD 16
6 a = a - ATN(1) / 90
7 PSET (COS(RND * ATN(1) * 8) * (RND * 30 + 70) + 160, SIN(RND * ATN(1) * 8) * (RND * 30 + 70) + 100), RND * 255
8 NEXT x
9 GOTO 2

seizure-vision.  at least on my xp1800.  lemme know how it flies on slower cpus.
 Logged

i]"I know what you're thinking. Did he fire six shots or only five? Well, to tell you the truth, in all this excitement, I've kinda lost track myself. But being as this is a .44 Magnum ... you've got to ask yourself one question: 'Do I feel lucky?' Well, do ya punk?"[/i] - Dirty Harry
Agamemnus
x/ \z

Posts: 3491

 « Reply #25 on: January 31, 2003, 12:35:28 AM »

 Logged

Peace cannot be obtained without war. Why? If there is already peace, it is unnecessary for war. If there is no peace, there is already war."

Visit www.neobasic.net to see rubbish in all its finest.
relsoft
*/-\*

Posts: 3927

 « Reply #26 on: January 31, 2003, 01:46:51 AM »

Okay Here's my translucen plasma....

Code:

'Here's my entry(translucent Plasma!!!)
'I could have made this a lil bit smaller.
'Relsoft
'Note: you may not notice a thing in about 20 secs as its setting
'up the palette.

1 SCREEN 13     ': FOR I = 0 TO 255: LINE (I, 0)-(I, 10), I: NEXT I'Unrem to see the Pal
2 J& = (J& + 1) AND &H7FFFFFFF
3 IF J& < 257 THEN PALETTE J& - 1, 65536 * INT(32 - 31 * SIN(J& * 3.14151693# / 128)) + 256 * INT(32 - 31 * SIN(J& * 3.14151693# / 64)) + INT(32 - 31 * SIN(J& * 3.14151693# / 32)) ELSE R% = 64
4    FOR y% = 0 TO 100
5    FOR x% = 0 TO 160
6            R% = -R%
7            IF J& > 256 THEN PSET (x% + 80, y% + 50), (SIN((x% + R%) / (28)) * 32) + (SIN((x% + R% + (J& MOD 284)) / (45)) * -128) + (SIN((y% + R%) / (32)) * 64)
8   NEXT x%, y%
9   IF INKEY\$ = "" THEN 2

Could have made this better but ran out of time....

;*)

PS. Antoni: Post as many as you want!!!!
 Logged

y smiley is 24 bit.

Genso's Junkyard:
http://rel.betterwebber.com/
Antoni Gual
Na_th_an

Posts: 1434

 « Reply #27 on: January 31, 2003, 12:52:22 PM »

Rel: Your saver is the winner! Wow!..

Here is another one. Sorry for the lack of color...

Code:

1 DEF SEG = &HB800
2 FOR i% = 0 TO 159 STEP 4
'  adjust this speed constant for optimal effect
'             |    0 no speed ;) .05 should be too fast even for a 386
'             |
3  IF RND < .0005 THEN j% = 3840 ELSE j% = -1
4  IF j% > 0 THEN POKE j% + i%, PEEK(j% - 160 + i%)
5  IF j% > 0 THEN j% = j% - 160
6  IF j% > 0 THEN GOTO 4
7  IF j% = 0 THEN IF RND > .3 THEN POKE i%, 96 * RND + 32 ELSE POKE i%, 32
8 NEXT
9 IF LEN(INKEY\$) = 0 THEN GOTO 2
 Logged

Antoni
BlueKeyboard
Wandering Guru

Posts: 337

 « Reply #28 on: January 31, 2003, 01:19:43 PM »

First screen 12 ASCII circle routine? :lol:.
Code:

SCREEN 12
FOR C% = 64 TO 76
FOR R% = 0 TO 14
FOR I% = 1 TO 360
COLOR R%: LOCATE 15 + INT(SIN(I% * 3.1415 / 180) * R%), 40 + INT(COS(I% * 3.1415 / 180) * R%): PRINT CHR\$(C% + R%)
NEXT
NEXT
WAIT &H3DA, 8
NEXT
 Logged

wizardlife
Na_th_an

Posts: 1456

 « Reply #29 on: January 31, 2003, 02:44:53 PM »

Quote from: "Agamemnus"
wizardlife, is your whole screensaver a box in the center?

Wasn't intended to be. Hang on.

edit: Hmm... it worked last night. Gimme another minute.

edit 2: done. Point the GOTO to line 4 instead of 3. I added the Randomize Timer at the last minute and it threw off the line numbers.
 Logged

 Pages: 1 [2] 3 4 ... 15