Skip to content

Instantly share code, notes, and snippets.

@PhilippM96
PhilippM96 / X.py
Created April 10, 2018 15:04
Traffic Light
from sys import stdout
class TrafficLight:
def __init__(self):
self.greenOn = False
self.yellowOn = False
self.redOn = False
self.operational = True
self.operation = ""
@PhilippM96
PhilippM96 / A.py
Last active June 26, 2018 10:54
Logic Gates
from abc import ABC, abstractmethod
class ShowStrategyAbstract(): # object parameter?
@abc.abstractmethod
def show(self):
pass
class ShowEightBitAdderStrategy(ShowEightBitAdderStrategy)
@PhilippM96
PhilippM96 / X.py
Created February 28, 2018 12:21
Quicksort
class IntroConfiguration: # Class begin
@staticmethod # Upcoming method is independent
def print_intro(): # Defining method
program_name = "Quicksort-Algorithmus"
version_number = "0.1.0"
release_date = "28.02.2018"
owner_email = "philipp.mindt@crs-online.de"
print("".center(50, "*") + "\n**" + # Fifty * in a row + two * at new line
"{0:>51}".format("**\n**") + # Two * at the end + two * at new line
@PhilippM96
PhilippM96 / X.py
Last active February 28, 2018 12:17
Bubblesort
from BubblesortAlgorithm import BubblesortAlgorithm
from IntroConfiguration import IntroConfiguration
try:
IntroConfiguration.print_intro()
bs = BubblesortAlgorithm()
arr1 = ['30', '50', '40']
arr2 = bs.fill_array(1000, 100)
@PhilippM96
PhilippM96 / X.py
Last active February 8, 2018 12:10
Nimmspiel
from sys import stderr, stdout
from random import randint
def start_game():
player1_score = 0
player2_score = 0
print("Es liegen Streichhölzer auf dem Tisch.\n"
"Jeder Spieler nimmt abwechselnd 1 bis 3 Streichhölzer vom Tisch runter.\n"
@PhilippM96
PhilippM96 / X.py
Last active February 28, 2018 12:12
Ticketautomat
from TicketCalculation import start_ticket_machine
from IntroConfiguration import IntroConfiguration
try:
IntroConfiguration.print_intro()
start_ticket_machine()
except Exception as ex:
exit("Programm wird wegen folgender Ausnahme beendet: " + str(ex))
@PhilippM96
PhilippM96 / V.py
Last active January 22, 2018 15:24
Darlehensrechner
from IntroConfiguration import IntroConfiguration # Own file-import
class MenuConfiguration:
@staticmethod
def start_menu():
inputting = True
while inputting:
start_input = input("Programm starten (P)\nIntro starten (I)\nVersionshistorie starten (V)\n")