Qbasicnews.com

Full Version: PSET Circle!
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2 3 4 5 6 7
Okay, a simple game that shouldn't take but 5mins of your time.

Object: Make a circle using PSET
RULES:

1. Ten lines or under to be fair... (Can be done in six :wink: )
2. No use of colins " : " <- those
3. Any radius you want if its in the screen
4. Must be round if that makes since..
5. Only one PSET can be used..
6. QB or FB, just note on which, or use the matching Syntax tag.

Get all that? Now try it.. Big Grin .. Good luck!
Code:
CLS
SCREEN 13
rad = (3.14159265#) / 180
FOR i = 1 TO 361 STEP .5
oldx = x: oldy = y
x = INT(50 * (COS(rad * i))) + 160
y = INT(50 * (SIN(rad * i))) + 100
PSET (x, y), 15
NEXT
OK, why not? Tongue

Code:
Screen 18, 32
Do While InKey$=""
   Y=(Y+1)Mod 480
   For X = 0 to 639
     If ABS(SQR((320-X)^2 + (240-Y)^2))<= 255 then PSet(X,Y),RGB(0,0,255-ABS(SQR((320-X)^2 + (240-Y)^2)))
   Next
Loop
here's mine


Code:
screen 13
dim as integer x, y, xmov, ymov
dim as double angle
x = 25 : y = 25
do : angle = angle + .01
   xmov = x * sin(angle) + y * cos(angle)
   ymov = y * sin(angle) - y * cos(angle)
pset (xmov + 160,ymov + 100),4 : loop

yay, its a circle :bounce:

ah crap... no colons, well, i guess its back to the drawing board
and w/ a little more work (3 minits) i've came up w/ the answer

Code:
screen 13
dim as integer xmov,ymov,angle
do
   angle = angle + 1
   xmov = 25 * sin(angle) + 25 * cos(angle)
   ymov = 25 * sin(angle) - 25 * cos(angle)
   pset (xmov + 160,ymov + 100),4
loop

does that qualify.... i win! :bounce:
uh, make this official freebasic submission
ah, and here's my qbasic version

Code:
screen 13
for i = 1 to 360
xmov = 25 * sin(i) + 25 * cos(i)
ymov = 25 * sin(i) - 25 * cos(i)
pset (xmov + 160,ymov + 100),4
next

so, make it official, this is my qbasic submission
Code:
SCREEN 13
PSET STEP(0, 0), 15
Sure the pixel may be square, but it's the best approximation possible of a circle with radius 0.5 pixels. :bounce:
well, Sterling beat me :normal:
Quote:(Can be done in six :wink: )

Six? Six is for noobs Big Grin j/k

Code:
SCREEN 13
FOR i = 1 TO 360
  PSET (SIN(i * 3.14 / 180) * 30 + 160, COS(i * 3.14 / 180) * 30 + 100)
NEXT
3 lines:
[syntax="QBASIC"]FOR i! = -.5 TO 360 STEP .5
IF i! = -.5 THEN SCREEN 13 ELSE PSET (160 + COS(i! * 3.14 / 180) * 50, 100 + SIN(i! * 3.14 / 180) * 50), 15
NEXT i![/syntax]
Pages: 1 2 3 4 5 6 7