<?xml version="1.0"?>
<?xml-stylesheet type="text/css" href="https://drl.chaosforge.org/w/skins/common/feed.css?303"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
		<id>https://drl.chaosforge.org/w/index.php?action=history&amp;feed=atom&amp;title=User%3ATehtmi%2FMap_Colorizer</id>
		<title>User:Tehtmi/Map Colorizer - Revision history</title>
		<link rel="self" type="application/atom+xml" href="https://drl.chaosforge.org/w/index.php?action=history&amp;feed=atom&amp;title=User%3ATehtmi%2FMap_Colorizer"/>
		<link rel="alternate" type="text/html" href="https://drl.chaosforge.org/w/index.php?title=User:Tehtmi/Map_Colorizer&amp;action=history"/>
		<updated>2026-04-27T03:06:58Z</updated>
		<subtitle>Revision history for this page on the wiki</subtitle>
		<generator>MediaWiki 1.21.1</generator>

	<entry>
		<id>https://drl.chaosforge.org/w/index.php?title=User:Tehtmi/Map_Colorizer&amp;diff=613&amp;oldid=prev</id>
		<title>Tehtmi: slight update</title>
		<link rel="alternate" type="text/html" href="https://drl.chaosforge.org/w/index.php?title=User:Tehtmi/Map_Colorizer&amp;diff=613&amp;oldid=prev"/>
				<updated>2011-07-24T00:44:31Z</updated>
		
		<summary type="html">&lt;p&gt;slight update&lt;/p&gt;
&lt;table class='diff diff-contentalign-left'&gt;
				&lt;col class='diff-marker' /&gt;
				&lt;col class='diff-content' /&gt;
				&lt;col class='diff-marker' /&gt;
				&lt;col class='diff-content' /&gt;
			&lt;tr style='vertical-align: top;'&gt;
			&lt;td colspan='2' style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
			&lt;td colspan='2' style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;Revision as of 00:44, 24 July 2011&lt;/td&gt;
			&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 197:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 197:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;#160;&amp;#160; &amp;#160; &amp;#160; &amp;#160;  'random weapon'&amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; :('?', 'olive'),&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;#160;&amp;#160; &amp;#160; &amp;#160; &amp;#160;  'random weapon'&amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; :('?', 'olive'),&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;#160;&amp;#160; &amp;#160; &amp;#160; &amp;#160;  '[space]'&amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; :(' ', None),&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;#160;&amp;#160; &amp;#160; &amp;#160; &amp;#160;  '[space]'&amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; :(' ', None),&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;#160;&amp;#160; &amp;#160; &amp;#160; &amp;#160;  '[newline]'&amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; :('\n', None)}&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;#160;&amp;#160; &amp;#160; &amp;#160; &amp;#160;  '[newline]'&amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; :('\n&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;', None),&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;#160;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;&amp;#160; &amp;#160; &amp;#160; &amp;#160;  '[empty]'&amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; :('&lt;/ins&gt;', None)}&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;# These are default associations between map characters and actual tiles&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;# These are default associations between map characters and actual tiles&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Tehtmi</name></author>	</entry>

	<entry>
		<id>https://drl.chaosforge.org/w/index.php?title=User:Tehtmi/Map_Colorizer&amp;diff=582&amp;oldid=prev</id>
		<title>Tehtmi: Created page with &quot;&lt;pre&gt; # ********* # *WARNING* Spoilers contained in this file! # *********  # This program colorizes doomrl maps for the doomrl wiki. # Program written by tehtmi # Contact: tehtm...&quot;</title>
		<link rel="alternate" type="text/html" href="https://drl.chaosforge.org/w/index.php?title=User:Tehtmi/Map_Colorizer&amp;diff=582&amp;oldid=prev"/>
				<updated>2011-07-23T03:00:26Z</updated>
		
		<summary type="html">&lt;p&gt;Created page with &amp;quot;&amp;lt;pre&amp;gt; # ********* # *WARNING* Spoilers contained in this file! # *********  # This program colorizes doomrl maps for the doomrl wiki. # Program written by tehtmi # Contact: tehtm...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;&amp;lt;pre&amp;gt;&lt;br /&gt;
# *********&lt;br /&gt;
# *WARNING* Spoilers contained in this file!&lt;br /&gt;
# *********&lt;br /&gt;
&lt;br /&gt;
# This program colorizes doomrl maps for the doomrl wiki.&lt;br /&gt;
# Program written by tehtmi&lt;br /&gt;
# Contact: tehtmi gmail&lt;br /&gt;
#                @     .com&lt;br /&gt;
# You can also contact my on the DoomRL forums/wiki.&lt;br /&gt;
# I am tehtmi on both.&lt;br /&gt;
&lt;br /&gt;
# Feel free to use/edit this script however you want for&lt;br /&gt;
# the purposes of contributing to the doomrl wiki.&lt;br /&gt;
# Please do not sell this program.&lt;br /&gt;
# This script is not intended to cause damage to your&lt;br /&gt;
# computer in any way, but understand that it is provided&lt;br /&gt;
# with no warranty or guarantee of safety.&lt;br /&gt;
&lt;br /&gt;
# Usage Notes:&lt;br /&gt;
# Running this program requires your computer to have an&lt;br /&gt;
# implementation of python installed.  You can download&lt;br /&gt;
# python for free at:&lt;br /&gt;
# http://www.python.org/&lt;br /&gt;
# I believe this program should run on python 2.6 and 3.0.&lt;br /&gt;
# The program is designed to be run from the command line.&lt;br /&gt;
# In windows:&lt;br /&gt;
# 1) Install python (if necessary)&lt;br /&gt;
# 2) Put this script in a textfile with the .py extension.&lt;br /&gt;
# 2.5) It helps to put the script in the same directory as&lt;br /&gt;
#      the map you want to colorize&lt;br /&gt;
# 3) Open a command prompt (Start-&amp;gt;Run...-&amp;gt;&amp;quot;cmd&amp;quot;)&lt;br /&gt;
# 4) Navigate to the location of the script (&amp;quot;cd&amp;quot;)&lt;br /&gt;
# 5) Type &amp;quot;[filename].py map.txt colormap.txt&amp;quot;&lt;br /&gt;
#    Where [filename] is the name you gave to this&lt;br /&gt;
#    script, map.txt is the name of the map file&lt;br /&gt;
#    you want to colorize, and colormap.txt is the&lt;br /&gt;
#    name of file you want to output to.&lt;br /&gt;
# In *nix:&lt;br /&gt;
# 1-2.5) as above&lt;br /&gt;
# 3) Open a terminal (if necessary)&lt;br /&gt;
# 4) Navigate to the location of the script&lt;br /&gt;
# 5) Type &amp;quot;python [filename].py map.txt colormap.txt&lt;br /&gt;
# WARNING: the contents of the output file might be&lt;br /&gt;
#    overwritten if a file with that name already&lt;br /&gt;
#    exists!&lt;br /&gt;
&lt;br /&gt;
# Map file format:&lt;br /&gt;
# Maps are plain text files&lt;br /&gt;
# Empty lines are ignored, as are lines that begin with //&lt;br /&gt;
# Use lines beginning with // to comment your map if desired.&lt;br /&gt;
# The file should contain a map grid enclosed between a line&lt;br /&gt;
# that contains only the word &amp;quot;map&amp;quot; and another line that&lt;br /&gt;
# contains only the words &amp;quot;end map&amp;quot;.&lt;br /&gt;
# Each character in the map grid represents one DoomRL tile.&lt;br /&gt;
# By default, certain characters refer to certain tiles.  There&lt;br /&gt;
# is a list of default associations in the file below.&lt;br /&gt;
# Outside of the &amp;quot;map&amp;quot;/&amp;quot;end map&amp;quot; block, the map file can create&lt;br /&gt;
# and reassign associations between characters in the map grid&lt;br /&gt;
# and DoomRL tiles.  To do this, write a line of the form:&lt;br /&gt;
# [map grid character] : [DoomRL tile name]&lt;br /&gt;
# A list of recognized DoomRL tiles is found below.&lt;br /&gt;
# The program knows how to colorize and draw these tiles&lt;br /&gt;
# based on their names.&lt;br /&gt;
# NOTE: A map grid character DOES NOT have to be the same&lt;br /&gt;
# character used by DoomRL to draw the map-tile it represents.&lt;br /&gt;
# E.G. &amp;quot;P&amp;quot; could represent a pain elemental even though pain&lt;br /&gt;
# elementals look like &amp;quot;O&amp;quot; in the game.&lt;br /&gt;
&lt;br /&gt;
import sys&lt;br /&gt;
import re&lt;br /&gt;
&lt;br /&gt;
inputFileName = sys.argv[1]&lt;br /&gt;
outputFileName = sys.argv[2]&lt;br /&gt;
&lt;br /&gt;
inputFile = open(inputFileName, 'r')&lt;br /&gt;
&lt;br /&gt;
tileMapFlag = False&lt;br /&gt;
&lt;br /&gt;
# Non ascii characters: generated using html escapes&lt;br /&gt;
middleDot = '&amp;amp;#38;#183;'  #Used for floor&lt;br /&gt;
brokenBar = '&amp;amp;#38;#166;'  #Used for ammo&lt;br /&gt;
bullet = '&amp;amp;#38;bull;'     #Used for pool of blood&lt;br /&gt;
openBracket = '&amp;amp;#38;#91;' #Fixes wiki issue with [[ for two adjacent armors&lt;br /&gt;
&lt;br /&gt;
# These are all the types of tile that are recognized by the program&lt;br /&gt;
# TODO: add different types of corpses&lt;br /&gt;
# TODO: do some enemies have green blood?&lt;br /&gt;
terms = {'stone wall'                 :('#', 'silver'),&lt;br /&gt;
         'blooded wall'               :('#', 'maroon'),&lt;br /&gt;
         'bloodstone'                 :('#', 'maroon'),&lt;br /&gt;
         'blooded wall (bloodstone)'  :('#', 'red'),&lt;br /&gt;
         'locked door'                :('+', 'olive'),&lt;br /&gt;
         'closed door'                :('+', 'olive'),&lt;br /&gt;
         'open door'                  :('/', 'olive'),&lt;br /&gt;
         'phobos rock'                :('.', 'maroon'),&lt;br /&gt;
         'floor'                      :(middleDot, 'silver'),&lt;br /&gt;
         'blood'                      :(middleDot, 'maroon'),&lt;br /&gt;
         'pool of blood'              :(bullet, 'maroon'),&lt;br /&gt;
         'corpse'                     :('%', 'maroon'),&lt;br /&gt;
         'stairs'                     :('&amp;gt;', 'silver'),&lt;br /&gt;
         'down stairs'                :('&amp;gt;', 'silver'),&lt;br /&gt;
         'special stairs'             :('&amp;gt;', 'red'),&lt;br /&gt;
         'water'                      :('=', 'navy'),&lt;br /&gt;
         'acid'                       :('=', 'green'),&lt;br /&gt;
         'lava'                       :('=', 'PLAID:yellow:maroon'),&lt;br /&gt;
         'lever'                      :('&amp;amp;', 'white'),&lt;br /&gt;
         'special lever'              :('&amp;amp;', 'fuchsia'),&lt;br /&gt;
         'teleporter'                 :('*', 'aqua'),&lt;br /&gt;
         'hellgate'                   :('0', 'fuchsia'),&lt;br /&gt;
         'barrel of fuel'             :('0', 'olive'),&lt;br /&gt;
         'barrel of acid'             :('0', 'green'),&lt;br /&gt;
         'barrel of napalm'           :('0', 'red'),&lt;br /&gt;
         'pistol'                     :('}', 'silver'),&lt;br /&gt;
         'shotgun'                    :('}', 'gray'),&lt;br /&gt;
         'combat shotgun'             :('}', 'blue'),&lt;br /&gt;
         'double shotgun'             :('}', 'white'),&lt;br /&gt;
         'chaingun'                   :('}', 'maroon'),&lt;br /&gt;
         'rocket launcher'            :('}', 'olive'),&lt;br /&gt;
         'plasma rifle'               :('}', 'teal'),&lt;br /&gt;
         'bfg 9000'                   :('}', 'fuchsia'),&lt;br /&gt;
         'exotic weapon'              :('}', 'fuchsia'),&lt;br /&gt;
         'unique weapon'              :('}', 'lime'),&lt;br /&gt;
         'combat knife'               :('\\', 'white'),&lt;br /&gt;
         'chainsaw'                   :('\\', 'fuchsia'),&lt;br /&gt;
         'exotic melee weapon'        :('\\', 'fuchsia'),&lt;br /&gt;
         'unique melee weapon'        :('\\', 'lime'),&lt;br /&gt;
         'artifact melee weapon'      :('\\', 'yellow'),&lt;br /&gt;
         '10mm ammo'                  :(brokenBar, 'silver'),&lt;br /&gt;
         'shotgun shell'              :(brokenBar, 'gray'),&lt;br /&gt;
         'rocket'                     :(brokenBar, 'olive'),&lt;br /&gt;
         'power cell'                 :(brokenBar, 'teal'),&lt;br /&gt;
         'green armor'                :(openBracket, 'green'),&lt;br /&gt;
         'blue armor'                 :(openBracket, 'navy'),&lt;br /&gt;
         'red armor'                  :(openBracket, 'maroon'),&lt;br /&gt;
         'exotic armor'               :(openBracket, 'fuchsia'),&lt;br /&gt;
         'unique armor'               :(openBracket, 'lime'),&lt;br /&gt;
         'artifact armor'             :(openBracket, 'yellow'),&lt;br /&gt;
         'steel boots'                :(';', 'white'),&lt;br /&gt;
         'protective boots'           :(';', 'green'),&lt;br /&gt;
         'plasteel boots'             :(';', 'navy'),&lt;br /&gt;
         'exotic boots'               :(';', 'fuchsia'),&lt;br /&gt;
         'unique boots'               :(';', 'lime'),&lt;br /&gt;
         'agility mod pack'           :('&amp;quot;', 'aqua'),&lt;br /&gt;
         'bulk mod pack'              :('&amp;quot;', 'blue'),&lt;br /&gt;
         'power mod pack'             :('&amp;quot;', 'fuchsia'),&lt;br /&gt;
         'technical mod pack'         :('&amp;quot;', 'yellow'),&lt;br /&gt;
         'exotic mod pack'            :('&amp;quot;', 'fuchsia'),&lt;br /&gt;
         'unique mod pack'            :('&amp;quot;', 'lime'),         &lt;br /&gt;
         'small med-pack'             :('+', 'red'),&lt;br /&gt;
         'large med-pack'             :('+', 'maroon'),&lt;br /&gt;
         'phase device'               :('+', 'navy'),&lt;br /&gt;
         'homing phase device'        :('+', 'blue'),&lt;br /&gt;
         'envirosuit pack'            :('+', 'green'),&lt;br /&gt;
         'exotic pack'                :('+', 'fuchsia'),&lt;br /&gt;
         'unique pack'                :('+', 'lime'),&lt;br /&gt;
         'thermonuclear bomb'         :('%', 'blue'),&lt;br /&gt;
         'thermonuclear bomb (active)':('0', 'maroon'),&lt;br /&gt;
         'unique staff'               :('?', 'lime'),&lt;br /&gt;
         'artifact staff'             :('?', 'yellow'),&lt;br /&gt;
         'small health globe'         :('^', 'red'),&lt;br /&gt;
         'large health globe'         :('^', 'maroon'),&lt;br /&gt;
         'berserk pack'               :('^', 'maroon'),&lt;br /&gt;
         'supercharge globe'          :('^', 'blue'),&lt;br /&gt;
         'invulnerabilty globe'       :('^', 'white'),&lt;br /&gt;
         'armour shard'               :('^', 'yellow'),&lt;br /&gt;
         'megasphere'                 :('^', 'fuchsia'),&lt;br /&gt;
         'computer map'               :('^', 'green'),&lt;br /&gt;
         'backpack'                   :('^', 'olive'),&lt;br /&gt;
         'player start'               :('@', 'silver'),&lt;br /&gt;
         'former human'               :('h', 'silver'),&lt;br /&gt;
         'former sergeant'            :('h', 'gray'),&lt;br /&gt;
         'former captain'             :('h', 'maroon'),&lt;br /&gt;
         'former commando'            :('h', 'blue'),&lt;br /&gt;
         'imp'                        :('i', 'olive'),&lt;br /&gt;
         'demon'                      :('c', 'red'),&lt;br /&gt;
         'lost soul'                  :('s', 'yellow'),&lt;br /&gt;
         'cacodemon'                  :('O', 'maroon'),&lt;br /&gt;
         'hell knight'                :('B', 'olive'),&lt;br /&gt;
         'pain elemental'             :('O', 'olive'),&lt;br /&gt;
         'mancubus'                   :('M', 'olive'),&lt;br /&gt;
         'arachnotron'                :('A', 'yellow'),&lt;br /&gt;
         'revenant'                   :('R', 'white'),&lt;br /&gt;
         'baron of hell'              :('B', 'maroon'),&lt;br /&gt;
         'arch-vile'                  :('V', 'yellow'),&lt;br /&gt;
         'nightmare imp'              :('i', 'blue'),&lt;br /&gt;
         'nightmare demon'            :('c', 'blue'),&lt;br /&gt;
         'nightmare cacodemon'        :('O', 'blue'),&lt;br /&gt;
         'arena master'               :('V', 'lime'),&lt;br /&gt;
         'shambler'                   :('B', 'white'),&lt;br /&gt;
         'bruiser'                    :('B', 'red'),&lt;br /&gt;
         'angel of death'             :('A', 'maroon'),&lt;br /&gt;
         'lava elemental'             :('E', 'yellow'),&lt;br /&gt;
         'cyberdemon'                 :('C', 'olive'),&lt;br /&gt;
         'john carmack'               :('@', 'blue'),&lt;br /&gt;
         'random armor or boots'      :('?', 'navy'),&lt;br /&gt;
         'random weapon'              :('?', 'olive'),&lt;br /&gt;
         '[space]'                    :(' ', None),&lt;br /&gt;
         '[newline]'                  :('\n', None)}&lt;br /&gt;
&lt;br /&gt;
# These are default associations between map characters and actual tiles&lt;br /&gt;
# Associations can be added or modified by the input file&lt;br /&gt;
assoc = {'@':'player start',&lt;br /&gt;
         '^':'supercharge globe',         &lt;br /&gt;
         '#':'stone wall',&lt;br /&gt;
         '+':'closed door',&lt;br /&gt;
         '.':'floor',&lt;br /&gt;
         '=':'lava',&lt;br /&gt;
         '&amp;amp;':'lever',&lt;br /&gt;
         '*':'teleporter',&lt;br /&gt;
         '0':'barrel',&lt;br /&gt;
         '&amp;gt;':'down stairs',&lt;br /&gt;
         'h':'former human',&lt;br /&gt;
         'i':'imp',&lt;br /&gt;
         's':'lost soul',&lt;br /&gt;
         'c':'demon',&lt;br /&gt;
         'B':'baron of hell',&lt;br /&gt;
         'O':'cacodemon',&lt;br /&gt;
         'R':'revenant',&lt;br /&gt;
         'A':'arachnotron',&lt;br /&gt;
         'M':'mancubus',&lt;br /&gt;
         'C':'cyberdemon',&lt;br /&gt;
         'V':'arch-vile',&lt;br /&gt;
         'E':'lava elemental'}&lt;br /&gt;
&lt;br /&gt;
# Regular expressions used to parse the input file&lt;br /&gt;
mapProg = re.compile(r'[\s]*map[\s]*$')&lt;br /&gt;
endMapProg = re.compile(r'[\s]*end map[\s]*$')&lt;br /&gt;
prog = re.compile(r'[\s]*([\S])[\s]*:[\s]*(.*?)[\s]*$')&lt;br /&gt;
&lt;br /&gt;
mapLines = []&lt;br /&gt;
&lt;br /&gt;
autobindingPrefix = '_'&lt;br /&gt;
autobindingNumber = 0&lt;br /&gt;
&lt;br /&gt;
# Read the input file.&lt;br /&gt;
for line in inputFile:&lt;br /&gt;
    if line == '\n':&lt;br /&gt;
        continue&lt;br /&gt;
    if len(line) &amp;gt;= 2 and line[0] == line[1] == '/':&lt;br /&gt;
        # comment&lt;br /&gt;
        continue&lt;br /&gt;
    elif not tileMapFlag:&lt;br /&gt;
        if mapProg.match(line) is not None:&lt;br /&gt;
            tileMapFlag = True&lt;br /&gt;
        else:&lt;br /&gt;
            result = prog.match(line)&lt;br /&gt;
            # print result.group(1), result.group(2)&lt;br /&gt;
            name = result.group(1)&lt;br /&gt;
            binding = result.group(2)&lt;br /&gt;
            if len(binding) &amp;gt;= 3 and binding[0] == '.':&lt;br /&gt;
                autobinding = autobindingPrefix + str(autobindingNumber)&lt;br /&gt;
                autobindingNumber += 1&lt;br /&gt;
                assoc[name] = autobinding&lt;br /&gt;
                terms[autobinding] = (binding[1], binding[3:])&lt;br /&gt;
            else:&lt;br /&gt;
                if not terms.has_key(binding):&lt;br /&gt;
                    print &amp;quot;Invalid tile name '&amp;quot; + binding + &amp;quot;'.&amp;quot;&lt;br /&gt;
                    print &amp;quot;Check spelling and consult the list in the file.&amp;quot;&lt;br /&gt;
                    sys.exit(1)&lt;br /&gt;
                assoc[name] = binding&lt;br /&gt;
    else:&lt;br /&gt;
        if endMapProg.match(line) is not None:&lt;br /&gt;
            tileMapFlag = False&lt;br /&gt;
        else:&lt;br /&gt;
            mapLines.append(line)&lt;br /&gt;
inputFile.close()&lt;br /&gt;
&lt;br /&gt;
def handle(tiles, colorStack):&lt;br /&gt;
    if(len(tiles) == 0):&lt;br /&gt;
        return&lt;br /&gt;
    fColors = set([])&lt;br /&gt;
    bColors = set([])&lt;br /&gt;
    x = 0&lt;br /&gt;
    while fColors.isdisjoint(bColors):&lt;br /&gt;
        if x == len(tiles):&lt;br /&gt;
            # all colors are None&lt;br /&gt;
            for tile in tiles:&lt;br /&gt;
                outputFile.write(tile[0])&lt;br /&gt;
            return&lt;br /&gt;
        color1 = tiles[x][1]&lt;br /&gt;
        color2 = tiles[-(x + 1)][1]&lt;br /&gt;
        if color1 is not None:&lt;br /&gt;
            fColors.add(color1)&lt;br /&gt;
        if color2 is not None:&lt;br /&gt;
            bColors.add(color2)&lt;br /&gt;
        x += 1&lt;br /&gt;
    color = (fColors &amp;amp; bColors).pop()&lt;br /&gt;
    x = 0&lt;br /&gt;
    while not tiles[x][1] == color:&lt;br /&gt;
        x += 1  &lt;br /&gt;
    y = len(tiles) - 1&lt;br /&gt;
    while not tiles[y][1] == color:&lt;br /&gt;
        y -= 1&lt;br /&gt;
    handle(tiles[0:x], colorStack)&lt;br /&gt;
    if len(colorStack) &amp;gt;= 2 and colorStack[1] == color:&lt;br /&gt;
        inStack = colorStack[1:]&lt;br /&gt;
        outputFile.write('&amp;lt;/span&amp;gt;')&lt;br /&gt;
        popMode = True&lt;br /&gt;
    else:&lt;br /&gt;
        inStack = [color] + colorStack&lt;br /&gt;
        outputFile.write('&amp;lt;span style=&amp;quot;color:' + color + '&amp;quot;&amp;gt;')&lt;br /&gt;
        popMode = False&lt;br /&gt;
    x1 = x&lt;br /&gt;
    while tiles[x1][1] in [color, None] and x1 &amp;lt; y:&lt;br /&gt;
        outputFile.write(tiles[x1][0])&lt;br /&gt;
        x1 += 1&lt;br /&gt;
    y1 = y&lt;br /&gt;
    while tiles[y1][1] in [color, None] and y1 &amp;gt;= x1:&lt;br /&gt;
        y1 -= 1&lt;br /&gt;
    y1 += 1&lt;br /&gt;
    handle(tiles[x1:y1], inStack)&lt;br /&gt;
    for y0 in range(y1, y + 1):&lt;br /&gt;
        outputFile.write(tiles[y0][0])&lt;br /&gt;
    if popMode:&lt;br /&gt;
        outputFile.write('&amp;lt;span style=&amp;quot;color:' + colorStack[0] + '&amp;quot;&amp;gt;')&lt;br /&gt;
    else:&lt;br /&gt;
        outputFile.write('&amp;lt;/span&amp;gt;')&lt;br /&gt;
    handle(tiles[(y + 1):], colorStack)&lt;br /&gt;
&lt;br /&gt;
outputFile = open(outputFileName, 'w')&lt;br /&gt;
&lt;br /&gt;
tiles = []&lt;br /&gt;
for y in range(0, len(mapLines)):&lt;br /&gt;
    line = mapLines[y]&lt;br /&gt;
    for x in range(0, len(line) - 1): # -1 ignores ending '\n'&lt;br /&gt;
        c = line[x]&lt;br /&gt;
        tileChar, tileColor = terms[assoc[c].lower()]&lt;br /&gt;
        if tileColor.startswith('PLAID'):&lt;br /&gt;
            plaidColors = tileColor[6:].split(':')&lt;br /&gt;
            tileColor = plaidColors[(x + y) % len(plaidColors)]&lt;br /&gt;
        tiles.append((tileChar, tileColor))&lt;br /&gt;
    if y &amp;lt;= len(mapLines) - 2:&lt;br /&gt;
        tiles.append(terms['[newline]'])&lt;br /&gt;
        tiles.append(terms['[space]'])&lt;br /&gt;
&lt;br /&gt;
outputFile.write(' &amp;lt;span style=&amp;quot;font-size:larger;background-color:black&amp;quot;&amp;gt;')&lt;br /&gt;
handle(tiles,[])&lt;br /&gt;
outputFile.write('&amp;lt;/span&amp;gt;\n')&lt;br /&gt;
outputFile.close()&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;/div&gt;</summary>
		<author><name>Tehtmi</name></author>	</entry>

	</feed>