Map Generator Source
The map generator is written in
Python, an object-oriented, embeddable, scripting language. I've made
heavy use of Python's OO features; this code would be interesting
to convert to Java or C++ ... a Smalltalk conversion would probably be
easier.
- map.cgi
This is the CGI interface to the mapping classes. It works by
subclassing the CGI class from kw_cgi.py and then using a scenario
to create a new board.
- kw_cgi.py
This module has a couple of classes I wrote to make writing CGI programs
with Python even easier than usual.
- scenarios.py
This module contains classes that sub-class the Board class to
provide the data necessary to create a specific arrangement of land,
water, and port tiles, with the correct number placements.
- board.py
This module defines the Board class, an abstract class which is
responsible for generating a random board arrangement. It uses a
Layout instance to manage displaying the board.
- layout.py
This module defines the Layout class, an abstract class for
displaying a board without knowing the output medium.
- ascii.py
This module defines the ASCII class, which is a sub-class of the
Layout class. This class handles output to a fixed-pitch character
output device (and is also used for the web interface).
- pieces.py
This module defines helper classes for the Board and
Layout classes for the different types of board elements.
- evaluate.py
This module defines a class that evaluates a board for desirable
settlement locations. This is a very> rudimentary evaluation
that depends upon the expected scarcity of resources and the expected
probability of any given number being thrown.