# Jada Houser - B: 5/25/2017
# Program Set 2 - Balefron Code

# Program 3.5 - Ar.Seq. Composition Menus
def arSeqMenu():
    print("List of Available Operations")
    print("============================")
    print("*. Multiplication - M.")
    print("/. Division - D.")
    print("-. Subtraction - S.")
    print("+. Addition - A.")
    print("============================")
    userEnt = int(input("Please enter 0 to begin, 1 for the instructions menu, or 2 to exit: "))
    if userEnt == 1:
        print("\n")
        instrMan()
    elif userEnt == 0:
        print("Apologies, that program is not yet available.")
        print("\n")
        arSeqMenu()
    elif userEnt == 2:
        print("Program ended.")
    else:
        print("Invalid input.")
        print("\n")
        arSeqMenu()
    
def instrMan():
    print("     Instructions")
    print("=======================")
    print("1. How-To")
    print("2. Examples (Code)")
    print("3. Examples (Plain)")
    print("4. Manual of OAs")
    print("5. Exit")
    print("=======================")
    userInt = int(input("Please enter a corresponding number: "))
    if userInt == 1:
        print("\n")
        print("This is the Arithmetic Sequence Composition Program")
        print("-------------------------------------------------------------------")
        print("In this program, you can create an Ar.Seq to be applied to the")
        print("original NoNum sequence and, thereby, create a new sequence")
        print("-------------------------------------------------------------------")
        print("In its original format, an Ar.Seq. looks like this:")
        print("B.OA. The B stands for Base, referring to the sequence which")
        print("will be operated on by the number of OA, or Operation-")
        print("Arithmetic. For the NoNum sequence, an Ar.Seq. would appear")
        print("like this: No.Num.M.2., where the B == No.Num. and M.2. is")
        print("the OA. An Ar.Seq. can be as long and complicated as desired")
        print("So long as it returns new terms that are not all equal to the")
        print("Base.")
        print("-------------------------------------------------------------------")
        print("As the user, you must enter an expression for NoNum to be")
        print("operated on (so you are only responsible for the OA. The") 
        print("expression can be written in Balefron Format or be written")
        print("in plain format. For example: ")
        print("         B -> D.2.M.3.S.2 | P -> /2*3-2")
        print("They are equivalent to one another. You can specify which")
        print("way you are going to write the expression beforehand. Note that")
        print("currently, it is only possible to work with positive whole numbers.")
        print("Also, the order of operations is sequential, so the math is done")
        print("from left to right. For example, the above example will operate on")
        print("each term of the NoNum sequence by first dividing 2, multiplying 3,")
        print("and finally subtracting by 3.")
        print("-------------------------------------------------------------------")
        print("\n")
        goAgain()
    elif userInt == 2:
        print("\n")
        print("Example Line 1: M.4.D.9.")
        print("This will multiply each term in NoNum by four")
        print("And divide the value by 9...")
        print("Returning a new term with two decimal places.")
        print("=============================================")
        print("Example Line 2: S.2.M.3.")
        print("This will subtract each term in NoNum by two")
        print("And multiply the value by 3...")
        print("Returning a new term with two decimal places.")
        print("=============================================")
        print("\n")
        goAgain()
    elif userInt == 3:
        print("\n")
        print("Example Line 1: *123/12+3")
        print("This will multiply each term in NoNum by 123")
        print("And divide the value by 12, then add 3...")
        print("Returning a new term with two decimal places.")
        print("=============================================")
        print("Example Line 2: /2+2*2-5")
        print("This will divide each term in NoNum by 2")
        print("Then add and multiply 2, and subtract the value.")
        print("By 5...")
        print("Returning a new term with two decimal places.")
        print("=============================================")
        print("Note: Remember that the expression is sequential")
        print("The usual order of operations does not apply.")
        print("\n")
        goAgain()
    elif userInt == 5:
        print("\n")
        print("Returning to main menu...")
        print("\n")
        arSeqMenu()
    else:
        print("\n")
        print("That option does not exist or it is not yet ready.")
        goAgain()
    
def goAgain():
    userRep = input("Would you like to go again? Y or N ")
    if userRep == 'Y' or userRep == 'y':
        print("\n")
        instrMan()
    elif userRep == 'N' or userRep == 'n':
        print("Program ended.")
    else:
        print("Invalid input.")
        print("\n")
        goAgain()           
    
arSeqMenu()
