This is the archived website of SI 413 from the Fall 2012 semester. Feel free to browse around; you may also find more recent offerings at my teaching page.
The BASIC programming language is one of the oldest available for this project (it was invented by Kemeny and Kurtz in 1964). It was originally designed to help beginners accomplish simple programming tasks on interactive computers. Due to its easy-to-learn design and wide availability (particularly on early Commodore and IBM computers), many computer scientists today learned BASIC as their first programming language.
But since it was designed primarily to be easy to use and interpret on
very low-resource computers, BASIC has its limitations. The
most famous one is the extensive use of
GOTO statements for
control flow. That's right - you won't be seeing any for loops, while loops,
or even functions in BASIC, just the good ol' GOTO.
The version of BASIC we will be using is specifically engineered to match the was early implementations of BASIC worked, with all their quirks and limitations. For example, variable names can be any length, but only the first two letters and the first number count to distinguish them. So be careful! And have fun! That's what BASIC is supposed to be for.
10 REM 99 Bottles of beer program 20 REM (c) 2012 Dan Roche 30 REM Runs on vintage BASIC 40 LET B = 99 50 GOSUB 2000 60 PRINT ","; 70 GOSUB 1000 80 PRINT "." 90 PRINT "Take one down, pass it around,"; 100 LET B = B - 1 110 GOSUB 2000 120 PRINT "." 130 IF B > 0 THEN 50 140 STOP 1000 REM Subroutine to print "X bottle[s] of beer" 1010 PRINT B; "bottle"; 1020 IF B <> 1 THEN PRINT "s"; 1030 PRINT " of beer"; 1040 RETURN 2000 REM Subroutine to print "X bottle[s] of beer on the wall" 2010 GOSUB 1000 2020 PRINT " on the wall"; 2030 RETURN
The programs you submit should be in a single file called
proj.bas. I will run your code on the CS Linux environment,
using the command
For this language, you need to implement modifications A, B, C, D, and G. See the Phase 1 page for details on what this means.
See the Phase 2 Page for the list of suggested
problems. Of the ones listed, I recommend the following as being most
well-suited for BASIC: