Exemplo n.º 1
0
def end_message(winner):
    lost = """
                ______________
              /               \      
             /                 \     
          //                   \/\ 
          \|   XXXX     XXXX   | /  
            |   XXXX     XXXX   |/ 
            |   XXX       XXX   |   
            |                   |  
             \__      XXX      __/     
              |\     XXX     /|       
              | |           | |        
              | I I I I I I I |        
              |  I I I I I I  |       
              \_             _/       
               \_         _/         
                 \_______/           
    """
    logger.info('The game is finished!!!')
    if winner:
        logger.info('Congratulation, you are the winner!!!')
    else:
        logger.error('OH MY GOOD, you are not winner!!')
        logger.error(lost)
Exemplo n.º 2
0
def read_file():
    logger.info('read the big file!!!')
    try:
        with open('big.txt', 'r') as big:
            text = big.read()
        return text
    except FileNotFoundError:
        logger.error('file not exist!!!')
Exemplo n.º 3
0
def __get_level():
    logger.info('What level do you want? (1=Easy, 2=Medium, 3=Strong)')
    all_attempts = 0
    game_level = int(input())

    if game_level == 1:
        all_attempts = 20

    elif game_level == 2:
        all_attempts = 10

    elif game_level == 3:
        all_attempts = 5

    else:
        logger.error('Use the 1, 2 ou 3 on level game!')

    return all_attempts
Exemplo n.º 4
0
def start_message():
    logger.info('*'*50)
    logger.info('* This is the FOCA Game in Python3, Welcome')
    logger.info('*'*50)
Exemplo n.º 5
0
def start_game():
    logger.info('=' * 25)
    logger.info('   Select on Game!!!')
    logger.info('=' * 25)

    logger.info('(1) game name Divination, (2) game name Forca!')
    game_type = int(input())

    if game_type == 1:
        logger.info('-> Starting game Divination!')
        divination.start_game()
    elif game_type == 2:
        logger.info('-> Starting game Foca!')
        foca.start_game()
Exemplo n.º 6
0
def start_game():
    logger.info('*'*50)
    logger.info('* This is the FOCA Game in Python3, Welcome')
    logger.info('*'*50)
    print()

    the_correct_word = ['_', '_', '_', '_', '_', '_']
    secret_word = 'banana'
    hang_himself = False
    hit = False
    print('The secret word {} with size: {}'.format(the_correct_word, len(the_correct_word)))

    while not hit and not hang_himself:
        option = input('What is the word?\n')
        option = option.strip()
        index = 0

        for word in secret_word:
            if option.upper() == word.upper():
                the_correct_word[index] = option
            index = index + 1
        print(the_correct_word)

    logger.info('-'*50)
    logger.info('The game is finished!!!'.ca)
    logger.info('-'*50)
from module1.utils import logger

input_file = open('big.txt', 'r')
output_file = open('output.txt', 'w')

logger.info('reading the first 500 lines the big file !!!')
for lines in range(500):
    line = input_file.readline()
    output_file.write(line)
logger.info('wrote 500 lines on new file !!!')

################################################################
logger.info('reading the big file !!!')
while 1:
    for lines in range(100):
        logger.info(input_file.readline())

################################################################

filepath = 'big.txt'
with open(filepath) as fp:
    line = fp.readline()
    cnt = 1
    while line:
        logger.info("line {}: {}".format(cnt, line.strip()))
        line = fp.readline()
        cnt += 1
Exemplo n.º 8
0
def start_game():
    logger.info('-' * 50)
    logger.info('- This is the Python3 Game, Welcome')
    logger.info('-' * 50)

    __execute_game(__get_level())
Exemplo n.º 9
0
def __execute_game(level):
    game_result = False
    points = 1000

    for attempts in range(1, level + 1):
        logger.info('You have attempts {} de {}: '.format(attempts, level))

        kick_str = input('Type the number!\n')
        logger.info('You type the number {}'.format(kick_str))

        kick = int(kick_str)
        right = kick == secret_number
        bigger = kick > secret_number
        less = kick < secret_number

        if kick < 1:
            logger.error('You must type number higher 1 and less 100!!!')
            continue

        if right:
            game_result = True
            logger.info('=' * 50)
            logger.info(
                'Congratulation you have {:7.2f} points!!!'.format(points))
            logger.info('=' * 50)
            break
        else:
            if bigger:
                logger.info(
                    'You are wrong! The kick is higher than Secret number!!!')
            elif less:
                logger.info(
                    'You are wrong! The kick is less than Secret number!!!')
            lost_points = round(abs(secret_number - kick) / 3)  # 40 -20 = 20
            points = points - lost_points

        attempts += 1

    if not game_result:
        logger.warning('=' * 25)
        logger.warning('Gamer Over!!!')
        logger.warning('=' * 25)
Exemplo n.º 10
0
def start_game():
    logger.info('-' * 50)
    logger.info('- This is the FOCA Game in Python3, Welcome')
    logger.info('-' * 50)