10 line programs

Post Reply
User avatar
mz-80a
Posts: 403
Joined: Thu Jan 25, 2018 10:46 am
Location: Devon, UK
Contact:

10 line programs

Post by mz-80a »

This looks pretty interesting :)

http://gkanold.wixsite.com/homeputerium ... 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).
MZ-80A Secrets
https://mz-80a.com/

Sharpworks (Sharp MZ homebrew)
https: //mz-sharpworks.co.uk/
sharpmz
Posts: 19
Joined: Wed Feb 07, 2018 4:41 pm

Re: 10 line programs

Post 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
60 PRINT PI
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:
https://sharpmz.org/computing_trigonome ... ctions.htm
Post Reply