old_contents: ﻿#!/usr/bin/env python
  
  """ Map Creation Tool
  
  This tool is designed with an initial focus on Bard's Tale-style maps.
  
  Maps are built on a cartesian grid.  Each cell in the grid defines its
  own contents as well as the contents of the four bounding walls.
  """
  
  # Yes, I am aware of https://www.python.org/dev/peps/pep-0008/.
  # I *hate* lower_case_with_underscores and *love* mixedCase, which I am
  # using in spite of the PEP 0008 recommendations.  That said, I am
  # gradually (and grudgingly) switching over.
  
  # A lot of base code copied from my earlier SoC project.
  
  # ??? is a searchable string for later lookup for things I know are
  # needed but whose exact use is unclear.
  
  # "coord" and "coordinates" refer to the MapCell coordinates, while
  # "top" and "left" and "width" etc. refer to pixel coordinates.
  
  try:
      import os
      import sys
  
      import pygame as pg
  
      import prepare
      import map_tools
      import options
      from options import COLORS, COORD_DISPLAY, DIRS, WALL_TYPE, DEBUG_TEST, FPS
  
  except ImportError as err:
      print "Could not load module: %s" % (err)
      sys.exit(2)
  
  if not pg.font:
      print "Warning: fonts disabled."
  
  
  def terminate():
      """End the program cleanly."""
      pg.quit()
      sys.exit(0)
  
  
  def main():
      """Run the program."""
  
      clock = pg.time.Clock()
  
      running = True
  
      # Loop while program is running
      while running:
          # Control maximum framrate
          clock.tick(FPS)
  
          # Process input
          for event in pg.event.get():
              if event.type == pg.QUIT:      #
                  terminate()
              #if event.type == pg.KEYUP:
              #    if event.key == pg.K_ESCAPE:
              #        terminate()
  
          # Update program state
  
          # Draw/render
          prepare.overlay.fill((0, 0, 0, 0))
          prepare.the_map.draw(prepare.overlay)
          prepare.screen.blit(prepare.overlay, (0, 0))
  
          # *After* drawing everything, flip the display
          pg.display.flip()
  
  
  if __name__ == "__main__":      # Do not run this if called from some other module???
      main()
  
new_contents: ﻿#!/usr/bin/env python
  
  """ Map Creation Tool
  
  This tool is designed with an initial focus on Bard's Tale-style maps.
  
  Maps are built on a cartesian grid.  Each cell in the grid defines its
  own contents as well as the contents of the four bounding walls.
  """
  
  # A lot of base code copied from my earlier SoC project.
  
  # ??? is a searchable string for later lookup for things I know are
  # needed but whose exact use is unclear.
  
  # "coord" and "coordinates" refer to the MapCell coordinates, while
  # "top" and "left" and "width" etc. refer to pixel coordinates.
  
  import os
  import sys
  
  try:
      import pygame as pg
  
      import prepare
      import map_tools
      import options
      from options import COLORS, COORD_DISPLAY, DIRS, WALL_TYPE, DEBUG_TEST, FPS
  
  except ImportError as err:
      print "Could not load module: %s" % (err)
      sys.exit(2)
  
  if not pg.font:
      print "Warning: fonts disabled."
  
  
  #def terminate():
  #    """End the program cleanly."""
  #    pg.quit()
  #    sys.exit(0)
  
  
  def main():
      """Run the program."""
  
      clock = pg.time.Clock()
  
      running = True
  
      # Loop while program is running
      while running:
          # Control maximum framrate
          clock.tick(FPS)
  
          # Process input
          for event in pg.event.get():
              if event.type == pg.QUIT:
                  running = False
              if event.type == pg.KEYUP:
                  if event.key == pg.K_ESCAPE:
                      running = False
  
          # Update program state
  
          # Draw/render
          prepare.overlay.fill((0, 0, 0, 0))
          prepare.the_map.draw(prepare.overlay)
          prepare.screen.blit(prepare.overlay, (0, 0))
  
          # *After* drawing everything, flip the display
          pg.display.flip()
  
      pg.quit()
      return 0
  
  
  #if __name__ == "__main__":      # Do not run this if called from some other module???
  #    main()
  
  if __name__ == "__main__":
      sys.exit(int(main() or 0))
  
subject: Remove obsolete comments Tidy up some code practices