BASIC
A BASIC langauge implementation of The Towers of Hanoi.
Following is the text of an alleged 1976 "open letter" from Bill Gates:
AN OPEN LETTER TO HOBBYISTS
By William Henry Gates III
February 3, 1976
An Open Letter to Hobbyists
To me, the most critical thing in the hobby market right now is the lack
of good software courses, books and software itself. Without good
software and an owner who understands programming, a hobby computer is
wasted. Will quality software be written for the hobby market?
Almost a year ago, Paul Allen and myself, expecting the hobby market to
expand, hired Monte Davidoff and developed Altair BASIC. Though the
initial work took only two months, the three of us have spent most of
the last year documenting, improving and adding features to BASIC. Now
we have 4K, 8K, EXTENDED, ROM and DISK BASIC. The value of the computer
time we have used exceeds $40,000.
The feedback we have gotten from the hundreds of people who say they are
using BASIC has all been positive. Two surprising things are apparent,
however, 1) Most of these "users" never bought BASIC (less than 10% of
all Altair owners have bought BASIC), and 2) The amount of royalties we
have received from sales to hobbyists makes the time spent on Altair
BASIC worth less than $2 an hour.
Why is this? As the majority of hobbyists must be aware, most of you
steal your software. Hardware must be paid for, but software is
something to share. Who cares if the people who worked on it get paid?
Is this fair? One thing you don't do by stealing software is get back at
MITS for some problem you may have had. MITS doesn't make money selling
software. The royalty paid to us, the manual, the tape and the overhead
make it a break-even operation. One thing you do do is prevent good
software from being written. Who can afford to do professional work for
nothing? What hobbyist can put 3-man years into programming, finding all
bugs, documenting his product and distribute for free? The fact is, no
one besides us has invested a lot of money in hobby software. We have
written 6800 BASIC, and are writing 8080 APL and 6800 APL, but there is
very little incentive to make this software available to hobbyists. Most
directly, the thing you do is theft.
What about the guys who re-sell Altair BASIC, aren't they making money
on hobby software? Yes, but those who have been reported to us may lose
in the end. They are the ones who give hobbyists a bad name, and should
be kicked out of any club meeting they show up at.
I would appreciate letters from any one who wants to pay up, or has a
suggestion or comment. Just write to me at 1180 Alvarado SE, #114,
Albuquerque, New Mexico, 87108. Nothing would please me more than being
able to hire ten programmers and deluge the hobby market with good
software.
Bill Gates
General Partner, Micro-Soft
1 REM * The Towers Of Hanoi
2 REM * BASIC
3 REM * Copyright (C) 1998 Amit Singh. All Rights Reserved.
4 REM * http://hanoi.kernelthread.com
5 REM * Tested under Chipmunk BASIC 1.0, Microsoft QBasic 1.1
6 REM --- S is the stack
10 DIM S(4096)
15 REM --- b is the stack pointer
20 b = 1
25 REM --- _sfTO
30 t = 2
35 REM --- _sfFR
40 f = 0
45 REM --- _sfUS
50 u = 1
55 REM --- _sfNU
60 n = 3
65 REM --- _sfEN
70 e = 0
75 REM --- remain
80 m = 0
85 REM --- the stack variable
90 INPUT "Number of disks (0 < disks < 10)"; v
91 IF v>0 AND v<10 THEN GOTO 100 ELSE GOTO 92
92 PRINT "Illegal number of disks"
93 GOTO 90
95 REM --- PUSH N (=v here)
100 GOSUB 2000
110 v = 1
120 GOSUB 2000
130 v = 3
140 GOSUB 2000
150 v = 0
160 GOSUB 2000
170 WHILE b > 1
180 GOSUB 3000
190 e = v
200 GOSUB 3000
210 t = v
220 GOSUB 3000
230 f = v
240 GOSUB 3000
250 n = v
260 m = 6 - f - t
270 IF e <> 0 THEN GOTO 280 ELSE GOTO 380
280 GOSUB 4000
290 v = n - 1
300 GOSUB 2000
310 v = m
320 GOSUB 2000
330 v = t
340 GOSUB 2000
350 v = 0
360 GOSUB 2000
370 GOTO 570
380 IF n <> 1 THEN GOTO 390 ELSE GOTO 560
390 v = n
400 GOSUB 2000
410 v = f
420 GOSUB 2000
430 v = t
440 GOSUB 2000
450 v = 1
460 GOSUB 2000
470 v = n - 1
480 GOSUB 2000
490 v = f
500 GOSUB 2000
510 v = m
520 GOSUB 2000
530 v = 0
540 GOSUB 2000
550 GOTO 570
560 GOSUB 4000
570 WEND
580 END
1999 REM --- procedure push(v)
2000 S(b) = v
2010 b = b + 1
2020 RETURN
2999 REM --- procedure pop()
3000 IF b = 0 THEN GOTO 3030 ELSE GOTO 3010
3010 b = b - 1
3020 v = S(b)
3030 RETURN
3999 REM --- procedure movedisk(from, to)
4000 PRINT USING "move # --> #"; f; t;
4010 PRINT ""
4020 RETURN