raycaster in 6 lines  ravenxau  03312004
here is a raycaster i knocked up in 6lines. anybody else want to share their take on the subject? (btw  this code is gwbasic compatible too!)
Matt
Code: 1 DIM L(7, 7): FOR Y = 0 TO 7: FOR X = 0 TO 7: READ L(X, Y): NEXT X: NEXT Y: X = 24: Y = 24: F = 45: SCREEN 1
2 FOR S = 160 TO 149 STEP 10: R = F + (S * .1875): R = R + 360 * ((R > 360)  (R < 0)): XI = COS(R / 57): YI = SIN(R / 57): X1 = X: Y1 = Y
3 X1 = X1 + XI: Y1 = Y1 + YI: IF L(X1 / 16, Y1 / 16) = 0 THEN GOTO 3
4 D = ABS((X  X1) / COS(R / 57)): H = (1816 / D): LINE (S + 160, 100  H)(S + 169, 100 + H), 1, BF: LINE (S + 160, 0)(S + 169, 99  H), 0, BF: LINE (S + 160, 101 + H)(S + 169, 320), 0, BF
5 NEXT S: A$ = INKEY$: F = F + 5 * (A$ = ",")  5 * (A$ = "."): F = F  355 * (F = 5) + 360 * (F = 365): IF A$ = " " AND (L((X + COS(F / 57)) / 16, (Y + SIN(F / 57)) / 16) = 0) THEN X = X + COS(F / 57): Y = Y + SIN(F / 57)
6 GOTO 2: DATA 1,1,1,1,1,1,1,1,1,0,0,1,0,0,0,1,1,1,0,1,0,1,0,1,1,0,0,0,0,1,0,1,1,0,1,1,0,1,0,1,1,0,1,1,0,1,1,1,1,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1
raycaster in 6 lines  na_th_an  03312004
Really cool, and impressive.
But not 6 lines: you cheated using ":" . Anyways, impressive
raycaster in 6 lines  relsoft  04012004
Hah! With colon joined lines, I could make a raycaster in 1 line!!! LOL
Nice job though. :*)
raycaster in 6 lines  ravenxau  05052004
it is 6 lines of code. i forgot to specify it is 6 lines of GWBASIC compatible code. sorry for the misdirection.
raycaster in 6 lines  relsoft  05052004
Actually I was with the assumption that each line should not have colons for joining.
Like this:
Code: 'Felix the Helix
'By Jelly
1 IF I% = 0 THEN SCREEN 7, , 0, 1 ELSE PCOPY 0, 1
2 A! = (A! + .03) * (A! < 6.283186)
3 FOR I% = 0 TO 200
4 x! = ((50 * COS(4 * 3.141593 / 200 * I%)) * (COS(A!) * COS(A!)) + (50 * SIN(8 * 3.141593 / 200 * I%)) * (SIN(A!) * SIN(A!) * COS(A!)  COS(A!) * SIN(A!)) + (I%  (200 / 2)) * (COS(A!) * SIN(A!) * COS(A!) + SIN(A!) * SIN(A!)))
5 y! = ((50 * COS(8 * 3.141593 / 200 * I%)) * (COS(A!) * SIN(A!)) + (50 * SIN(8 * 3.141593 / 200 * I%)) * (COS(A!) * COS(A!) + SIN(A!) * SIN(A!) * SIN(A!)) + (I%  (200 / 2)) * (SIN(A!) * COS(A!) + COS(A!) * SIN(A!) * SIN(A!)))
6 z! = ((50 * COS(8 * 3.141593 / 200 * I%)) * (SIN(A!)) + (50 * SIN(8 * 3.141593 / 200 * I%)) * (SIN(A!) * COS(A!)) + (I%  (200 / 2)) * COS(A!) * COS(A!))
7 IF I% > 1 THEN CIRCLE ((160 + (256 * x! \ (256  z!))), (100  (256 * y! \ (256  z!)))), 512 \ (256  z!), (A! * 57.29577 + I%) AND 15 ELSE LINE (0, 0)(319, 199), 0, BF
8 NEXT I%
9 IF INKEY$ = "" THEN 1
Code: 'Translucency is me! Redux...
'by Jelly
1 IF i& = 0 THEN SCREEN 13 ELSE IF i& <= 256 THEN PALETTE i&  1, 65536 * INT(32  31 * SIN(i& * 3.14151693# / 128)) + 256 * INT(32  31 * SIN(i& * 3.14151693# / 64)) + INT(32  31 * SIN(i& * 3.14151693# / 32)) ELSE z% = 64 * (((i& AND 1) = 1) OR 1)
2 IF xa% = 0 THEN DIM Lsin%(1024) ELSE i& = (i& + 1) AND &H7FFFFFFF
3 FOR ya% = 0 TO 127
4 IF i& < 385 THEN Lsin%(i&) = SIN((i&) / 25) * 64 ELSE xsin% = SIN((ya% + i&) / 20) * 32
5 FOR xa% = 0 TO 254
6 z% = z%
7 IF i& > 384 THEN PSET (32 + xa%, 36 + ya%), (xa% + xsin%) + Lsin%(ya% + 64 + z%) + Lsin%(xa% + ya%)
8 NEXT xa%, ya%
9 IF INKEY$ = "" THEN 1
Code: 'Lovelier, Wobblier and Bigger!!!!
'by Jelly
1 IF i& = 0 THEN SCREEN 13 ELSE IF i& <= 256 THEN PALETTE i&  1, 65536 * INT(32  31 * SIN(i& * 3.14151693# / 128)) + 256 * INT(32  31 * SIN(i& * 3.14151693# / 64)) + INT(32  31 * SIN(i& * 3.14151693# / 32))
2 IF xa% = 0 THEN DIM Lsin%(256, 3) ELSE i& = (i& + 1) AND &H7FFFFFFF
3 FOR ya% = 0 TO 127
4 IF i& < 257 THEN Lsin%(i&, 0) = SIN((i&) / 30) * 60 ELSE xsin% = SIN((ya% + i&) / 20) * 50
5 FOR xa% = 0 TO 255
6 PSET (32 + xa%, 36 + ya%), (xa% + xsin%) XOR (ya% + (Lsin%((xa%), 0)))
7 NEXT xa%, ya%
8 IF INKEY$ = "" THEN 1
Note that I had to strain my brain just to get it to work fast enough and there is no colon joined line. ;*)
raycaster in 6 lines  Zack  05052004
Waitasec...Relsoft, YOU'RE Jelly?
raycaster in 6 lines  wildcard  05052004
Great work.
Using the colon has it limitis, e.g. you can't do that much in terms of if statements/etc. Remeber pasco's climber that was using colons
raycaster in 6 lines  relsoft  05072004
Quote:Waitasec...Relsoft, YOU'RE Jelly?
:oops: :oops:
raycaster in 6 lines  oracle  05082004
Eh????
I suspected you two were "related" after the 9line compo at QBNZ, but you're actually the same person??
What, did you forget your password or something?
raycaster in 6 lines  relsoft  05082004
LOL. Nahh. I was making my first entry, the "circle interference" while teaching my daughter how to read the ABC's. And my daughter kept on going back to "J" 'cause she likes the picture. Guess what? The pic on the letter J is Jelly. :*)
So I guess it stuck. :*)
