Using user input to assign an archetype

So, I’ve spent time brainstorming what I want my game to be, creating a project skeleton, and implementing it.

I’m starting out by prompting the user to choose a basic archetype, based off of the generic classes found in fantasy tabletop games. I have a mechanism to do so (oddly enough, I noticed I accidentally made it similar to what Zed did in ex.43), but I’m kind of worried I’m over-complicating it (something I tend to do a lot when I program):

    class CharacterCreation(object):
    """The user provides input regarding what archetype they'll play as."""

    def __init__(self, archetype):
        self.archetype = archetype

    @classmethod
    def choose_arch(cls):
        """
        Prompts the user to choose their character archtype, which will be
        passed as a parameter later on.
        """

        while True:
            try:
                user_arch = str(input("Barbarian, Ranger or Wizard? > "))
            except:
                print("Please enter one of the archetypes listed above.")
                continue
            if user_arch.lower().startswith('b'):
                return 'barbarian'
            elif user_arch.lower().startswith('r'):
                return 'ranger'
            elif user_arch.lower().startswith('w'):
                return 'wizard'
            else:
                print("Please enter one of the archetypes listed above.")

    class Barbarian(object):

    def enter(self):
        print("It worked!")

    class ArchMap(object):

    def __init__(self, user_arch):
        self.user_arch = user_arch

    arch_map = {'barbarian' : Barbarian()}

    def get_arch(user_arch):
        arch = ArchMap.arch_map.get(user_arch)
        return arch


    user_arch = CharacterCreation.choose_arch()
    arch_map = ArchMap.get_arch(user_arch)
    arch_map.enter()

It ends up with the output I want (“It worked!”), which means I can tap into the other classes and access their methods. That being said, I always prefer to go the simple route.

I think this looks fine, although I see your formatting is off on this code. It looks like the Barbarian class is indented wrong, but most likely that’s just a copy-paste error into this.

So, the general rule is: Get it working however you can, then clean it up.

If you think this code is complex, but it does work, then you can try to simplify it by cleaning it up some. You can also delete it (make a backup), and then try again with a new idea. Or, just go with it and then if you run into problems later come back and work on it more.