Ejemplo n.º 1
0
 def change_settings(self):
     self.request_input_during = input_handling.select_yes_no(
         'Request input during')
     self.request_input_after = input_handling.select_yes_no(
         'Request input after')
     self.print_grid_after_solve = input_handling.select_yes_no(
         'Print grid after solve', 'yes')
     self.verbose = input_handling.select_yes_no('Verbose')
     self.create_connections_tries = input_handling.input_number(
         'Create connection tries', default=self.create_connections_tries)
     self.create_cells_tries = input_handling.input_number(
         'Create cells tries', default=self.create_cells_tries)
Ejemplo n.º 2
0
def init_generate_puzzles():
    width = 10
    height = 10
    amount_of_cells = 14
    amount_of_puzzles = 1
    output_file = 'auto_' + date.today().strftime("%Y%m%d")
    settings = None

    print('Please fill in the following values.')
    width = input_handling.input_number_range('Width', default=width)
    height = input_handling.input_number_range('Height', default=height)
    amount_of_cells = input_handling.input_number_range(
        'Amount of cells', default=amount_of_cells)
    amount_of_puzzles = input_handling.input_number('Amount of puzzles',
                                                    default=amount_of_puzzles)
    output_file = input_handling.input_string('Output file', output_file)

    modify_settings = input_handling.select_yes_no('Want to change settings?',
                                                   default='no')
    if modify_settings:
        settings = Settings()
        settings.change_settings()

    generate_puzzles(width,
                     height,
                     amount_of_cells,
                     amount_of_puzzles,
                     output_file,
                     use_settings=settings)
Ejemplo n.º 3
0
def delete_record_by_number() -> bool:
    """
    Docstring
    """
    number = input_handling.input_number()
    phone_book.delete_record({'Phone number': number})
    return True
Ejemplo n.º 4
0
def update_current_record(actual: dict) -> bool:
    """
    Docstring
    """
    idx = phone_book.find_record(actual).index[0]

    birth_date = input_handling.input_birth_date()
    number = input_handling.input_number()

    phone_book.update_record(
        {
            'Birth date': birth_date,
            'Phone number': number,
            },
        idx=idx,
        )
    return True
Ejemplo n.º 5
0
def add_record() -> bool:
    """
    Docstring
    """
    firstname = input_handling.input_firstname()
    lastname = input_handling.input_lastname()

    actual = {
        'Firstname': firstname,
        'Lastname': lastname,
        }

    try:
        record = phone_book.find_record(actual).index[0]

    except IndexError:
        birth_date = input_handling.input_birth_date()
        number = input_handling.input_number()

        person = Person(firstname, lastname, birth_date, number)
        phone_book.add_record(person)

        return True
    
    else:
        user_input = get_additional_user_input()
        
        if user_input == 'u':  # update current record
            res = update_current_record(actual)
            return res

        elif user_input == 'c':  # change name of current record
            res = change_name_of_current_record(actual)
            return res

        elif user_input == 'r':  # return to main menu
            return True
Ejemplo n.º 6
0
import input_handling
from generator import generate_puzzles, Settings

REQUEST_INPUT = True

width = 10
height = 10
amount_of_cells = 14
amount_of_puzzles = 1
output_file = 'auto_' + date.today().strftime("%Y%m%d")
settings = None

if REQUEST_INPUT:
    print('Please fill in the following values.')
    width = input_handling.input_number('Width', default=width)
    height = input_handling.input_number('Height', default=height)
    amount_of_cells = input_handling.input_number_range(
        'Amount of cells', default=amount_of_cells)
    amount_of_puzzles = input_handling.input_number('Amount of puzzles',
                                                    default=amount_of_puzzles)
    output_file = input_handling.input_string('Output file', output_file)

    modify_settings = input_handling.select_yes_no('Want to change settings?',
                                                   default='no')
    if modify_settings:
        settings = Settings()
        settings.change_settings()

generate_puzzles(width,
                 height,