Ejemplo n.º 1
0
def chat(mode, name):
    textTesting(mode, "C.L.I.F.F.: Hello {0}! What is going on?".format(name))
    while True:
        answer = inputTesting(mode, "Connor: ".format(name))
        if "bye" in answer:
            textTesting(mode, "C.L.I.F.F.: Goodbye {}".format(name))
            break
Ejemplo n.º 2
0
def writeFile(mode, file):
    file = open(file, 'a+')
    opener = True
    while opener == True:
        line = inputTesting(mode, 'What would you like to write into the file? ')
        if line == 'exit':
            file.close()
            break
        file.write(line)

    file.close()
Ejemplo n.º 3
0
def createNote(mode):
    name = inputTesting(mode, 'What would you like the title of the note to be? ')
    line = inputTesting(mode, 'What would you like the note to say? ')
    newFile = open('{0}/journals/notes/{1}'.format(globalPath, name), 'w+')
    newFile.write(line)
    newFile.close()
Ejemplo n.º 4
0
def rockpaperscissors(mode):
    # A simple Rock Paper Scissors Game
    choices = ['rock', 'paper', 'scissors']
    move = inputTesting(mode, 'rock, paper, or scissors? (r, p, s): ')
    computersMove = random.choice(choices)

    def wincheck(move, computersMove):
        # Computes all possibilities if move is 'r'
        if move == 'r':
            # For paper:
            if computersMove == 'paper':
                textTesting(mode, 'You lose! Computer Chose Paper!')
                answer = inputTesting(mode, 'Play Again? (y,n): ')
                if answer == 'y':
                    newmove = inputTesting(
                        mode, 'rock, paper, or scissors? (r, p, s): ')
                    newcomputersMove = random.choice(choices)
                    wincheck(newmove, newcomputersMove)
                else:
                    textTesting(mode, 'ok')

            # For Scissors:
            if computersMove == 'scissors':
                textTesting(mode, 'You won! Computer Chose Scissors!')
                answer = inputTesting(mode, 'Play Again? (y,n): ')
                if answer == 'y':
                    newmove = inputTesting(
                        mode, 'rock, paper, or scissors? (r, p, s): ')
                    newcomputersMove = random.choice(choices)
                    wincheck(newmove, newcomputersMove)
                else:
                    textTesting(mode, 'ok')

            # For Rock:
            if computersMove == 'rock':
                textTesting(mode, 'Tie! Computer Chose rocks!')
                newmove = inputTesting(
                    mode, 'rock, paper, or scissors? (r, p, s): ')
                newcomputersMove = random.choice(choices)
                wincheck(newmove, newcomputersMove)

        # Computes all possibilites for paper:
        elif move == 'p':
            # For Paper:
            if computersMove == 'paper':
                textTesting(mode, 'Tie! Computer Chose Paper!')
                newmove = inputTesting(
                    mode, 'rock, paper, or scissors? (r, p, s): ')
                newcomputersMove = random.choice(choices)
                wincheck(newmove, newcomputersMove)

            # For Scissors:
            if computersMove == 'scissors':
                textTesting(mode, 'You lose! Computer Chose Scissors!')
                answer = inputTesting(mode, 'Play Again? (y,n): ')
                if answer == 'y':
                    newmove = inputTesting(
                        mode, 'rock, paper, or scissors? (r, p, s): ')
                    newcomputersMove = random.choice(choices)
                    wincheck(newmove, newcomputersMove)
                else:
                    textTesting(mode, 'ok')

            # For Rock:
            if computersMove == 'rock':
                textTesting(mode, 'You win! Computer Chose rocks!')
                answer = inputTesting(mode, 'Play Again? (y,n): ')
                if answer == 'y':
                    newmove = inputTesting(
                        mode, 'rock, paper, or scissors? (r, p, s): ')
                    newcomputersMove = random.choice(choices)
                    wincheck(newmove, newcomputersMove)
                else:
                    textTesting(mode, 'ok')

        # Computes all probabilities for scissors:
        elif move == 's':

            # For Paper
            if computersMove == 'paper':
                textTesting(mode, 'You Won! Computer Chose Paper!')
                answer = inputTesting(mode, 'Play Again? (y,n): ')
                if answer == 'y':
                    newmove = inputTesting(
                        mode, 'rock, paper, or scissors? (r, p, s): ')
                    newcomputersMove = random.choice(choices)
                    wincheck(newmove, newcomputersMove)
                else:
                    textTesting(mode, 'ok')

            # For scissors
            if computersMove == 'scissors':
                textTesting(mode, 'Tie! Computer Chose Scissors!')
                newmove = inputTesting(
                    mode, 'rock, paper, or scissors? (r, p, s): ')
                newcomputersMove = random.choice(choices)
                wincheck(newmove, newcomputersMove)

            # For Rock
            if computersMove == 'rock':
                textTesting(mode, 'You Lose! Computer Chose rocks!')
                answer = inputTesting(mode, 'Play Again? (y,n): ')
                if answer == 'y':
                    newmove = inputTesting(
                        mode, 'rock, paper, or scissors? (r, p, s)')
                    newcomputersMove = random.choice(choices)
                    wincheck(newmove, newcomputersMove)
                else:
                    textTesting(mode, 'ok')

        else:
            textTesting(mode, 'That is not a move!')
            newmove = inputTesting(mode,
                                   'rock, paper, or scissors? (r, p, s): ')
            newcomputersMove = random.choice(choices)
            wincheck(newmove, newcomputersMove)

    wincheck(move, computersMove)