News:

Welcome to RetroCoders Community

Main Menu

myStar what ?

Started by aurel, Jun 03, 2024, 08:10 AM

Previous topic - Next topic

aurel

...some guy posted this on facebook
without code


__blackjack__

Retyped and made backwards compatible with QBasic:
DECLARE SUB star (x AS INTEGER, y AS INTEGER, n AS INTEGER, r AS INTEGER)
CONST PI = 3.141592653589793#
RANDOMIZE TIMER: SCREEN 12: star 200, 200, 18, 150: SLEEP

SUB star (x AS INTEGER, y AS INTEGER, n AS INTEGER, r AS INTEGER)
  DIM px(n) AS INTEGER, py(n) AS INTEGER, i AS INTEGER, j AS INTEGER
  DIM col AS INTEGER, ad AS DOUBLE, a AS DOUBLE
  ad = 2 * PI / n
  FOR i = 1 TO n
    a = (i - 1) * ad
    px(i) = x + INT(r * COS(a)): py(i) = y + INT(r * SIN(a))
  NEXT
  col = 1 + INT(15 * RND)
  FOR i = 1 TO n
    FOR j = i + 1 TO n
      LINE (px(i), py(i))-(px(j), py(j)), col
    NEXT
  NEXT
END SUB
,,Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it." —Brian W. Kernighan