Qbasicnews.com
Challenge.... - Printable Version

+- Qbasicnews.com (http://qbasicnews.com/newforum)
+-- Forum: QbasicNews.Com (http://qbasicnews.com/newforum/forum-3.html)
+--- Forum: Challenges (http://qbasicnews.com/newforum/forum-10.html)
+--- Thread: Challenge.... (/thread-93.html)

Pages: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22


3d rotating cube, in 8 lines, suck this =) - Nexinarus - 02-03-2003

My 3d rotating cube (with bs's help)

NOTE: Please copy into notepad and save as a bas file, then load into qb (1.1, 4.5, 7.1, it shouldnt matter).

edit: this is the improved version by BinarySHOCK who made it not flicker heh.
Code:
1 SCREEN 7, 0, 1, 0
2 FOR a = 0 TO 3
3 LINE ((SIN(((TIMER * 20 + a * 90) MOD 360) * 3.1415 / 180) * 150) / (COS(((TIMER * 20 + a * 90) MOD 360) * 3.1415 / 180) * 40 + 150) * 64 + 160, 50 / (COS(((TIMER * 20 + a * 90) MOD 360) * 3.1415 / 180) * 40 + 150) * 64 + 150)-((SIN(((TIMER * 20 + _
a * 90 + 90) MOD 360) * 3.1415 / 180) * 150) / (COS(((TIMER * 20 + a * 90 + 90) MOD 360) * 3.1415 / 180) * 40 + 150) * 64 + 160, 50 / (COS(((TIMER * 20 + a * 90 + 90) MOD 360) * 3.1415 / 180) * 40 + 150) * 64 + 150)
4 LINE ((SIN(((TIMER * 20 + a * 90) MOD 360) * 3.1415 / 180) * 150) / (COS(((TIMER * 20 + a * 90) MOD 360) * 3.1415 / 180) * 40 + 150) * 64 + 160, -100 / (COS(((TIMER * 20 + a * 90) MOD 360) * 3.1415 / 180) * 40 + 150) * 64 + 150)-((SIN(((TIMER * 20 _
+ a * 90 + 90) MOD 360) * 3.1415 / 180) * 150) / (COS(((TIMER * 20 + a * 90 + 90) MOD 360) * 3.1415 / 180) * 40 + 150) * 64 + 160, -100 / (COS(((TIMER * 20 + a * 90 + 90) MOD 360) * 3.1415 / 180) * 40 + 150) * 64 + 150)
5 LINE ((SIN(((TIMER * 20 + a * 90) MOD 360) * 3.1415 / 180) * 150) / (COS(((TIMER * 20 + a * 90) MOD 360) * 3.1415 / 180) * 40 + 150) * 64 + 160, 50 / (COS(((TIMER * 20 + a * 90) MOD 360) * 3.1415 / 180) * 40 + 150) * 64 + 150)-((SIN(((TIMER * 20 + _
a * 90) MOD 360) * 3.1415 / 180) * 150) / (COS(((TIMER * 20 + a * 90) MOD 360) * 3.1415 / 180) * 40 + 150) * 64 + 160, -100 / (COS(((TIMER * 20 + a * 90) MOD 360) * 3.1415 / 180) * 40 + 150) * 64 + 150)
6 NEXT
7 PCOPY 1, 0
8 CLS
9 IF INKEY$ = "" THEN GOTO 2

this is the version with no pcopy and is VERY flickery, but 1 line smaller =).
Code:
1 SCREEN 13
2 FOR a = 0 TO 3
3 LINE ((SIN(((TIMER * 20 + a * 90) MOD 360) * 3.1415 / 180) * 150) / (COS(((TIMER * 20 + a * 90) MOD 360) * 3.1415 / 180) * 40 + 150) * 64 + 160, 50 / (COS(((TIMER * 20 + a * 90) MOD 360) * 3.1415 / 180) * 40 + 150) * 64 + 150)-((SIN(((TIMER * 20 + _
a * 90 + 90) MOD 360) * 3.1415 / 180) * 150) / (COS(((TIMER * 20 + a * 90 + 90) MOD 360) * 3.1415 / 180) * 40 + 150) * 64 + 160, 50 / (COS(((TIMER * 20 + a * 90 + 90) MOD 360) * 3.1415 / 180) * 40 + 150) * 64 + 150)
4 LINE ((SIN(((TIMER * 20 + a * 90) MOD 360) * 3.1415 / 180) * 150) / (COS(((TIMER * 20 + a * 90) MOD 360) * 3.1415 / 180) * 40 + 150) * 64 + 160, -100 / (COS(((TIMER * 20 + a * 90) MOD 360) * 3.1415 / 180) * 40 + 150) * 64 + 150)-((SIN(((TIMER * 20 _
+ a * 90 + 90) MOD 360) * 3.1415 / 180) * 150) / (COS(((TIMER * 20 + a * 90 + 90) MOD 360) * 3.1415 / 180) * 40 + 150) * 64 + 160, -100 / (COS(((TIMER * 20 + a * 90 + 90) MOD 360) * 3.1415 / 180) * 40 + 150) * 64 + 150)
5 LINE ((SIN(((TIMER * 20 + a * 90) MOD 360) * 3.1415 / 180) * 150) / (COS(((TIMER * 20 + a * 90) MOD 360) * 3.1415 / 180) * 40 + 150) * 64 + 160, 50 / (COS(((TIMER * 20 + a * 90) MOD 360) * 3.1415 / 180) * 40 + 150) * 64 + 150)-((SIN(((TIMER * 20 + _
a * 90) MOD 360) * 3.1415 / 180) * 150) / (COS(((TIMER * 20 + a * 90) MOD 360) * 3.1415 / 180) * 40 + 150) * 64 + 160, -100 / (COS(((TIMER * 20 + a * 90) MOD 360) * 3.1415 / 180) * 40 + 150) * 64 + 150)
6 NEXT
7 CLS
8 IF INKEY$ = "" THEN GOTO 2



Pixel Scrolling Pattern - BinarySHOCK - 02-03-2003

umm ya just like it sayz... not very good but i'm bored so ya...

1 SCREEN 13
2 DEFINT A-Z
3 FOR Ix = 0 TO 319
4 FOR Iy = 0 TO 199
5 PSET (Ix, Iy), ((Ix - L) XOR (Iy + L)) * 2
6 NEXT Iy, Ix
7 L = (L + 1) AND 255
8 PALETTE L, (255 - L) \ 4
9 IF INKEY$ = "" THEN 3


Another 1 - BinarySHOCK - 02-03-2003

This 1 looks really stupid for a few seconds until the palette gets fully changed Tongue so please wait for that..


1 SCREEN 13
2 DEFINT A-Z
3 FOR Ix = 0 TO 319
4      FOR Iy = 0 TO 199
5           PSET (Ix, Iy), ((Ix - L) XOR (Iy + L)) Xor ((Ix + L) XOR (Iy - L))
6      NEXT Iy, Ix
7      L = (L + 1) AND 255
8      PALETTE L, (255 - L) \ 4
9 IF INKEY$ = "" THEN 3


Challenge.... - toonski84 - 02-03-2003

on the contrary, the palette transformation looks pretty cool Big Grin


Challenge.... - Agamemnus - 02-03-2003

Nexinarius, it doesn't paste that because it's above the 256 line limit. :???: Manual copy?

(edit) Can you make the sphere bounce around, Rel? You can save 1 line by using a string instead of a variable...

You can also save a line by converting the FORs to string addition.. MAYBE.

I like dat first one a lot BinaryShock. Smile

For the second one the palette transformation is a bit too.. dramatic. I changed it a little, but it's 11 lines. Sad

[code]
1 SCREEN 13
2 DEFINT A-Z
3 L = (L + 1) AND 255
4 PALETTE L, (255 - L) \ 4
5 IF L = 0 THEN GOTO 6 ELSE GOTO 3
6 FOR ix = 1 TO 399
7 FOR iy = 1 TO 199
8 PSET (ix, iy), ((ix - L) XOR (iy + L)) XOR ((ix + L) XOR (iy - L))
9 NEXT iy, ix
10 L = (L + 1) AND 255
11 IF INKEY$ <> "" THEN SCREEN 0 ELSE GOTO 6
[code]


Fire, 8 lines - BinarySHOCK - 02-03-2003

1 SCREEN 13
2 FOR Iy% = 199 TO 170 STEP -1
3 IF (POINT(Ix%, Iy%) + POINT(Ix% - 1, Iy%) + POINT(Ix% + 1, Iy%) + POINT(Ix%, Iy% - 1) + POINT(Ix%, Iy% + 1)) > 10 THEN PSET (Ix%, Iy% - 1), (POINT(Ix%, Iy%) + POINT(Ix% - 1, Iy%) + POINT(Ix% + 1, Iy%) + POINT(Ix%, Iy% - 1) + POINT(Ix%, Iy% + 1 _
)) \ 5 - 2
4 NEXT
5 IF INT(RND * 2) = 1 THEN PSET (Ix%, 199), 255 ELSE PSET (Ix%, 199), 0
6 Ix% = (Ix% + 1) MOD 320
7 PALETTE Ix% AND 255, (Ix% AND 255) \ 4
8 IF LEN(INKEY$) = 0 THEN 2

heh incase you didn't kno, all that point stuff needs to be on 1 line Tongue if you remove the PALETTE it would be in 7, but then it looks kinda umm ya not like fire.

thank you, agamenus.


Challenge.... - Dav - 02-03-2003

Had some more time to waste and make something.

I'm not sure where I got the idea for this one. It's nothing special -- but I did try to avoid the so called cheap hacks for once. Makes it more challenging(sic?) to come up with something decent.

A rainbow-paint-spray-runner-type of thing...

Code:
1 SCREEN 13
2 x% = RND * 320
3 y% = RND * 200
4 w% = INT(RND * 2) + 1
5 c% = INT(RND * 2) - 1
6 IF c% = 0 THEN c% = 1
7 IF w% = 1 THEN x% = x% + c% ELSE y% = y% + c%
8 IF INKEY$ = "" THEN PSET (x%, y%), 15 + y% + INT(RND * 6) ELSE END
9 IF x% < 1 OR y% < 1 OR x% > 320 OR y% > 200 THEN GOTO 2 ELSE GOTO 4



Challenge.... - Nexinarus - 02-03-2003

Ok, Agamemnus, try:
-copying the text to windows clipboard
-paste it into notepad and save as a bas file
-now it should run fine, i just tested it on qb4.5 and it worked. (yea the lines are massive lol, its the only way i could think of :p


Challenge.... - Antoni Gual - 02-04-2003

Binary Shock: Fine XOR effects! The second one is just incredible!

Rel: Incedible sphere! Do you really have a raycaster in 13 lines? Post it please......

Dav: I like these "handcrafted" textures. A very fine effect

Generic: Excuse me, i could not resist the temptation Smile

Code:
' OPTIMIZED  :) rotozoomer in 9 lines by Antoni Gual
1 SCREEN 13
2 ANG = ANG + .08
3 CS% = COS(ANG) * ABS(SIN(ANG)) * 128
4 ss% = SIN(ANG) * ABS(SIN(ANG)) * 128
5 FOR Y% = -100 TO 99
6 FOR X% = -160 TO 159
7 PSET (X% + 160, Y% + 100), (((X% * CS% - Y% * ss%) AND (Y% * CS% + X% * ss%)) \ 128)
8 NEXT X%, Y%
9 IF LEN(INKEY$) = 0 THEN 2
:bounce:


Am I becoming blind? - Antoni Gual - 02-04-2003

Is Rel's sphere program is hiding points in the back face?...:o

Ok, I think we should all give up...Cry You are the winner, Rel!

But I will continue sending progs just for fun! :bounce: