def converter(s):
    """Takes picobot code, as a string, and returns a picobot dictionary"""
    # I made this so I could feed programs returned by GA back into Picobots
    # and render them. It takes a Picobot program, formatted as follows:
    # """
    # 2 xxxS -> W 0
    # 2 xxxx -> S 2
    # 3 NExx -> W 1
    # """
    # (spacing important) and turns it into a dictionary that a Picobot object
    # can use.
    picobotDict = {}

    # It splits the input string at the newline characters,
    L = s.split('\n')

    # and for each item in that list,
    for item in L[1:]:

        # splices the item into a properly formatted key and value.
        key = (int(item[1]), str(item[3:7]))
        value = (str(item[11]), int(item[13]))

        # The key and value are added to the dictionary.
        picobotDict[key] = value

    # The dictionary is returned.
    return picobotDict