pyvend (version 1.4, $Date: 2001/04/28 01:23:54 $)
index
pyvend.py

pyvend.py - simple vending machine simulation.
 
Based on a c++ program by Paul Maddox 1998.
Like the original, this can be hooked up to a port on a unix
system. The data file is not secure, nor is meant to be.
 
The data file format is:
 
top line       : bank total (float)
variable lines : item, cost, amount (string float int)
end marker     : #end
 
Put it somewhere, preferably where pyvend.py is, or be sure
to edit the path in datfile, and edit to your desire.
 
Copyright (C) Sean Dwyer 2001 under GPL.

 
Modules
            
string
sys

 
Functions
            
display(ilist)
takes a list of items, costs, and amounts and displays
useful information to users
driver()
main driver function for pyvend
interact(bank, ilist)
interacts with the user for a choice:
takes the current bank and items list.
be disgustingly cheerful, and return the changed
bank and item.
prog_display(ilist)
optional simpler display for use by other programs e.g. vmspd
rfile(name)
Reads the data file and returns the bank and list of items
wfile(bank, ilist, amount, item, name)
update the data file with new (if any) data

 
Data
             __author__ = 'Sean Dwyer <ewe2@can.org.au>'
__credits__ = 'Paul Maddox for vendor.c++,\012wherever he may be'
__date__ = '$Date: 2001/04/28 01:23:54 $'
__file__ = './pyvend.py'
__name__ = 'pyvend'
__version__ = '$Revision: 1.10 $'
datfile = 'pv.dat'
emarker = '#end'
spaces = ' '

 
Author
             Sean Dwyer <ewe2@can.org.au>

 
Credits
             Paul Maddox for vendor.c++,
wherever he may be