Qbasicnews.com
September 24, 2017, 08:06:55 PM *
Welcome, Guest. Please login or register.

Login with username, password and session length
News: Back to Qbasicnews.com | QB Online Help | FAQ | Chat | All Basic Code | QB Knowledge Base
 
   Home   Help Search Login Register  
Pages: 1 [2]
  Print  
Author Topic: raycaster in 6 lines  (Read 35202 times)
KiZ
__/--\__
*****
Posts: 2879


WWW
« Reply #15 on: May 29, 2004, 05:05:51 PM »

Well, they both are ASM geniuses, and how come we have never seen them in the same room together?

 :shifty:
Logged
relsoft
*/-\*
*****
Posts: 3927



WWW
« Reply #16 on: May 31, 2004, 05:16:21 AM »

Quote from: "Dr_Davenstein"
Well, that would realy suck. He would be the only smart  person in here... might as well call it  relsoftnews.com. :lol:


Errr.

Plasma = USA ( Coolest salaries abound there)

Rel = Philippines (Hell on Earth)

* Beam me up Jon. :*) j/k
Logged

y smiley is 24 bit.


Genso's Junkyard:
http://rel.betterwebber.com/
wallace
Wandering Guru
***
Posts: 368



WWW
« Reply #17 on: October 11, 2004, 05:54:15 PM »

raycast$ = 'machine code for raycaster
CALL Absolute(raycast,...)


2 lines :-)

Cheap isn't it?
Logged

f you play a Microsoft CD backwards you can hear demonic voices.  The scary part is that if you play it forwards it installs Windows.
whitetiger0990
__/--\__
*****
Posts: 2964



WWW
« Reply #18 on: October 11, 2004, 10:05:06 PM »

Will be if you actually do it =P
Logged


[size=10]Back by popular demand!
I will byte and nibble you bit by bit until nothing remains but crumbs.[/size]
Z!re
*/-\*
*****
Posts: 4599


« Reply #19 on: October 12, 2004, 07:27:57 AM »

Not that hard, just make a raycaster, and compile it to a com file (that is, no exe header)

And then just load that up into your program.



Wonder if it could be done in one line, with the data directly on the call abs statement, instead of a variable.. as long as it doesent return anything, it should be fine... hmm...
Logged
VonGodric
Ancient Guru
****
Posts: 674



WWW
« Reply #20 on: October 12, 2004, 08:12:24 AM »

Really cool, never done anything of that kind though :oops: So just for better understandability(for myself) I rewrote it to n+1 lines, but gives a better overview.

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 13

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, 99 - H)-(s + 169, 99 - H), 4 'this line is also my creation
      LINE (s + 160, 101 + H)-(s + 169, 320), 0, BF
      LINE (s + 160, 101 + H)-(s + 169, 101 + H), 2 'and added this line
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)
   ELSEIF a$ = CHR$(27) THEN END
   END IF
6  GOTO 2

DATA 1, 1, 1, 1, 1, 1, 1 ,1
DATA 1, 0, 0, 1, 0, 0, 0, 1
DATA 1, 1, 0, 1, 0, 1, 0, 1
DATA 1, 0, 0, 0, 0, 1, 0, 1
DATA 0, 1, 1, 1, 0, 1, 0, 1
DATA 1, 0, 1, 1, 0, 1, 1, 1
DATA 1, 0, 0, 0, 0, 0, 0, 1
DATA 1, 1, 1, 1, 1, 1, 1, 1
Logged

url]http://fbide.sourceforge.net/[/url]
Neo
Na_th_an
*****
Posts: 2150



« Reply #21 on: October 29, 2004, 09:48:10 AM »

Sorry for reviving this topic, but I really have to say something Tongue

Quote from: "Zack"
Waitasec...Relsoft, YOU'RE Jelly?

HA! I already suspected that! Wink That's why you won 1st prize on the 9-line gfx demo contest, and I got 2nd prize! Cheesy (Btw, I also had a translucent plasma entry Wink)

Quote from: "relsoft"
Yeah, I wouldn't have used "Zebra" or "Xylophone" though. :*)

Jelly is cool Wink lol

Quote from: "Radical Raccoon"
Hey! Jelly is like, plasma! So you are Plasma too?

Yeah right... then everyone is everyone. So I'm oracle because Neo has something to do with The Oracle in the Matrix... Wink

Quote from: "Dr_D"
Well, that would realy suck. He would be the only smart person in here... might as well call it relsoftnews.com.

Because he is everyone here? Or is it just because because we aren't smart? Wink

Quote from: "dark"
Well, they both are ASM geniuses, and how come we have never seen them in the same room together?

Hmn, good question Wink. #1: Plasma is always busy. #2: Relsoft probably can't go to America for no reason Wink

Quote from: "Rel"
Hell on Earth

Since when are the Phillipines hell on earth? And since when is the USA the country with the coolest salaries? Wink

Quote from: "wallace"
raycast$ = 'machine code for raycaster
CALL Absolute(raycast,...)

You are allowed to do this, unless you have to make it in QB. That code technically isn't QB Wink
Logged
relsoft
*/-\*
*****
Posts: 3927



WWW
« Reply #22 on: October 30, 2004, 12:46:59 AM »

Neo: The place itself is pretty good. But bad governance is ruining everything. Err... A guy who operates a xerox copy machine in the sates for 6 hours makes a lot more than a surgeon here. :*)

Sigh, this "relsoft is smart thingy" is so lame.  Heh, I could never make a half decent gui even if I try to.

;*)
Logged

y smiley is 24 bit.


Genso's Junkyard:
http://rel.betterwebber.com/
TheBigBasicQ
*/-\*
*****
Posts: 4549



WWW
« Reply #23 on: October 30, 2004, 10:54:35 AM »

Rel, stop comparing Phillipines to US. The cost of living is proportional to their salaries Wink. The government eats away ~40-50% of their salaries but they get facilities in return. But that really leaves you only half of you're salary to spend =P. Also, converting USD to Pesos(did u know the acronym for pesos is PHP =P?) isnt very wise either. The conversion rate is very high Wink.
Logged
adosorken
*/-\*
*****
Posts: 3655



WWW
« Reply #24 on: October 30, 2004, 10:58:50 AM »

Quote from: "Neo"
Because he is everyone here? Or is it just because because we aren't smart? Wink

Nah, everyone (with a few exceptions) here is smart in their own little ways. You gotta be a cut above the rest of humanity to be able to withstand the suffrage and outright masochistic lifestyle of a computer programmer. Cheesy
Logged

I'd knock on wood, but my desk is particle board.
Z!re
*/-\*
*****
Posts: 4599


« Reply #25 on: October 30, 2004, 02:25:48 PM »

:lol:  Hear hear...
Logged
kinem
New Member

Posts: 2


« Reply #26 on: April 14, 2010, 02:19:39 AM »

Hi. Sorry to revive this years-dead thread, but I thought it was a fun challenge to make the shortest 1-line RC!  You can make it into 1 line in QB with a bit of editing.  All fixed up, note the changes Smiley  Press , . to turn, space forward, esc.

Code:
FOR X = 0 TO 63:
L(X AND 7, X\8)=VAL(MID$("1111111110010001100409011000010120110701101101011000000112345671",X+1,1)):
NEXT: X = 1.5:Y = X: F = ATN(1): u = F / 9: SCREEN 7: DO: FOR S = -160 TO 159: t = ATN(S / 304): R = F + t:
I = COS(R) / 80:J = SIN(R) / 80: o = X: p = Y: n = 0: DO: o = o + I: p = p + J: n = n + 1: c = L(o, p): LOOP UNTIL c:
H = 9000 / n / COS(t): v = S + 160: LINE (v, 0)-(v, 99 - H), 0: LINE -(v, 99 + H), c: LINE -(v, 319), 8: NEXT:
a = INP(96): I = COS(F) / 9: J  = SIN(F) / 9: m = a = 57 AND L(X + I, Y + J) = 0: X = X - I * m: Y = Y - J * m:
F = F + u * ((a = 51) - (a = 52)): LOOP UNTIL a = 1
Logged
ravenxau
New Member

Posts: 9


« Reply #27 on: September 25, 2016, 07:24:23 AM »

Thought I'd bump this thread, as I did start it 12 years ago....I have just started programming in qbasic again...using version 1.1 under dosbox....will be interesting to revisit some of my old stuff and see if it goes anywhere new........
Logged
Dav
Administrator
Ancient Guru
*****
Posts: 709



WWW
« Reply #28 on: October 01, 2016, 02:05:18 PM »

Hi ravenau.  I keep coming back to QB programming too.  Have you tried QB64?  These raycaster codes will run in that too, compile to EXE and doesn't need DosBox. 

Anyway, glad to see you (and anyone!) around here. Cheesy

- Dav
Logged

Dr_Davenstein
Na_th_an
*****
Posts: 2052


« Reply #29 on: October 01, 2016, 08:43:26 PM »

Yes sir. Studying stuff like this is what made me who I am today... As far as programming goes. Smiley
Logged
Pages: 1 [2]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.21 | SMF © 2015, Simple Machines Valid XHTML 1.0! Valid CSS!