#!/usr/bin/env python3 # -*- coding: utf-8 -*- # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # IMPORTS # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ import os; import sys; sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__)))); from code.local.io import *; from code.core.log import setQuietMode; from code.search.exports import *; # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # GLOBAL VARIABLES/CONSTANTS # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ parser: argparse.ArgumentParser; # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # MAIN PROCESS # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ def enter(args: argparse.Namespace): setQuietMode(args.quiet); setQuietMode(args.debug); if args.all is not None: goThroughCases(); else: parser.print_help(); return; # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # SECONDARY PROCESSES # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ def goThroughCases(): ## Hier Fälle einfügen: ## Case 1: L = [1,3,5,7,11,13,17,19,23]; u = 0; v = len(L) - 1; x = 13; p = AlgoInterpol(L, u, v, x); print('Ausführung des Interplationsalgorithmus:', p, L[p] if p >= 0 else None); return; # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # EXECUTE CODE # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ if __name__ == '__main__': cli_args = sys.argv[1:]; parser = argparse.ArgumentParser( prog='code/main.py', description=r'Code-Projekt, um verschiedene Algorithmen aus dem Kurs auszutesten.' ); parser.add_argument('all', nargs='?'); parser.add_argument('--debug', action='store_true', help='Debugging Messages stummschalten.') parser.add_argument('-q', '--quiet', action='store_true', help='Alle console-messages bis auf Errors stummschalten.') enter(parser.parse_args(cli_args));