Page 1 of 1

10 line programs

Posted: Fri Jan 26, 2018 9:28 am
by mz-80a
This looks pretty interesting :) ... iners-2018

Would be cool to have a bunch of MZ entries. I might do one (I know of someone else who may as well).

Re: 10 line programs

Posted: Tue Feb 20, 2018 6:43 pm
by sharpmz
Great idea. This is mine, which tries to compute PI (3.141592...) by using the "Monte Carlo simulation".
10 L=1:A=0
20 X=RND(1):Y=RND(1)
30 X=X*X:Y=Y*Y:D=X+Y
40 IF D<=1 THEN A=A+1
50 PI=4*A/L
70 L=L+1
80 GOTO 20
Something for users who like mathematics.

We could also write small BASIC programs that show how a programming language e. g. BASIC or a handheld calculator calculates functions like sin, cos, tan, exp, ln, log, n!, sqr and so on. I'd have to see if ten lines are enough.
See also my article: ... ctions.htm