Author Topic: 256b StarFeild  (Read 2514 times)

0 Members and 1 Guest are viewing this topic.

Offline rain_storm

  • Here comes the Rain
  • DBF Aficionado
  • ******
  • Posts: 3088
  • Karma: 182
  • Rain never hurt nobody
    • View Profile
    • org_100h
256b StarFeild
« on: July 23, 2008 »
Hasnt been much activity on this board in awhile so I thought it was time to do something about that. This is a play on the minimum lines of source code theme that has been done before. This time the aim was to get a demo effect happening in no more than 256 bytes of source code. To start with I only did a simple paralax starfeild. The stars are coloured based on their distance. Tricks that have been used include -
  • using a colon ':' instead of a newline
  • using line numbers instead of labels
  • using single charictors instead of proper array / variable names
  • assigning a multi digit value to a variable (s=511) saves bytes if value is used often
tricks that couldnt be used this time -
  • not creating a newline for each label (works on the ps2 but breaks in the emulator)
  • using a data statement with a read statement can save bytes when many variables need to be declared
  • removing all comments (I have 6 bytes left over I used them for my signature)
  • removing clear screen and double buffering

well here is the source code unrolled for readability the attached file is crammed onto fewer lines to fit into the 256 byte limit
Code: [Select]
#R_S
Open Window 1,1:
s=511:
Dim x(s),y(s),z(s):
For a=0 To s:
x(a)=Ran(s):
y(a)=Ran(s):
z(a)=Ran(3)+1:
Next
0 setdispbuf d:
d=1-d:
setDrawBuf d:
Clear Window:
For a=0 To s:
x(a)=And(x(a)+z(a),s):
c=64*z(a):
SetRGB 1,c,c,c:
Fill Circle x(a)*1.3,y(a),z(a):
Next:
Goto 0
« Last Edit: September 10, 2009 by rain_storm »

Challenge Trophies Won: