2013/02/09

Ramdomwalk

"Ramdomwalk" simulates the footsteps of a drunken man (^_^;).

There are rows which has line number or does not have.
This program also serves as a test of the "Delete line number".
All line number are automatically deleted by the X-BASIC for iOS.
10 /*
20 /* Random walk
30 /* Converted from http://d.hatena.ne.jp/x68000forever/
width(0)
int wx,wy
getWidth(wx,wy)
vpage(B_TPAGE or B_GPAGE0,YES)
width(32)
cls():wipe()
randomise(time())
50 int ix0,iy0,iscl
60 float d,ox,oy,xg,yg,x,y,t,r=0.05#
70 /*
80 ix0=wx/2
90 iy0=wy/2
100 iscl=wx/4
110 /*
120 x=0:xg=ix0
130 y=0:yg=iy0
140 /*
150 while xg>0 and xg<wx and yg>0 and yg<wy
160 /*
170 d=rnd()
    locate(0,0):print d;" ";
180 t=pi(d*2)
190 /*
200 x=x+r*cos(t)
210 y=y+r*sin(t)
220 /*
230 ox=xg:xg=ix0+iscl*x
240 oy=yg:yg=iy0+iscl*y
250 /*
gcolor(191*d*(256/32),(rand() mod (256-64))+64,(rand() mod (256-32))+32,220)
260 line(ox,oy,xg,yg)
270 /*
280 endwhile
290 end
//
1000 // 実は行番号有りテスト(行番号は全て削除される。ただし、先頭行に行番号がないとだめ)
2000 // line numbers test (line numbers remove all.)

Zip archive file : XBetc.zip

No comments:

Post a Comment