Commits

Anonymous committed 9c4efc8

Initial python3 conversion successful: simple_story.py runs

Comments (0)

Files changed (46)

branching_story.py

         answers = []
         # get all possible answers by checking if the ways are possible. 
 
-        for i, j in directions.items():
+        for i, j in list(directions.items()):
             if self.maze[j[1]][j[0]]:
                 answers.append(i)
 

rpg_lib/QtTextRPG.py

 #!/usr/bin/env python
 # encoding: utf-8
 
-from __future__ import division
+
 import sys
 from math import *
 from PyQt4.QtCore import *
 
  def updateUi(self):
   try:
-   text = unicode(self.lineedit.text())
+   text = str(self.lineedit.text())
    self.browser.append(str(text) + " = <b>" + str(eval(text)) + "</b>")
   except:
    self.browser.append("<font color=red>" + str(text) + " is invalid!</font>"

rpg_lib/anyrpg.py

 __version__   = '0.1' 
 
 import sys
-from textrpg_1d6 import Char as ews_char
+from .textrpg_1d6 import Char as ews_char
 from time import sleep # for autoscrolling
 # To be able to recognize linebreaks, we get the linesep. 
 from os import linesep
 class UserInteraction(object): 
     """Basic user interaction: Showing and asking things."""
     def __init__(self, *args, **kwds): 
-	self.line_length = 80 #: The maximum length of story lines. 
-	#: Char wait should be selectable per char, for example a fullstop should wait longer. 
-	self.special_wait = {
-	    linesep: 0.1, # = linebreak
-	    ".": 0.15,
-	    "?": 0.15,
-	    "!": 0.15,
-	    ",": 0.1
-	    }
-	self.char_wait = 0.05
+        self.line_length = 80 #: The maximum length of story lines. 
+        #: Char wait should be selectable per char, for example a fullstop should wait longer. 
+        self.special_wait = {
+            linesep: 0.1, # = linebreak
+            ".": 0.15,
+            "?": 0.15,
+            "!": 0.15,
+            ",": 0.1
+            }
+        self.char_wait = 0.05
         super(UserInteraction, self).__init__(*args, **kwds)
-	
+        
         
     def ask(self, question=None, answers = [], default_answer = 0, localize = True, end_with_linebreak = True, capital_default = True, *args, **kwds): 
         """Ask a question.
         
         Note: Not console based implementations will want to overwrite this. 
-	
-	Plans: 
-		- ask(question=None, default=0, *answers, **kwds) - usage: ask("why?", "because", "it's how it is", "I don't know", default=2) -> default capitalized, rest small print. 
-	"""
+        
+        Plans: 
+                - ask(question=None, default=0, *answers, **kwds) - usage: ask("why?", "because", "it's how it is", "I don't know", default=2) -> default capitalized, rest small print. 
+        """
         if question is not None: 
-	    sleep(0.01)
-	    # Optionally localizing everything. 
-	    if localize: 
-		question = _(question)
-		if answers: 
-		    answers = [_(answer) for answer in answers]
+            sleep(0.01)
+            # Optionally localizing everything. 
+            if localize: 
+                question = _(question)
+                if answers: 
+                    answers = [_(answer) for answer in answers]
 
-	    # capitalize the default answer, except if the user says otherwise. 
-	    if capital_default and answers: 
-		answers = [answer.lower() for answer in answers]
-		answers[default_answer] = answers[default_answer].capitalize()
-	    
-	    if answers: 
-		question += " ( " + ", ".join(answers) + " )"
-	    answer = raw_input(question + " ")
-	    
-	    if end_with_linebreak: 
-		# Add an empty line with autoscrolling to show that we're now at the next part. the user already provided input, so we don't need to ask for input again. 
-		self.diag("", localize=False, autoscroll=True, *args, **kwds)
-	    
-	    return answer
+            # capitalize the default answer, except if the user says otherwise. 
+            if capital_default and answers: 
+                answers = [answer.lower() for answer in answers]
+                answers[default_answer] = answers[default_answer].capitalize()
+            
+            if answers: 
+                question += " ( " + ", ".join(answers) + " )"
+            answer = input(question + " ")
+            
+            if end_with_linebreak: 
+                # Add an empty line with autoscrolling to show that we're now at the next part. the user already provided input, so we don't need to ask for input again. 
+                self.diag("", localize=False, autoscroll=True, *args, **kwds)
+            
+            return answer
 
     def split_diag(self, text, line_length = None, localize=True, autoscroll=True, wait_for_input = False, line_beginning = "", *args, **kwds): 
-	"""Print a dialog in single lines split at word borders. 
-	
-	@param text: The text to output. 
-	@param line_length: Maximum length of a line. 
-	
-	"""
-	# Split the text by words to output at most self.line_length chars per line. 
-	if line_length is None: 
-	    line_length = self.line_length
-	text_to_print = ""
-	# Preserve leading spaces. 
-	if text: 
-	    while text and text[0] == " ": 
-		text_to_print += " "
-		text = text[1:]
-	# Print as many words as possible without breaking the max line width. 
-	for j in text.split(): 
-	    if len(line_beginning) + len(text_to_print) + len(j) >= line_length: 
-		self.diag(line_beginning + text_to_print, localize=localize, autoscroll=autoscroll, wait_for_input = False, *args, **kwds)
-		# If j > self.line_length -> split j and use only the remaining rest as default, printing all else directly. 
-		if len(line_beginning) + len(j) > self.line_length: 
-		    while j[self.line_length - len(line_beginning):]: 
-			self.diag(line_beginning + j[:self.line_length - len(line_beginning)], localize=localize, autoscroll=autoscroll, wait_for_input = False, *args, **kwds)
-			j = j[self.line_length - len(line_beginning):]
-		text_to_print = j
-	    else: 
-		# if we already have text_to_print, add j with a space. 
-		if text_to_print: 
-		    text_to_print += " " + j
-		else: 
-		    text_to_print = j
-	# Print the last line of this dialog plus an empty line. 
-	if text_to_print: 
-	    self.diag(line_beginning + text_to_print, localize=localize, autoscroll=autoscroll, wait_for_input = wait_for_input, *args, **kwds)
-	else: 
-	    # If the line is empty, print a really empty line. 
-	    self.diag(text_to_print, localize=localize, autoscroll=autoscroll, wait_for_input = wait_for_input, *args, **kwds)
+        """Print a dialog in single lines split at word borders. 
+        
+        @param text: The text to output. 
+        @param line_length: Maximum length of a line. 
+        
+        """
+        # Split the text by words to output at most self.line_length chars per line. 
+        if line_length is None: 
+            line_length = self.line_length
+        text_to_print = ""
+        # Preserve leading spaces. 
+        if text: 
+            while text and text[0] == " ": 
+                text_to_print += " "
+                text = text[1:]
+        # Print as many words as possible without breaking the max line width. 
+        for j in text.split(): 
+            if len(line_beginning) + len(text_to_print) + len(j) >= line_length: 
+                self.diag(line_beginning + text_to_print, localize=localize, autoscroll=autoscroll, wait_for_input = False, *args, **kwds)
+                # If j > self.line_length -> split j and use only the remaining rest as default, printing all else directly. 
+                if len(line_beginning) + len(j) > self.line_length: 
+                    while j[self.line_length - len(line_beginning):]: 
+                        self.diag(line_beginning + j[:self.line_length - len(line_beginning)], localize=localize, autoscroll=autoscroll, wait_for_input = False, *args, **kwds)
+                        j = j[self.line_length - len(line_beginning):]
+                text_to_print = j
+            else: 
+                # if we already have text_to_print, add j with a space. 
+                if text_to_print: 
+                    text_to_print += " " + j
+                else: 
+                    text_to_print = j
+        # Print the last line of this dialog plus an empty line. 
+        if text_to_print: 
+            self.diag(line_beginning + text_to_print, localize=localize, autoscroll=autoscroll, wait_for_input = wait_for_input, *args, **kwds)
+        else: 
+            # If the line is empty, print a really empty line. 
+            self.diag(text_to_print, localize=localize, autoscroll=autoscroll, wait_for_input = wait_for_input, *args, **kwds)
     
     def press_enter_to_read_on(self, position_in_line): 
-	"""Wait for user input, but ignore all except a linebreak."""
-	raw_input(_("...press enter to read on..."))
-	# press enter to read on at each empty line, so readers can rest. 
-	# clear the line after the user pressed enter.
-	sys.stdout.write('\033[1A')
-	sys.stdout.write(" " * len(_("...press enter to read on...")))
-	#sys.stdout.flush()
-	sys.stdout.write('\033[' + str(position_in_line) + 'G')
-	sys.stdout.write(linesep)
-	sys.stdout.flush()
-	#sleep(special_wait["linesep"])
+        """Wait for user input, but ignore all except a linebreak."""
+        input(_("...press enter to read on..."))
+        # press enter to read on at each empty line, so readers can rest. 
+        # clear the line after the user pressed enter.
+        sys.stdout.write('\033[1A')
+        sys.stdout.write(" " * len(_("...press enter to read on...")))
+        #sys.stdout.flush()
+        sys.stdout.write('\033[' + str(position_in_line) + 'G')
+        sys.stdout.write(linesep)
+        sys.stdout.flush()
+        #sleep(special_wait["linesep"])
     
     def diag(self, data, localize=True, autoscroll=False, special_wait = None, char_wait = None, relative_speed = 1, end_with_linebreak = True, wait_for_input = False, position_in_line = 0, *args, **kwds):
-	""" Print a dialog line. 
-	
-	@param line_wait: The time to wait at linebreaks before continuing with the text. 
-	@param char_wait: The time to wait per char before printing the next char. 
-	@param relative_speed: The relative speed of this dialog compared to others. - Limitation: Speed can only be adjusted for whole lines! 
-	@param autoscroll: If diag should output char by char (True) or wait for user input for each lines (False). 
-	@param end_with_linebreak: If there should be a linebreak at the end (True), or if the next dialog should write on the same line (False). 
-	@param position_in_line: Where in the text line the cursor should be positioned when writing. 
-	"""
-	# If the method doesn't get line_wait and/or char_wait, it uses the default values for the UI. 
-	# With this we can customize the speed of the output. 
-	if special_wait is None: 
-	    special_wait = self.special_wait
-	if char_wait is None: 
-	    char_wait = self.char_wait
+        """ Print a dialog line. 
+        
+        @param line_wait: The time to wait at linebreaks before continuing with the text. 
+        @param char_wait: The time to wait per char before printing the next char. 
+        @param relative_speed: The relative speed of this dialog compared to others. - Limitation: Speed can only be adjusted for whole lines! 
+        @param autoscroll: If diag should output char by char (True) or wait for user input for each lines (False). 
+        @param end_with_linebreak: If there should be a linebreak at the end (True), or if the next dialog should write on the same line (False). 
+        @param position_in_line: Where in the text line the cursor should be positioned when writing. 
+        """
+        # If the method doesn't get line_wait and/or char_wait, it uses the default values for the UI. 
+        # With this we can customize the speed of the output. 
+        if special_wait is None: 
+            special_wait = self.special_wait
+        if char_wait is None: 
+            char_wait = self.char_wait
 
-	# Now adjust the speed by the relative speed: 
-	if relative_speed != 1: 
-	    char_wait *= relative_speed
-	    for key in special_wait: 
-		special_wait[key] *= relative_speed
+        # Now adjust the speed by the relative speed: 
+        if relative_speed != 1: 
+            char_wait *= relative_speed
+            for key in special_wait: 
+                special_wait[key] *= relative_speed
 
-	# Localize the text
+        # Localize the text
         if localize: 
             text = _(data)
         else: text = data 
     
-	# And output it. 
-	# If we have no autoscrolling, we just output the text. 
+        # And output it. 
+        # If we have no autoscrolling, we just output the text. 
         if not autoscroll: 
-            raw_input(text)
-	else: 
-	    # If we have autoscrolling, we print it char by char. 
-	    # Limitation: This looks really dumb, if the text is longer than one line, so please use the split_diag for longer lines. 
-	    
-	    # if the line is empty (spaces count as empty), we wait for user input. 
-	    if not text.strip(): 
-		self.press_enter_to_read_on(position_in_line)
-		# We don't need a line_wait after a blocked empty line. 
-		end_with_linebreak = False
-	    else: 
-		sys.stdout.write('\033[' + str(position_in_line) + 'G')
+            input(text)
+        else: 
+            # If we have autoscrolling, we print it char by char. 
+            # Limitation: This looks really dumb, if the text is longer than one line, so please use the split_diag for longer lines. 
+            
+            # if the line is empty (spaces count as empty), we wait for user input. 
+            if not text.strip(): 
+                self.press_enter_to_read_on(position_in_line)
+                # We don't need a line_wait after a blocked empty line. 
+                end_with_linebreak = False
+            else: 
+                sys.stdout.write('\033[' + str(position_in_line) + 'G')
                 sys.stdout.flush()
             # First sleep 1/10th second. This ensures that the text gets shown before sleeping.
             sleep(char_wait)
-	    # If we have text, wait one 10th of a second per char. 
-	    for i in text: 
-		# load the current cursor position
-		sys.stdout.write(i)
+            # If we have text, wait one 10th of a second per char. 
+            for i in text: 
+                # load the current cursor position
+                sys.stdout.write(i)
                 sys.stdout.flush()
-		if i in special_wait: 
-		    sleep(special_wait[i])
-		else: 
-		    sleep(char_wait)
-	
-	# If we want a linebreak at the end, add it. 
-	if end_with_linebreak: 
-	    # Move back after the last char on the last line. 
-	    sleep(special_wait.get(linesep, 0))
-	    sys.stdout.write(linesep)
+                if i in special_wait: 
+                    sleep(special_wait[i])
+                else: 
+                    sleep(char_wait)
+        
+        # If we want a linebreak at the end, add it. 
+        if end_with_linebreak: 
+            # Move back after the last char on the last line. 
+            sleep(special_wait.get(linesep, 0))
+            sys.stdout.write(linesep)
             sys.stdout.flush()
 
-	if wait_for_input: 
-	    self.press_enter_to_read_on(position_in_line)
+        if wait_for_input: 
+            self.press_enter_to_read_on(position_in_line)
 
 
 class Dialogs(object): 
     def get_experience(self, chars, amount=0):
         """Show the experience the chars get and what they do with it."""
         text = ""
-        print self.get_experience_header(chars=chars, amount=amount)
+        print(self.get_experience_header(chars=chars, amount=amount))
             
         # Info text for each char. 
         for i in chars: 
     def upgrade_info(self, char, amount): 
         """Return the effects of improving the char by the given amount of points/Strichen."""
         upgrade = char.upgrade(amount)
-        item_name = " ".join(upgrade[0].items()[0][0])
-        old_value = upgrade[0].items()[0][1]["Zahlenwert"] 
-        new_value = upgrade[1].items()[0][1]["Zahlenwert"]
+        item_name = " ".join(list(upgrade[0].items())[0][0])
+        old_value = list(upgrade[0].items())[0][1]["Zahlenwert"] 
+        new_value = list(upgrade[1].items())[0][1]["Zahlenwert"]
         if old_value < new_value:
             return char.name + " raised " + item_name + " from " + str(old_value) + " to " + str(new_value) + linesep
         else: 
     
     def say(self, data, autoscroll=True, end_with_linebreak = True, indent = 2, localize = True, *args, **kwds): 
         """Say something -> Show that the char says it."""
-	if localize: 
-	    data = _(data)
-	# First we need an empty line and a line with the name, so the text is set off from the rest. 
-	self.diag(linesep + self.name, localize=False, autoscroll=autoscroll, *args, **kwds)
-	# Now we speak all lines but the last. 
+        if localize: 
+            data = _(data)
+        # First we need an empty line and a line with the name, so the text is set off from the rest. 
+        self.diag(linesep + self.name, localize=False, autoscroll=autoscroll, *args, **kwds)
+        # Now we speak all lines but the last. 
         for i in data.splitlines()[:-1]: 
             self.split_diag(i, localize=False, autoscroll=autoscroll, line_beginning = ' ' * indent, *args, **kwds)
-	# Add the last line without autoscrolling to wait for the user to read the next part. 
-	self.split_diag(data.splitlines()[-1], localize=False, autoscroll=autoscroll, end_with_linebreak = True, wait_for_input = True,  line_beginning = ' ' * indent, *args, **kwds)
+        # Add the last line without autoscrolling to wait for the user to read the next part. 
+        self.split_diag(data.splitlines()[-1], localize=False, autoscroll=autoscroll, end_with_linebreak = True, wait_for_input = True,  line_beginning = ' ' * indent, *args, **kwds)
     
     def ask(self, data, localize=False, indent = 2, *args, **kwds): 
         """Ask something -> Show that the char asks it."""
-	if localize: 
-	    data = _(data)
-	if len(data.splitlines()) > 1: 
-	    # First say the first part of the question. 
-	    self.say(linesep.join(data.splitlines()[:-1]), localize=False, *args, **kwds)
-	# Then ask the last line
+        if localize: 
+            data = _(data)
+        if len(data.splitlines()) > 1: 
+            # First say the first part of the question. 
+            self.say(linesep.join(data.splitlines()[:-1]), localize=False, *args, **kwds)
+        # Then ask the last line
         return super(Char, self).ask(' ' * indent + data.splitlines()[-1], localize = False, *args, **kwds)
     
     def act(self, data, localize = True, autoscroll=True, *args, **kwds): 
             >>> char = Char(source="tag:1w6.org,2008:Mins")
             >>> char.act("walks away.")
             \033[0G
-	    Mins walks away.
-	    >>> char.act('''keeps walking
-	    ... and walking
-	    ... and walking.''')
+            Mins walks away.
+            >>> char.act('''keeps walking
+            ... and walking
+            ... and walking.''')
             \033[0G
-	    Mins keeps walking
-	    \033[0G     and walking
-	    \033[0G     and walking.
+            Mins keeps walking
+            \033[0G     and walking
+            \033[0G     and walking.
         """
-	if localize: 
-	    data = _(data)
-	# First we need an empty line and a line with the name, so the text is set off from the rest. 
-	firstline = linesep + self.name + " " + data.splitlines()[0]
-	self.diag(firstline, localize=False, autoscroll=autoscroll, *args, **kwds)
-	# Now we add the rest, with an indentation equal to the length of the name. 
+        if localize: 
+            data = _(data)
+        # First we need an empty line and a line with the name, so the text is set off from the rest. 
+        firstline = linesep + self.name + " " + data.splitlines()[0]
+        self.diag(firstline, localize=False, autoscroll=autoscroll, *args, **kwds)
+        # Now we add the rest, with an indentation equal to the length of the name. 
         for i in data.splitlines()[1:]: 
             self.split_diag(' '*(len(self.name)) + i, localize=False, *args, **kwds)
         
         """
         if data is not None: 
             data = _(data)
-	    for line in data.splitlines(): 
-		self.split_diag(line, localize=False, *args, **kwds)
+            for line in data.splitlines(): 
+                self.split_diag(line, localize=False, *args, **kwds)
     
     def save(self, chars=[], *args, **kwds):
             """Save the current state."""
     @return: A localized string. '''
     # TODO: Localize cleanly - this is but a test. 
     if text in locales["de_DE"]: 
-	return locales["de_DE"][text]
+        return locales["de_DE"][text]
     else: 
-	return str(text)
+        return str(text)
 
 
 

rpg_lib/avatarsay.py

     """send a command to avatarsay (AKFAvatar)"""
     if akfavtterm:
         stdout.write('\033_')
-	stdout.write(cmd)
-	stdout.write('\033\\')
-	stdout.flush()
+        stdout.write(cmd)
+        stdout.write('\033\\')
+        stdout.flush()
 

rpg_lib/pygame_rpg.py

 
 game.start()
 
-print "test"
+print("test")
 txt = "test"

rpg_lib/pygame_txt_test.py

-from pygame_rpg import *
+from .pygame_rpg import *
 while True:
     for i in "xsdgndfjcfc":
         if i == "x":

rpg_lib/textrpg.py

 """
 
 try: 
-    from anyrpg import __copyright__, __url__, __author__
+    from .anyrpg import __copyright__, __url__, __author__
 except: 
     from rpg_lib.anyrpg import __copyright__, __url__, __author__
 
 
 try: # Get the modules by relative path
     # AnyRPG classes
-    from anyrpg import Char
-    from anyrpg import Story
+    from .anyrpg import Char
+    from .anyrpg import Story
     # AnyRPG function for localizing. 
-    from anyrpg import _
+    from .anyrpg import _
 except: # get the modules by absolute path
     # AnyRPG classes
     from rpg_lib.anyrpg import Char
 """)
     story("You say you don't know who we think you are?")
     story("Well, at least tell me your name then, and I'll tell you a bit about your father, after you won.")
-    char.name = raw_input("My Name: ")
+    char.name = input("My Name: ")
     story("You've got a nice name, " + char.name + ". Good luck!")
 
 
 if __name__ == "__main__": 
-    print "...Creating main character..."
+    print("...Creating main character...")
     char = Char()
     greet(char)
-    print "...Creating enemy character..."
+    print("...Creating enemy character...")
     choss = Char(source='tag:1w6.org,2008:Hegen')
     choss.name = "Hegen"
     won = battle(char, choss)

rpg_lib/textrpg_1d6/__init__.py

 
 #### Imports ####
 
-from char import Char
+from .char import Char
 
 #### Imports ####
 

rpg_lib/textrpg_1d6/amov/Armee.py

 import Skripte.Kernskripte.Objekt as Objekt
 
 # Um immer die neuste Version zu haben brauchen wir die Versionsverwaltung
-from Versionsverwaltung import Versionen
+from .Versionsverwaltung import Versionen
 
 ### Imports ###
 
 ### Klassen ###
 
 class Armee: 
-    def __init__(self, ID=None, art=None,  tag=u"tag:1w6.org,2008:Menschen",  data=None): 
+    def __init__(self, ID=None, art=None,  tag="tag:1w6.org,2008:Menschen",  data=None): 
         #: Der Identifikator der Armee-Datei
         if ID is not None: 
             self.ID = ID
         elif tag is not None: 
             # Wenn keine ID bekannt ist, lade die neuste Datei
-            versionen = Versionen(tag=tag,  kategorie=u"Armeen")
+            versionen = Versionen(tag=tag,  kategorie="Armeen")
             self.ID = versionen.neuste
         # Wenn daten angegeben werden, sollen sie in einer neuen Version gespeichert werden. 
         if data is not None: 

rpg_lib/textrpg_1d6/amov/Charakter.py

 ### Imports ###
 
 # Um die Dateien zu laden, nutzen wir die Objekt-Klasse. 
-import Skripte.Kernskripte.Objekt as Objekt
+from .Skripte.Kernskripte import Objekt
 
 # Und wir brauchen die Basisklasse: Object
-from Object import Object, _
+from .Object import Object, _
 
 # Um immer die neuste Version zu haben brauchen wir die Versionsverwaltung
-from Versionsverwaltung import Versionen
+from .Versionsverwaltung import Versionen
 
 ### Imports ###
 
 ### Klassen ###
 
 class Charakter(Object): 
-    def __init__(self, ID=None, art=None,  tag=u"tag:draketo.de,2007:Sskreszta", kategorie="Charaktere", *args, **kwds): 
+    def __init__(self, ID=None, art=None,  tag="tag:draketo.de,2007:Sskreszta", kategorie="Charaktere", *args, **kwds): 
         super(Charakter, self).__init__(ID=ID, art=art,  tag=tag, kategorie=kategorie, *args, **kwds)
         self.beschreibung = self.ladeBeschreibung()
         self.werte = self.ladeWerte()
         """Lade den Namen des Charakters. 
         
         Wenn der Charakter keinen Namen hat, dann erzeuge einen zufälligen."""
-        if self.daten[0][_(u"Name")] == " ": 
-            self.daten[0][_(u"Name")] = self.objekt.objekt_name()
+        if self.daten[0][_("Name")] == " ": 
+            self.daten[0][_("Name")] = self.objekt.objekt_name()
             self.objekt.write()
-        return self.daten[0][_(u"Name")]
+        return self.daten[0][_("Name")]
         
     def ladeGrunddaten(self): 
         """Lade die Grundlegenden Daten des Charakters, wie seine Beschreibung oder Herkunft. 
         
         Grunddaten enthalten im allgemeinen keine würfelrelevanten Werte."""
-        return self.daten[1][_(u"Grunddaten")]
+        return self.daten[1][_("Grunddaten")]
     
     # Daten laden
     def ladeKampfwerte(self): 
         """Lade die Kampfrelevanten Werte des Charakters."""
-        return self.daten[4][_(u"Kampfwerte")]
+        return self.daten[4][_("Kampfwerte")]
     def ladeAusruestung(self): 
         """Lade die Ausrüstung des Charakters."""
-        return self.daten[3][_(u"Ausrüstung")]
+        return self.daten[3][_("Ausrüstung")]
     def ladeBeschreibung(self): 
-        return self.ladeGrunddaten()[_(u"Beschreibung")]
+        return self.ladeGrunddaten()[_("Beschreibung")]
     def ladeHerkunft(self): 
-        return self.ladeGrunddaten()[_(u"Herkunft")]
+        return self.ladeGrunddaten()[_("Herkunft")]
     def ladeRegion(self): 
-        return self.herkunft[_(u"Region")]
+        return self.herkunft[_("Region")]
     def ladeSprache(self): 
-        return self.herkunft[_(u"Sprache")]
+        return self.herkunft[_("Sprache")]
     def ladeStimmung(self): 
-        return self.ladeGrunddaten()[_(u"Stimmung")]
+        return self.ladeGrunddaten()[_("Stimmung")]
     def ladeWerte(self): 
-        return self.daten[2][_(u"Werte")]
+        return self.daten[2][_("Werte")]
     def ladeEigenschaften(self): 
-        return self.werte[0][_(u"Eigenschaften")]
+        return self.werte[0][_("Eigenschaften")]
     def ladeFertigkeiten(self): 
-        return self.werte[1][_(u"Fertigkeiten")]
+        return self.werte[1][_("Fertigkeiten")]
     def ladeSchutz(self): 
-        return self.kampfwerte[_(u"Hauptrüstung")][_("Schutz")]
+        return self.kampfwerte[_("Hauptrüstung")][_("Schutz")]
     
     # Daten in das dict speichern
     # Das ist nötig, weil sonst beim umschreiben der Attribute des charakter-objekts das strings im dict nicht geändert wird (nur die Attribute werden umgeleitet - Strings sind nicht mutable. 
     def speichereKampfwerte(self, daten): 
         """Speichere die Kampfrelevanten Werte des Charakters."""
-        self.daten[4][_(u"Kampfwerte")] = daten
+        self.daten[4][_("Kampfwerte")] = daten
     def speichereAusruestung(self, daten): 
         """Speichere die Ausrüstung des Charakters."""
-        self.daten[3][_(u"Ausrüstung")] = daten
+        self.daten[3][_("Ausrüstung")] = daten
     def speichereBeschreibung(self, daten): 
-        self.ladeGrunddaten()[_(u"Beschreibung")] = daten
+        self.ladeGrunddaten()[_("Beschreibung")] = daten
     def speichereHerkunft(self, daten): 
-        self.ladeGrunddaten()[_(u"Herkunft")] = daten
+        self.ladeGrunddaten()[_("Herkunft")] = daten
     def speichereRegion(self, daten): 
-        self.herkunft[_(u"Region")] = daten
+        self.herkunft[_("Region")] = daten
     def speichereSprache(self, daten): 
-        self.herkunft[_(u"Sprache")] = daten
+        self.herkunft[_("Sprache")] = daten
     def speichereStimmung(self, daten): 
-        self.ladeGrunddaten()[_(u"Stimmung")] = daten
+        self.ladeGrunddaten()[_("Stimmung")] = daten
     def speichereWerte(self, daten): 
-        self.daten[2][_(u"Werte")] = daten
+        self.daten[2][_("Werte")] = daten
     def speichereEigenschaften(self, daten): 
-        self.werte[0][_(u"Eigenschaften")] = daten
+        self.werte[0][_("Eigenschaften")] = daten
     def speichereFertigkeiten(self, daten): 
-        self.werte[1][_(u"Fertigkeiten")] = daten
+        self.werte[1][_("Fertigkeiten")] = daten
     def speichereSchutz(self, daten): 
-        self.kampfwerte[_(u"Hauptrüstung")][_("Schutz")] = daten
+        self.kampfwerte[_("Hauptrüstung")][_("Schutz")] = daten
     def speichereName(self, daten): 
         self.daten[0][_("Name")] = daten
     
             - Immer das letzte Element in der Liste kann für Daten des Programms aufbehalten werden. 
         """
         
-    	return """- Name: " "
+        return """- Name: " "
 - Grunddaten: 
     Beschreibung: " "
     Herkunft: 
         @type name: String """
         # raise NotImplementedException("Not yet implemented")
         # Get the name of the loaded char or template
-        tagname = self.ID[_(u"ID")][self.ID[_(u"ID")].index(":", 4) + 1:]
+        tagname = self.ID[_("ID")][self.ID[_("ID")].index(":", 4) + 1:]
         
         # If the name changed - self.name is the saved chars name, tagname is the name stored in the tag, name is the parameter passed to this function
         if name is not None and name != tagname or tagname != self.name: 
             # change the tag-line. 
             # if name was given, use it. comparing to None is the fastest, so we do that first. 
             if name is not None: 
-                self.ID[_(u"ID")] = self.ID[_(u"ID")][:self.ID[_(u"ID")].index(":", 4) + 1] + name
+                self.ID[_("ID")] = self.ID[_("ID")][:self.ID[_("ID")].index(":", 4) + 1] + name
             else: # name is None, self.name doesn't equal tagname
-                self.ID[_(u"ID")] = self.ID[_(u"ID")][:self.ID[_(u"ID")].index(":", 4) + 1] + self.name
+                self.ID[_("ID")] = self.ID[_("ID")][:self.ID[_("ID")].index(":", 4) + 1] + self.name
         
         # Now the tagline in the ID changed. 
         
         # First get the new ID
         # self.ID ist die alte ID
         # Use Versionsverwaltung to get a version object
-        versionen = Versionen(tag=self.ID[_(u"ID")], kategorie=self.ID[_(u"Kategorie")])
+        versionen = Versionen(tag=self.ID[_("ID")], kategorie=self.ID[_("Kategorie")])
         # Now call the version object to get the ID with a version chiw is increased by one. 
         self.ID = versionen.version_minor_eins_hoeher()
         
 ### Self-Test ###
 
 def _test(): 
-	import doctest
-	doctest.testmod()
+        import doctest
+        doctest.testmod()
 
 if __name__ == "__main__": 
    _test() 
 
 if __name__ == '__main__': 
         charakter = Charakter()
-        print 'Name:', charakter.name
-        print 'Art:', charakter.art
-        print '\nID:'
+        print('Name:', charakter.name)
+        print('Art:', charakter.art)
+        print('\nID:')
         for i in charakter.ID: 
-            print '-', i + ':', charakter.ID[i]
+            print('-', i + ':', charakter.ID[i])
         #print 'Objekt:', charakter.objekt
         #print 'Charakter:', charakter.charakter
         #print 'Grunddaten:', charakter.grunddaten
         #print 'Werte:', charakter.werte
-        print '\nEigenschaften:'
+        print('\nEigenschaften:')
         for i in charakter.eigenschaften: 
-            print '-', i + ':', charakter.eigenschaften[i]
-        print '\nFertigkeiten:'
+            print('-', i + ':', charakter.eigenschaften[i])
+        print('\nFertigkeiten:')
         for i in charakter.fertigkeiten: 
-            print '-', i + ':', charakter.fertigkeiten[i]
-        print '\nKampfwerte:'
+            print('-', i + ':', charakter.fertigkeiten[i])
+        print('\nKampfwerte:')
         for i in charakter.kampfwerte: 
-            print '-', i + ':', charakter.kampfwerte[i]
-        print '- Schutz:', charakter.schutz
-        print '\nBeschreibung:', charakter.beschreibung
-        print 'Herkunft:', charakter.herkunft
-        print 'Sprache:', charakter.sprache
-        print 'Region:', charakter.region
-        print 'Stimmung:', charakter.stimmung
-        print 'Kategorie:', charakter.kategorie
+            print('-', i + ':', charakter.kampfwerte[i])
+        print('- Schutz:', charakter.schutz)
+        print('\nBeschreibung:', charakter.beschreibung)
+        print('Herkunft:', charakter.herkunft)
+        print('Sprache:', charakter.sprache)
+        print('Region:', charakter.region)
+        print('Stimmung:', charakter.stimmung)
+        print('Kategorie:', charakter.kategorie)
         
         # Test saving
         # First change the Beschreibung
         charakter.beschreibung += ". Zusatz 1."
-        print charakter.charakter
+        print(charakter.charakter)
         # Save the character with an incremented minor version
         charakter.save()
 

rpg_lib/textrpg_1d6/amov/Lokalisierung.py

 ### Imports ###
 
 # Und um Grundfunktionen zu bieten, nutzen wir Object
-import Object
+from . import Object
 
 ### Imports ###
 
 ### Klassen ###
 
 class Lokalisierung(Object.Object): 
-    def __init__(self, ID=None, art=None,  tag=u"tag:1w6.org,2008:de_DE", kategorie="Text", *args, **kwds): 
+    def __init__(self, ID=None, art=None,  tag="tag:1w6.org,2008:de_DE", kategorie="Text", *args, **kwds): 
         """Lokalisierung des Skriptes"""
         super(Lokalisierung, self).__init__(ID=ID, art=art, tag=tag, kategorie=kategorie, *args, **kwds)
         #: Das Charakterwörterbuch mit allen Charakterdaten aus der Datei. 
 if __name__ == '__main__': 
         
         locale = Lokalisierung()
-        print locale.locale
+        print(locale.locale)
         locale.save()
 
 ### Self-Test ###

rpg_lib/textrpg_1d6/amov/Namensgrammatik.py

     from yaml import load as yaml_load
 
 # Um die Dateien zu laden, nutzen wir die Objekt-Klasse. 
-import Skripte.Kernskripte.Objekt as Objekt
+from .Skripte.Kernskripte import Objekt
 
 # Außerdem brauchen wir die Versionsverwaltung.
-import Versionsverwaltung
+from .Versionsverwaltung import Versionen
 
 ### Imports ###
 
         if ID != None: 
             self.ID = ID
         else: 
-            versionen = Versionsverwaltung.Versionen(tag=tag,kategorie=u"Namensgrammatiken")
+            versionen = Versionen(tag=tag,kategorie="Namensgrammatiken")
             self.ID = versionen.neuste
         #: The kind of name we want to generate. This isn't used yet.
         self.art = art
     #: Das Grammatikobjekt 
     grammar = Grammar()
     # Dann geben wir dei Grammatik aus. 
-    print grammar.grammar
+    print(grammar.grammar)
     # Danach testen wir das Modul mittels Docstrings. (Infos im pydoc String am Anfang der Datei)
     # Dafür holen wir uns das doctest modul. 
     import doctest

rpg_lib/textrpg_1d6/amov/Object.py

     from yaml import load as yaml_load
 
 # Um die Dateien zu laden, nutzen wir die Objekt-Klasse. 
-import Skripte.Kernskripte.Objekt as Objekt
+from .Skripte.Kernskripte import Objekt
 
 # Um immer die neuste Version zu haben brauchen wir die Versionsverwaltung
-from Versionsverwaltung import Versionen
+from .Versionsverwaltung import Versionen
 
 ### Imports ###
 
 ### Klassen ###
 
 class Object(object): 
-    def __init__(self, ID=None, art=None,  tag=u"tag:1w6.org,2008:de_DE", kategorie="locales", *arg, **kwds): 
+    def __init__(self, ID=None, art=None,  tag="tag:1w6.org,2008:de_DE", kategorie="locales", *arg, **kwds): 
         #: Der Identifikator der Charakter-Datei
         if ID is not None: 
             self.ID = ID
             versionen = Versionen(tag=tag,  kategorie=kategorie)
             self.ID = versionen.neuste
         # Get the name of the loaded char or template
-        self.tagname = self.ID[_(u"ID")][self.ID[_(u"ID")].index(":", 4) + 1:]
-        self.tagstring = self.ID[_(u"ID")]
-        self.tagstring_without_name = self.ID[_(u"ID")][:self.ID[_(u"ID")].index(":", 4) + 1]
+        self.tagname = self.ID[_("ID")][self.ID[_("ID")].index(":", 4) + 1:]
+        self.tagstring = self.ID[_("ID")]
+        self.tagstring_without_name = self.ID[_("ID")][:self.ID[_("ID")].index(":", 4) + 1]
         #: Die Art der locale. Wird noch nicht verwendet. 
         self.art = art
         #: Das Charakterobjekt. Es bietet das dict und ein paar Methoden. 
         """Lade den Namen des Charakters. 
         
         Wenn der Charakter keinen Namen hat, dann erzeuge einen zufälligen."""
-        try: name = self.self.daten[_(u"Name")]
+        try: name = self.self.daten[_("Name")]
         except: 
-            self.daten[_(u"Name")] = self.tagname
+            self.daten[_("Name")] = self.tagname
             name = self.tagname
         return name
     
             # change the tag-line. 
             # if name was given, use it. comparing to None is the fastest, so we do that first. 
             if name is not None: 
-                self.ID[_(u"ID")] = self.ID[_(u"ID")][:self.ID[_(u"ID")].index(":", 4) + 1] + name
+                self.ID[_("ID")] = self.ID[_("ID")][:self.ID[_("ID")].index(":", 4) + 1] + name
             else: # name is None, self.name doesn't equal tagname
-                self.ID[_(u"ID")] = self.ID[_(u"ID")][:self.ID[_(u"ID")].index(":", 4) + 1] + self.name
+                self.ID[_("ID")] = self.ID[_("ID")][:self.ID[_("ID")].index(":", 4) + 1] + self.name
         
         # Now the tagline in the ID changed. 
         
         # First get the new ID
         # self.ID ist die alte ID
         # Use Versionsverwaltung to get a version object
-        versionen = Versionen(tag=self.ID[_(u"ID")], kategorie=self.ID[_(u"Kategorie")])
+        versionen = Versionen(tag=self.ID[_("ID")], kategorie=self.ID[_("Kategorie")])
         # Now call the version object to get the ID with a version which is increased by one. 
         self.ID = versionen.version_minor_eins_hoeher()
         

rpg_lib/textrpg_1d6/amov/Schlacht.py

 import Skripte.Kernskripte.Objekt as Objekt
 
 # Um immer die neuste Version zu haben brauchen wir die Versionsverwaltung
-from Versionsverwaltung import Versionen
+from .Versionsverwaltung import Versionen
 
 ### Imports ###
 
 ### Klassen ###
 
 class Schlacht: 
-    def __init__(self, ID=None, art=None,  tag=u"tag:1w6.org,2008:Menschen_gegen_Goblins",  data=None): 
+    def __init__(self, ID=None, art=None,  tag="tag:1w6.org,2008:Menschen_gegen_Goblins",  data=None): 
         # TODO: erstelle eine Grundklasse, die die laden-methode liefert. Diese Grundklasse sollte auch den parameter ketegorie haben, so dass sie auch __init__ komplett übernehmen kann. 
         #: Der Identifikator der Armee-Datei
         if ID is not None: 
             self.ID = ID
         elif tag is not None: 
             # Wenn keine ID bekannt ist, lade die neuste Datei
-            versionen = Versionen(tag=tag,  kategorie=u"Schlachten")
+            versionen = Versionen(tag=tag,  kategorie="Schlachten")
             self.ID = versionen.neuste
         #: Die Art. Wird noch nicht verwendet. 
         self.art = art

rpg_lib/textrpg_1d6/amov/Skripte/Kernskripte/Objekt.py

 
 # Für die Übersetzung von IDs in Dateinamen brauchen wir noch tag_zu_datei
 
-from ein_und_ausgabe import tag_zu_datei
+from .ein_und_ausgabe import tag_zu_datei
 
 # Um Charaktere per Kommandozeile übergeben zu können brauchen wir sys
 import sys
 
 if __name__ == '__main__': 
     objekt = Objekt()
-    print objekt
-    print objekt.yaml()
+    print(objekt)
+    print(objekt.yaml())

rpg_lib/textrpg_1d6/amov/Skripte/Kernskripte/ein_und_ausgabe/tag_zu_datei.py

                 # Um Fehler auszuschließen, prüfen wir noch, ob mehr als ein Komma im tag vorkommt. TODO: Sauber schreiben! 
                 anzahl_der_kommata = zwischenstring.count( ',' )
                 if anzahl_der_kommata > 1: 
-                        print 'Meldung: Mehr als ein Komma im Tag! Prüfen!'
+                        print('Meldung: Mehr als ein Komma im Tag! Prüfen!')
                 else: #print 'Meldung: Nur ein Komma im Tag. Alles OK'
                     pass 
                 # Jetzt definieren wir uns die Funktion, 
 from os.path import join
 
 # Wir brauchen noch den Nutzerordner. 
-from user import home
+from os.path import expanduser
 
-BASISORDNER = home
+BASISORDNER = expanduser("~")
 
 TRENNER_ORDNER = '/'
 TRENNER_VERSION = '-'
 
 if __name__ == "__main__": 
     datei = Datei(tag="tag:1w6.org,2007:Menschen", kategorie="Vorlagen", version="0.1")
-    print datei.dateiname_ausgeben()
-    print datei.dateiname_ohne_version_mit_trenner()
-    print datei.dateiname_ohne_version()
+    print(datei.dateiname_ausgeben())
+    print(datei.dateiname_ohne_version_mit_trenner())
+    print(datei.dateiname_ohne_version())
 
 
 # Als Eingabe erhalten wir eine tag-ID im Format

rpg_lib/textrpg_1d6/amov/Skripte/Kernskripte/ein_und_ausgabe/tag_zu_datei_von_tag.py

 #    59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             #
 ############################################################################
 
-import tag_zu_objekt
+from .tag_zu_objekt import tag_zu_objekt
 
 TRENNER_ORDNER = '/'
 TRENNER_VERSION = '-'
         self.tag = tag
         self.kategorie = kategorie
         self.version = version
-        self.tag_zum_objekt = tag_zu_objekt.tag_zu_objekt(self.tag)
+        self.tag_zum_objekt = tag_zu_objekt(self.tag)
         self.tag_objekt = self.tag_zum_objekt.tag_objekt()
 
     def dateipfad(self): 
 
 if __name__ == "__main__": 
     datei = Datei(tag="tag:1w6.org,2007:Menschen", kategorie="Vorlagen", version="0.1")
-    print datei.dateiname_ausgeben()
-    print datei.dateiname_ohne_version_mit_trenner()
-    print datei.dateiname_ohne_version()
+    print(datei.dateiname_ausgeben())
+    print(datei.dateiname_ohne_version_mit_trenner())
+    print(datei.dateiname_ohne_version())

rpg_lib/textrpg_1d6/amov/Skripte/Kernskripte/ein_und_ausgabe/tag_zu_objekt.py

                 # Um Fehler auszuschließen, prüfen wir noch, ob mehr als ein Komma im tag vorkommt. TODO: Sauber schreiben! 
                 anzahl_der_kommata = zwischenstring.count( ',' )
                 if anzahl_der_kommata > 1: 
-                        print 'Meldung: Mehr als ein Komma im Tag! Prüfen!'
+                        print('Meldung: Mehr als ein Komma im Tag! Prüfen!')
                 else: #print 'Meldung: Nur ein Komma im Tag. Alles OK'
                     pass 
                 # Jetzt definieren wir uns die Funktion, 

rpg_lib/textrpg_1d6/amov/Versionsverwaltung.py

 import os
 
 # Um die Dateien zu laden, nutzen wir die Objekt-Klasse. 
-import Skripte.Kernskripte.ein_und_ausgabe.tag_zu_datei_von_tag as tag_zu_datei
+from .Skripte.Kernskripte.ein_und_ausgabe import tag_zu_datei_von_tag as tag_zu_datei
 # Außerdem müssen wir Pfade Plattformunabhängig verbinden können. 
 from os.path import join
 
-from Skripte.Kernskripte.ein_und_ausgabe.tag_zu_datei_von_tag import BASISORDNER
+from .Skripte.Kernskripte.ein_und_ausgabe.tag_zu_datei import BASISORDNER
 
 #### Imports ####
 
     """Manage Versions. 
     
     ToDo: Rewrite, so that data about the file-path is taken from an ID object again (self.finde_neuste_datei())."""
-    def __init__(self, tag=u"tag:1w6.org,2007:Menschen", kategorie=u"Armeen", speicherordner_rel_zu_home = ".amov"): 
+    def __init__(self, tag="tag:1w6.org,2007:Menschen", kategorie="Armeen", speicherordner_rel_zu_home = ".amov"): 
         #: the unique identifier for content, barring the cathegory. 
         self.tag = tag 
         #: The type of objekt we want to retrieve. 
         """return the most recent version in an ID dict."""
         #: The ID dict
         ID = {}
-        ID[u"ID"] = self.tag
-        ID[u"Kategorie"] = self.kategorie
+        ID["ID"] = self.tag
+        ID["Kategorie"] = self.kategorie
         neuste_datei = self.lade_neuste_datei()
         # Set the range we found in the version-part of the filename as version. If no file exists yet, use Version 0.0
         if neuste_datei: 
-            ID[u"Version"] = self.version_von_pfad(neuste_datei)
+            ID["Version"] = self.version_von_pfad(neuste_datei)
         else: 
-            ID[u"Version"] = 0.0
+            ID["Version"] = 0.0
         return ID
         
     def version_minor_eins_hoeher(self): 
         # First get the most recent ID
         ID = self.neuste_version()
         # Then get the version
-        version = ID[u"Version"]
+        version = ID["Version"]
         # Now get the major and minor version
         hauptvers = self.hauptversion(version)
         untervers = self.unterversion(version)
         # construct the version again
         version = str(hauptvers) + "." + str(untervers)
         # And change the ID
-        ID[u"Version"] = version
+        ID["Version"] = version
         # And return it. 
         return ID
         
     
     def is_number(self, i): 
         """Test if the provided char/string/int is a number."""
-        for j in str(range(10)): 
+        for j in str(list(range(10))): 
             if i == j: 
                 return True
         return False
 if __name__ == "__main__": 
     from rpg_lib.yaml import dump
     versionen = Versionen()
-    print "Datei:", versionen.neuste_datei
-    print "ID:\n", dump(versionen.neuste, default_flow_style=False)
+    print("Datei:", versionen.neuste_datei)
+    print("ID:\n", dump(versionen.neuste, default_flow_style=False))
 
 #### Self-Test ####

rpg_lib/textrpg_1d6/amov/charakterverwaltung.py

 ### Imports ###
 
 # Wir brauchen die Klasse Charakter
-import Charakter
+from . import Charakter
 
 # Für die Übersetzung von IDs in Dateinamen brauchen wir noch tag_zu_datei
 from Skripte.Kernskripte.ein_und_ausgabe import tag_zu_datei
 import sys
 
 # Außerdem Wollen wir einfach die neuste Version anfragen können. 
-import Versionsverwaltung
+from . import Versionsverwaltung
 
 
 ### Imports ###
 
 class Verwaltung: 
     """Manage Data-Objects. Input are the tag and the Kategorie."""
-    def __init__(self, tag=u"tag:draketo.de,2007:Sskreszta", kategorie=u"Charaktere"): 
+    def __init__(self, tag="tag:draketo.de,2007:Sskreszta", kategorie="Charaktere"): 
         self.tag = tag
         self.kategorie = kategorie
         #: the ID of the most recent Version. 
     def neuste_version(self): 
         """return the ID of the most recent Version."""
         versionsverwaltung = Versionsverwaltung
-        versionen = versionsverwaltung.Versionen(tag=tag, kategorie=u"Charaktere")
+        versionen = versionsverwaltung.Versionen(tag=tag, kategorie="Charaktere")
         ID = versionen.neuste #: The ID to retrieve the file.
         return ID
 
     Version = sys.argv[3]
     
     yaml_id = "ID: tag:" + URL + "," + Jahr + ":" + Name + "\n" + "Version: " + Version + "\n" + "Kategorie: " + Kategorie
-    print yaml_id
+    print(yaml_id)
     tag = "tag:" + URL + "," + Jahr + ":" + Name
-    print tag
+    print(tag)
 except: 
-    print "Keine Kommandozeilenargumente. Verwende Standard: Sskreszta"
+    print("Keine Kommandozeilenargumente. Verwende Standard: Sskreszta")
     yaml_id = """ID: tag:draketo.de,2007:Sskreszta
 Version: 0.15
 Kategorie: Charaktere
 ### Testen ### 
 
 
-verwaltung = Verwaltung(tag, u"Charaktere")
+verwaltung = Verwaltung(tag, "Charaktere")
 
 ID = verwaltung.neuste_version
 
 
 charakter = Charakter.Charakter(ID)
 
-print u'Wir haben den/die', charakter.kategorie, u'"' + charakter.name + u'" gelesen.'
+print('Wir haben den/die', charakter.kategorie, '"' + charakter.name + '" gelesen.')
 
 char_kampfwerte = charakter.kampfwerte
 
-print "Für das Schlachtfeld: ", char_kampfwerte
+print("Für das Schlachtfeld: ", char_kampfwerte)
 
 try: 
     for wert in char_kampfwerte: 
-        print wert + ":", char_kampfwerte[wert]
+        print(wert + ":", char_kampfwerte[wert])
     
-    char_hauptwaffe = char_kampfwerte[u"Hauptwaffe"]
-    print "\nHauptwaffe:"
-    for wert in char_hauptwaffe[u"Waffe"]: 
-        print wert + ":", char_hauptwaffe[u"Waffe"][wert]
+    char_hauptwaffe = char_kampfwerte["Hauptwaffe"]
+    print("\nHauptwaffe:")
+    for wert in char_hauptwaffe["Waffe"]: 
+        print(wert + ":", char_hauptwaffe["Waffe"][wert])
     
-    char_kampffertigkeit = char_hauptwaffe[u"Kampffertigkeit"]
+    char_kampffertigkeit = char_hauptwaffe["Kampffertigkeit"]
     
-    print u"Kampffertigkeit:", char_kampffertigkeit[u"Zahlenwert"]
+    print("Kampffertigkeit:", char_kampffertigkeit["Zahlenwert"])
 except: 
-    print "Keine Kampfwerte"
+    print("Keine Kampfwerte")
 
 ### Testen ###
 

rpg_lib/textrpg_1d6/char.py

 import sys
 
 # EWS standard dice
-import pmw6
+from .pmw6 import pmw6, open_check, open_check_with_result, value_and_striche_eigenschaften, value_and_striche_fertigkeiten
+from .pmw6 import check as pmw6_check
 
 # Name-Generator
-import namen
+from .namen import Name
 
 # Obtain Charakters from yaml-files
-from amov import Charakter, Versionsverwaltung
-from amov.Object import _
+from .amov import Charakter, Versionsverwaltung
+from .amov.Object import _
 # replaced the alias with the real directory. 
 
 #### IMPORTS ####
 
 verbose = False #: Print output for debugging?
 
-name_objekt = namen.Name()
+name_objekt = Name()
 
 # scatter for random attack values
 atscatter = [3,2,1]
 
 def ews():
     """Do one roll with the plusminus d6 die (wrapper for a function in pmw6)."""
-    return pmw6.pmw6()
+    return pmw6()
 
 def check(skill,MW):
     """Check if a given skill test reached a min-value (wrapper for a function in pmw6)."""
-    return pmw6.check(skill,MW)
+    return pmw6_check(skill,MW)
 
 def ocheck(skill,MW):
     """Return the degree of success / failure for a skill check (wrapper for a function in pmw6)."""
-    return pmw6.open_check(skill,MW)
+    return open_check(skill,MW)
 
 def ocheck_and_res(skill,  MW):
     """Return the degree of success / failure for a skill check plus the reached value (wrapper for a function in pmw6)."""
-    return pmw6.open_check_with_result(skill,MW)
+    return open_check_with_result(skill,MW)
 
 
 def name_it(language=_("Esperanto")):
         
         # creation from amov template/char
         self.source = source
-        self.ID = Versionsverwaltung.Versionen(self.source, _(u"Vorlagen")).neuste
+        self.ID = Versionsverwaltung.Versionen(self.source, _("Vorlagen")).neuste
         self.amov = Charakter.Charakter(self.ID)
         
         # rank
         # Make sure that we have a wounds dict
         self.amov.kampfwerte.setdefault(_("Wunden"), {})
         # Get the physical wounds, if None are set, they are 0 each. 
-        self.wounds = [self.amov.kampfwerte[_("Wunden")].setdefault(_(u'körperlich tief'), 0), self.amov.kampfwerte[_("Wunden")].setdefault(_(u'körperlich kritisch'), 0)] #: deep wounds, critical wounds
+        self.wounds = [self.amov.kampfwerte[_("Wunden")].setdefault(_('körperlich tief'), 0), self.amov.kampfwerte[_("Wunden")].setdefault(_('körperlich kritisch'), 0)] #: deep wounds, critical wounds
         # print self.wounds
         
         # Get the experience, either from the char, if it has it, or calculate it from all other values.
         self.fight_skill = self.amov.kampfwerte[_("Hauptwaffe")][_("Kampffertigkeit")]
         
         #: The current armor of the char
-        self.armor = self.amov.kampfwerte[_(u"Hauptrüstung")]
+        self.armor = self.amov.kampfwerte[_("Hauptrüstung")]
         
         
         # Get the morale
         # And the current TP
         self.amov.kampfwerte[_('Aktuelle Trefferpunkte')] = self.TP
         # Also the wounds, deep and critical
-        self.amov.kampfwerte[_('Wunden')][_(u"körperlich tief")] = int(self.wounds[0])
-        self.amov.kampfwerte[_('Wunden')][_(u"körperlich kritisch")] = int(self.wounds[1])
+        self.amov.kampfwerte[_('Wunden')][_("körperlich tief")] = int(self.wounds[0])
+        self.amov.kampfwerte[_('Wunden')][_("körperlich kritisch")] = int(self.wounds[1])
         # Save experience
         self.amov.ladeGrunddaten()[_("Striche")] = self.exp
         
                 self.active = False
             else:
                 # else it checks, if it can still stand. 
-		# The first two KO checks are against 12, the others get consecutively harder.
-		if self.number_of_ko_checks == 0:
-	                self.active = check(value, MW=12)
-		else: 
-                	self.active = check(value, MW=(12 + 3*(self.number_of_ko_checks -1)))
-			# these are deadly if missed.
-			if not self.active:
-				self.die()
+                # The first two KO checks are against 12, the others get consecutively harder.
+                if self.number_of_ko_checks == 0:
+                        self.active = check(value, MW=12)
+                else: 
+                        self.active = check(value, MW=(12 + 3*(self.number_of_ko_checks -1)))
+                        # these are deadly if missed.
+                        if not self.active:
+                                self.die()
         
         # In any case, if the TP fall below 4 times the base attribute, or he got more than 18 wounds, he dies. 
         if self.TP < -4*self.WS[1] or (self.wounds[0] + 3*self.wounds[1]) > 18: 
         """Get the effective value for tests. 
         
         This doesn't take wounds into account, as they are already taken account in the method self.check()."""
-        if skill_name in self.skills.keys(): 
+        if skill_name in list(self.skills.keys()): 
             return self.skills[skill_name][_("Zahlenwert")]
         # If the skill doesn't exist in Fertigkeiten, see if we can do the check on some related skill, but with a malus of 3. 
         # TODO: Implement Jobs and background. 
         else: 
             for i in related_skills: 
-                if i in self.skills.keys(): 
+                if i in list(self.skills.keys()): 
                     return self.skills[i][_("Zahlenwert")] - 3
         # If the char has no skills, see if we can check against a related attribute, but with a malus of 9. 
         for i in related_attributes: 
-            if i in self.attributes.keys() and self.attributes[i][_("Zahlenwert")] >= 12: 
+            if i in list(self.attributes.keys()) and self.attributes[i][_("Zahlenwert")] >= 12: 
                 return self.attributes[i][_("Zahlenwert")] - 9
         # If the char has no fitting attributes or skills, just use the default attribute of 12. 
         return 12 - 9
         might = 0
         # Add all Striche of the Eigenschaften to the might
         if self.amov.eigenschaften != " ": 
-            for i in self.amov.eigenschaften.keys(): 
+            for i in list(self.amov.eigenschaften.keys()): 
                 might += self.amov.eigenschaften[i].setdefault("Striche",  self.get_necessary_striche_for_obj({i: self.amov.eigenschaften[i]}))
         # Now add all Striche of the Fertigkeiten to the might
         if self.amov.fertigkeiten != " ": 
-            for i in self.amov.fertigkeiten.keys(): 
+            for i in list(self.amov.fertigkeiten.keys()): 
                 might += self.amov.fertigkeiten[i].setdefault("Striche",  self.get_necessary_striche_for_obj({i: self.amov.fertigkeiten[i]}))
         if might == 0: 
             if second_run: 
-                print self.amov.eigenschaften,  self.amov.fertigkeiten
+                print(self.amov.eigenschaften,  self.amov.fertigkeiten)
                 raise ValueError("Char has no experience and can't do anything!")
             self.upgrade(0)
             return self.calculate_might(second_run=True)
             # If the char already has Eigenschaften, use a listing of Eigeschaften and Fertigkaietn as base for improvement. 
             if self.amov.eigenschaften != " " and self.amov.fertigkeiten != " ": 
                 #Add all Eigenschaften and Fertigkeiten to the listing. 
-                for i in self.amov.fertigkeiten.keys(): 
+                for i in list(self.amov.fertigkeiten.keys()): 
                     listing.append({i: self.amov.fertigkeiten[i]})
                 # Now add all Fertigkeiten to the listing. 
-                for i in self.amov.eigenschaften.keys(): 
+                for i in list(self.amov.eigenschaften.keys()): 
                     listing.append({i: self.amov.eigenschaften[i]})
             elif self.amov.fertigkeiten != " ": # Just use the list of existing Fertigkeiten. 
-                for i in self.amov.fertigkeiten.keys(): 
+                for i in list(self.amov.fertigkeiten.keys()): 
                     listing.append({i: self.amov.fertigkeiten[i]})
             elif self.amov.eigenschaften != " ": # Just use the list of existing Eigenschaften. 
-                for i in self.amov.eigenschaften.keys(): 
+                for i in list(self.amov.eigenschaften.keys()): 
                     listing.append({i: self.amov.eigenschaften[i]})
             else: 
                 raise ValueError("Char has no Eigenschaften an no Fertigkeiten!")
             else: listing = None
             # If the object is part of the Fertigkeiten or Eigenschaften, 
             # Set obj as the subtree of the listing dictrionary. 
-            if listing is not None and object[1] in listing.keys():
+            if listing is not None and object[1] in list(listing.keys()):
                 obj = {object: listing[object[1]]}
             else:
                 # add a new skill or attribute
                     self.amov.eigenschaften.setdefault(object[1], {})
                     obj = {object: self.amov.eigenschaften[object[1]] }
                 if verbose: # Provide some feedback: What kind of value was added, and which one. 
-                    print 'Added',  object[0],  object[1]
+                    print('Added',  object[0],  object[1])
 
                 
         elif object[0] == 'weighted':
             valuelist = []
             # Add all avaible Eigenschaften and Fertigkeiten as sub-dictionaries to the valuelist. 
             if self.amov.eigenschaften != " " and self.amov.fertigkeiten != " ": 
-                for i in self.amov.fertigkeiten.keys(): 
+                for i in list(self.amov.fertigkeiten.keys()): 
                     valuelist.append({(_("skill"), i ): self.amov.fertigkeiten[i]})
-                for i in self.amov.eigenschaften.keys(): 
+                for i in list(self.amov.eigenschaften.keys()): 
                     valuelist.append({(_("attribute"), i ): self.amov.eigenschaften[i]})
             elif self.amov.fertigkeiten != " ": # Just use the existing Fertigkeiten. 
-                for i in self.amov.fertigkeiten.keys(): 
+                for i in list(self.amov.fertigkeiten.keys()): 
                     valuelist.append({(_("skill"), i ): self.amov.fertigkeiten[i]})
             elif self.amov.eigenschaften != " ": # Just use the existing Eigenschaften. 
-                for i in self.amov.eigenschaften.keys(): 
+                for i in list(self.amov.eigenschaften.keys()): 
                     valuelist.append({(_("skill"), i): self.amov.eigenschaften[i]})
             else: 
                 raise ValueError("Char has no Eigenschaften and no Fertigkeiten!")
             # Get the biasing for each value by determining how many striche have already been spent without increasing it (+1). 
             # This gives a bias towards advancing higher values. 
             for i in valuelist: 
-                for j in i.keys():
+                for j in list(i.keys()):
                     #: The lowest number of Strichen needed to reach this value. 
                     necessary_striche = self.get_necessary_striche_for_obj(i)
                     #: Biasing determines, how much weight this value gets. 
                     biasing = 1 + i[j].get(_('Striche'),  necessary_striche) - necessary_striche
                     if biasing < 1: 
-                        print "Biasing < 1 ! ",  i,  "necessary_striche:",  necessary_striche
+                        print("Biasing < 1 ! ",  i,  "necessary_striche:",  necessary_striche)
                         raise ValueError("Biasing < 1 ! " + str(i) + " necessary_striche: " + str(necessary_striche))
                     weightlist.append((j,  biasing))
             
             selected = problist[int(dice)]
             #: The object contains the ability to be raised, only its content, not its name. 
             for i in valuelist: 
-                if i.has_key(selected): 
+                if selected in i: 
                     obj = i
             # Check if object is defined. 
             try: 
                     
         # Now we know which ability or attribute we want to raise. Say so: 
         if verbose: 
-            print self.name, "raised",  obj.keys()[0],  "with",  expadd,  "Strichen", 
+            print(self.name, "raised",  list(obj.keys())[0],  "with",  expadd,  "Strichen", end=' ') 
         # And save it for later use.
         obj_before = deepcopy(obj)
         
         # First get the value of the selected object. 
         # If it's a Fertigkeit, get the Grundwert. 
         if self.amov.fertigkeiten != " ": 
-            for i in self.amov.fertigkeiten.keys(): 
+            for i in list(self.amov.fertigkeiten.keys()): 
                 # Check if it has a skill key i
-                if obj.has_key((_("skill"), i)): 
+                if (_("skill"), i) in obj: 
                     sub_obj = obj[(_("skill"), i)]
                     val = sub_obj.setdefault(_("Grundwert"),  sub_obj.setdefault(_("Zahlenwert"),  3))
                     # all skills / attributes should have a 'Striche' item
     
         # If it's an attribute, get the Zahlenwert. 
         if self.amov.eigenschaften != " ": 
-            for i in self.amov.eigenschaften.keys(): 
-                if obj.has_key((_("attribute"), i)): 
+            for i in list(self.amov.eigenschaften.keys()): 
+                if (_("attribute"), i) in obj: 
                     sub_obj = obj[(_("attribute"), i)]
                     striche_old = sub_obj.setdefault(_("Striche"),  self.value_and_striche_eigenschaften(val=sub_obj.setdefault(_("Zahlenwert"),  12))[1])
                     sub_obj[_("Striche")] = striche_old + expadd
                     sub_obj[_("Zahlenwert")] = self.value_and_striche_eigenschaften(striche=sub_obj[_("Striche")])[0]
         
         if verbose: 
-            print "to",  obj # finishing upgrade line of output
+            print("to",  obj) # finishing upgrade line of output
         self.attack = self.amov.kampfwerte[_('Hauptwaffe')][_('Kampffertigkeit')][_('Zahlenwert')]
         return obj_before, obj
     
     def get_necessary_striche_for_obj(self,  obj):
         necessary_striche = 0
         if self.amov.fertigkeiten != " ": 
-            for i in self.amov.fertigkeiten.keys(): 
-                if obj.has_key(i): 
+            for i in list(self.amov.fertigkeiten.keys()): 
+                if i in obj: 
                     # Every Fertigkeit needs a Grundwert
                     obj = obj[i]
                     val = obj.setdefault(_("Grundwert"),  obj.setdefault(_("Zahlenwert"),  3))
                     striche = obj.setdefault(_("Striche"),  self.value_and_striche_fertigkeiten(val=obj.setdefault(_("Grundwert"),  3))[1])
                     necessary_striche = self.value_and_striche_fertigkeiten(val=obj.setdefault(_("Grundwert"),  3))[1]
         if self.amov.eigenschaften != " ": 
-            for i in self.amov.eigenschaften.keys(): 
-                if obj.has_key(i): 
+            for i in list(self.amov.eigenschaften.keys()): 
+                if i in obj: 
                     obj = obj[i]
                     striche = obj.setdefault(_("Striche"),  self.value_and_striche_eigenschaften(val=obj.setdefault(_("Zahlenwert"),  12))[1])
                     necessary_striche = self.value_and_striche_eigenschaften(val=obj.setdefault(_("Zahlenwert"),  12))[1]
     
     def value_and_striche_fertigkeiten(self,  val=None,  striche=None):
         """Return value and striche"""
-        return pmw6.value_and_striche_fertigkeiten(val=val, striche=striche)
+        return value_and_striche_fertigkeiten(val=val, striche=striche)
     
     
     def value_and_striche_eigenschaften(self,  val=None,  striche=None):
         """Return value and striche."""
-        return pmw6.value_and_striche_eigenschaften(val=val, striche=striche)
+        return value_and_striche_eigenschaften(val=val, striche=striche)
         
         
     def fight_round(self,  other, styles_self=[], styles_other=[]):
             deep_wounds_self, critical_wounds_self = self.damage(tp=self.damage_self)
 
         # If we get the same result, the attacker wins, us. 
-        else: 	
+        else:         
             won = True
             # Now check for damage (we hit)
             # The damage consists of several factors. 
             
             # Now actually do the damage. This returns a tuple: (new deep wounds, new critical wounds)
             deep_wounds_other, critical_wounds_other = other.damage(tp=self.damage_other)
-        	
+                
         return won, [deep_wounds_self, critical_wounds_self, self.damage_self], [deep_wounds_other, critical_wounds_other, self.damage_other]
 
 
             self.damage(0,3,0)
             other.damage(0,3,0)
             if verbose: 
-                print "Both are still standing but wounded (or dead) - none won the battle."
+                print("Both are still standing but wounded (or dead) - none won the battle.")
             # We don't need to check anything else. 
             return 
         else:
             winner = max(3-res/3, 0)
             loser = max(3+res/3, 0)
             if verbose:
-                print winnerc.name, "won against", loserc.name
+                print(winnerc.name, "won against", loserc.name)
             
             # Then let the winner take damage
             winnerc.damage(0,winner,0)
             if verbose: 
-                print winnerc.name, "takes", winner, "wounds." 
+                print(winnerc.name, "takes", winner, "wounds.") 
             
             # And let the loser take damage    
             loserc.damage(0,loser,0)
             loserc.active = False
             
             if verbose: 
-                print loserc.name, "takes", loser, "wounds."
+                print(loserc.name, "takes", loser, "wounds.")
             
 
     def get_battle_result_values(self): 
     _test()
     katt = Char(template=False)
     katt.amov.eigenschaften = {"Eleganz": {"Zahlenwert": 12}}
-    print "Before Upgrade"
-    print katt.amov.fertigkeiten
-    print katt.amov.eigenschaften
-    print "Add  3 dashes"
+    print("Before Upgrade")
+    print(katt.amov.fertigkeiten)
+    print(katt.amov.eigenschaften)
+    print("Add  3 dashes")
     katt.upgrade(3)
-    print "After Upgrade"
-    print katt.amov.fertigkeiten
-    print katt.amov.eigenschaften
-    print "Saving char."
+    print("After Upgrade")
+    print(katt.amov.fertigkeiten)
+    print(katt.amov.eigenschaften)
+    print("Saving char.")
     katt.save()
 #### Self-Test ####

rpg_lib/textrpg_1d6/fight.py

     #for i in range(2):
         #char = Char()
         #chars.append(char)
-    print "Characters:\n", chars
-    print "\nStarting the fight:"
+    print("Characters:\n", chars)
+    print("\nStarting the fight:")
     fight(chars)
     
 

rpg_lib/textrpg_1d6/locale.py

 if __name__ == "__main__": 
     _test()
     locale = Locale()
-    print locale.locale
+    print(locale.locale)
     
 #### Self-Test ####

rpg_lib/textrpg_1d6/namegen/pycfnamegen/cfnamegen.py

         """
         if not isinstance(nameGrammar, dict):
             raise GrammarError("Grammar data is not a dictionary!")
-        for rule, rhs in nameGrammar.items():
+        for rule, rhs in list(nameGrammar.items()):
             if not isinstance(rhs, list):
                 raise GrammarError("Rule \"%s\" is not a list!" % rule)
             for option in rhs:
         expanded.  Undefined non-terminals can lead to ugly error messages
         instead of beautifully generated names.
         """
-        for rule, rhs in nameGrammar.items():
+        for rule, rhs in list(nameGrammar.items()):
             for option in rhs:
                 tempStr = option
                 matchNonTerminal = self.reNonTerminal.search(tempStr)
                 return a
             return recurse(a+1)
 
-        grammarUnchecked = dict([(rule, "".join(rhs)) for (rule, rhs) in nameGrammar.items()])
+        grammarUnchecked = dict([(rule, "".join(rhs)) for (rule, rhs) in list(nameGrammar.items())])
         grammarProductive = []
         finished = False
         while not finished:
-            print "grammarProductive:"
-            print grammarProductive
-            print "grammarUnchecked:"
-            print grammarUnchecked
-            print
+            print("grammarProductive:")
+            print(grammarProductive)
+            print("grammarUnchecked:")
+            print(grammarUnchecked)
+            print()
             finished = True
-            for rule, rhs in grammarUnchecked.items():
+            for rule, rhs in list(grammarUnchecked.items()):
                 matchNonTerminal = reNonTerminal.search(rhs)
                 while matchNonTerminal:
                     matchString = matchNonTerminal.group(1)
         "neVowel": ["e", "i", "a", "au"]
         }
 
-    print "Ork Grammar:", yaml.dump(orkGrammar)
-    print "Foo Grammar:", yaml.dump(fooGrammar)
+    print("Ork Grammar:", yaml.dump(orkGrammar))
+    print("Foo Grammar:", yaml.dump(fooGrammar))
     fooGen = CFNameGen(fooGrammar)
     errorStr = fooGen.verifyGrammar()
     if errorStr:
         sys.exit(errorStr)
-    print fooGen.getName()
+    print(fooGen.getName())
 
     orkGen = CFNameGen(orkGrammar)
     errorStr = orkGen.verifyGrammar()
     if errorStr:
         sys.exit(errorStr)
-    print orkGen.getName()
+    print(orkGen.getName())

rpg_lib/textrpg_1d6/namen.py

 
 #### Imports ####
 
-import random_phonetic_name_generator_von_Pointon.random_phonetic_name_generator as phonetic_gen
+from .random_phonetic_name_generator_von_Pointon import random_phonetic_name_generator as phonetic_gen
 
-import yould.yould as yould
+from .yould import yould
 
 # Get os for reading the path to the sourcefile.
 from os.path import join,  dirname
 
-import namegen.pycfnamegen.cfnamegen as cfnamegen
+from .namegen.pycfnamegen import cfnamegen
 
 # Obtain Grammars from yaml-files
-from amov import Namensgrammatik, Versionsverwaltung
+from .amov import Namensgrammatik, Versionsverwaltung
 
 
 #### Imports ####
 #### Self-Test ####
 
 if __name__ == "__main__": 
-    print "Erzeuge Esperanto-Namen mit yould"
+    print("Erzeuge Esperanto-Namen mit yould")
     name = Name(anzahl=20,  quelle="yould")
     namen = name.erzeuge()
     for i in namen: 
-        print i
-    print "\nErzeuge Englische Namen mit yould"
+        print(i)
+    print("\nErzeuge Englische Namen mit yould")
     name = Name(anzahl=20,  quelle="yould", art="Englisch")
     namen = name.erzeuge()
     for i in namen: 
-        print i
-    print "\nErzeuge erotische Namen mit yould"
+        print(i)
+    print("\nErzeuge erotische Namen mit yould")
     name = Name(anzahl=20,  quelle="yould", art="Martin Luther")
     namen = name.erzeuge()
     for i in namen: 
-        print i
-    print "\nErzeuge die Namen mit pointon"
+        print(i)
+    print("\nErzeuge die Namen mit pointon")
     name = Name(anzahl=20,  quelle="pointon_phonetic")
     namen = name.erzeuge()
     for i in namen: 
-        print i
-    print "\nErzeuge die Namen mit cfnamegen"
+        print(i)
+    print("\nErzeuge die Namen mit cfnamegen")
     name = Name(anzahl=20,  quelle="cfnamegen")
     namen = name.erzeuge()
     for i in namen: 
-        print i
+        print(i)
 
 #### Self-Test ####

rpg_lib/textrpg_1d6/pmw6.py

         store = []
         for i in range(100000):
                 store.append(pmw6())
-        print 'min max'
-        print min(store), max(store)
+        print('min max')
+        print(min(store), max(store))
 #### SELF CHECK ####

rpg_lib/textrpg_1d6/yould/dl-kjb.py

 for book in BOOKS:
     try:
         data = urlopen(MAIN_URL % book).read(MAX)
-        print "Book:", book
+        print("Book:", book)
         dl = DL_PAT.findall(data)[0]
-        print 'File to download:', dl
+        print('File to download:', dl)
         path = "training_materials/gutenberg_downloads/" + PATH + "/%04d.txt" % book
-        print "Local Path:", path
+        print("Local Path:", path)
         stream = urlopen(BASE_URL + dl)
         open(path, "w").write(stream.read(MAX))
     except:
-        print "Error"
+        print("Error")
     

rpg_lib/textrpg_1d6/yould/yould-0.1.py

 
 if __name__ == "__main__":
     if len(sys.argv) != 6:
-        print "USAGE: %s PROBS MIN_L MAX_L NB_W NB_D" % sys.argv[0]
-        print "  PROBS is the language transition table"
-        print "  MIN_L is the minimum desired word length"
-        print "  MAX_L is the maximum desired word length"
-        print "  NB_W  is the number of words to generate"
-        print "  NB_D  is the number of free domain required (0 to 4)"
+        print("USAGE: %s PROBS MIN_L MAX_L NB_W NB_D" % sys.argv[0])
+        print("  PROBS is the language transition table")
+        print("  MIN_L is the minimum desired word length")
+        print("  MAX_L is the maximum desired word length")
+        print("  NB_W  is the number of words to generate")
+        print("  NB_D  is the number of free domain required (0 to 4)")
         sys.exit(1)
     tr3_prob = eval(open(sys.argv[1]).read())
     min_l = int(sys.argv[2])
                and name not in tried \
                and name3_prob(tr3_prob, name) > 0.000000025 \
                and min_nb_doms_p(name, nb_d):
-            print "%.010f: %s" % (name3_prob(tr3_prob, name), name)
+            print("%.010f: %s" % (name3_prob(tr3_prob, name), name))
             names.append(name)
         tried.add(name)
 
     #for prob, name in sorted([(name3_prob(tr3_prob, name), name)
     #                          for name in names]):
     #    print "%.010f: %s" % (name3_prob(tr3_prob, name), name)
-    print "tried", len(tried), "names"
-    print ", ".join(sorted(names))
+    print("tried", len(tried), "names")
+    print(", ".join(sorted(names)))
     

rpg_lib/textrpg_1d6/yould/yould-train.py

     # build prob tables
     # ex: trs_prob[('c', 'r')] = [(.1, 'e'), (.07, 'a'),...,(.001, 'z')]
     tr3_prob = {}
-    for k in tr3_freq.keys():
+    for k in list(tr3_freq.keys()):
         nb_trs, trs_h = tr3_freq[k]
         tr3_prob[k] = [ (1.0*freq/nb_trs, nc)
-                        for nc, freq in trs_h.items()]
+                        for nc, freq in list(trs_h.items())]
         tr3_prob[k].sort()
         tr3_prob[k].reverse()
 

rpg_lib/textrpg_1d6/yould/yould.py

     prob = 1.0
     pprev = prev = None
     for c in name:
-        prob *= filter(lambda rec:rec[1] == c,
-                       tr3_prob[(pprev, prev)])[0][0]
+        prob *= list(filter(lambda rec:rec[1] == c,
+                       tr3_prob[(pprev, prev)]))[0][0]
         pprev = prev
         prev = c
-    return prob * filter(lambda rec:rec[1] == None,
-                         tr3_prob[(pprev, prev)])[0][0]
+    return prob * list(filter(lambda rec:rec[1] == None,
+                         tr3_prob[(pprev, prev)]))[0][0]
 
 def generate_names(tr3_prob, min_l, max_l, nb_w, nb_d, min_prob = min_probability, max_prob = max_probability): 
     
     return names #, tried
 
 def print_names(names, tried): 
-    print "tried", len(tried), "names"
-    print ", ".join(sorted(names))
+    print("tried", len(tried), "names")
+    print(", ".join(sorted(names)))
     
 #### Self-Test ####
 
 if __name__ == "__main__":
     if len(sys_argv) != 6:
-        print "USAGE: %s PROBS MIN_L MAX_L NB_W NB_D" % sys_argv[0]
-        print "  PROBS is the language transition table"
-        print "  MIN_L is the minimum desired word length"
-        print "  MAX_L is the maximum desired word length"
-        print "  NB_W  is the number of words to generate"
-        print "  NB_D  is the number of free domain required (0 to 4)"
+        print("USAGE: %s PROBS MIN_L MAX_L NB_W NB_D" % sys_argv[0])
+        print("  PROBS is the language transition table")
+        print("  MIN_L is the minimum desired word length")
+        print("  MAX_L is the maximum desired word length")
+        print("  NB_W  is the number of words to generate")
+        print("  NB_D  is the number of free domain required (0 to 4)")
         sys_exit(1)
     tr3_prob = eval(open(sys_argv[1]).read())
     min_l = int(sys_argv[2])