Airline Manager - Part 3
Right, so where are we? Well, over the past few days I've had a chance to spend
a bit of time on my Basic program 'Airline Manager'. As I mentioned before the
original version would never have worked due to missing functionality. I managed
to get X11 Basic
[1
] to compile on the Sun Ultra 5 running Solaris 9 only with a
few modifications to both the build scripts and source code. This is not unusual
for software that hasn't been built for a platform in a while. I've contacted
the author and he's keen to get fixes patched in to the source so I'll be
helping out where I can. He was a fan of DEC Alphas (as can be seen from a
comment in the makefile!) so I will endevour to port to Digital Unix as well
when I get a chance.
I used a utility supplied with X11basic to convert my program into a more
X11basic friendly dialect. It worked pretty well.
After that it was a case of:
1. Structuring the program using PROCEDURE and FUNCTION - the high-level
structural elements of X11 basic.
2. Reduce code by replacing menu text and options using simple PRINT
statements with parameterized procedure calls.
3. Patch up problems with the existing functionality and enhance.
4. I eventually relented and replaced the one-character variable names
with more meaningful ones.
Probably the most productive change was introducing multi-character variable
names. To a certain extent that felt like cheating, but I remember
back-in-the-day that any program over a certain level of complexity (probably
one with more than seven global variables) would result in a sharp dip in
productivity.
The enhancements have centred around providing the actual mechanics of the
simulation. Turns are now processed and profit and loss calculated. The original
starting variables will clearly need tweaking - the cost of fuel means making a
profit is almost impossible.
I'm in enough of a position to provide a general description of the program
which might provide some context:
Airman is an airline management simulation. It was originally written
by me around 1985 in BBC Basic as an unfinished Computer Science 'O'
level course assignment. It only came to light in 2013 when my friend
(then and now) Retrocosm
[2
] unearthed it on a 5.25" floppy disc.
The purpose of the simulation was not specified in the original code
but almost undoubtedly it was to make money.
The manager starts with an initial balance in the company current and
deposit accounts together with some fuel and stocks. The company must
bid to obtain orders from other airports. Three types of stock can be
delivered: FOODSTUFFS, MEDICINE and MACHINERY. Before starting a
property (hanger) and aircraft must
be purchased.
The simulation is turn based allowing stocks to be traded, fuel
bought/sold, money shuffled between accounts and property/aircraft
traded before a turn takes place. Taking a turn involves either
bidding for an order or declining all offered orders.
At the end of each turn a summary of the profit and loss for that
turn is displayed. Profit is made from selling stocks delivered
successfully and interest made on money contained in the deposit
account. Losses are made due to the use of fuel, original cost of
stock and damage to the aircraft.
I'll release the source code to the community as soon as I've played it enough
to be sure most bugs have been fixed and also tweaked the game parameters to
ensure it's not impossible to play. Currently not enough information is
presented about the parameters of an order for a good decision to be made
(airport distance etc). There should also be more information presented
about the capabilities of aircraft (currently only the price and cargo capacity
is shown).
Final enhancements on the cards are a Load and Save facility (there was a menu
option in the original code but it was unimplemented) and to provide some kind
of end goal or at least some kind of scoring system.
Given that X11 Basic will run on a variety of Unix, Linux and Windows systems I
would hope that a few @retrochallenge members will take up the gauntlet and see
how far they can get (before the menu system becomes painful!)
The main trading page:
OPTIONS
=======
Turn: 1
1. Accounts
2. Stock Exchange
3. Property Market
4. Fuel Market
5. Plane Market
6. Continue to Work Schedule
7. Back to Main Menu
SELECT CHOICE NOW
?
Buying a plane:
BUY PLANE
=========
1. Cessna Caravan Cost: $10000, Space Required: 1
2. Twin Prop Cost: $30000, Space Required: 2
3. Single Jet Cost: $60000, Space Required: 4
4. Boeing 737 Cost: $100000, Space Required: 5
5. Jumbo Cost: $200000, Space Required: 8
6. Back
SELECT CHOICE NOW
?
Oh... and I wrote this blog post on the Sun Ultra 5 using WordPerfect 6, then
printed to an ASCII file, ftp'd that to the Alpha, imported it into ALLIN1,
printed it to a VT terminal printer, ran a script to convert that to HTML then
ftp'd that HTML to the server. It doesn't look quite right, but there can't be
much surprise there!!!
Update: I relented and reformatted the document in ALLIN1!
ENDNOTES
1.
X11 Basic
2.
Retrocosm's Blog