added shakersort algorithm
This commit is contained in:
		
							
								
								
									
										6
									
								
								automata/recog.py
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										6
									
								
								automata/recog.py
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,6 @@
 | 
			
		||||
userin=input("Kennwort eingeben: ")
 | 
			
		||||
 | 
			
		||||
if userin=="abc":
 | 
			
		||||
    print("Passwort akzeptiert.")
 | 
			
		||||
else:
 | 
			
		||||
	print("Authentifizierung fehlgeschlagen.")
 | 
			
		||||
							
								
								
									
										37
									
								
								automata/simple_automaton.py
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										37
									
								
								automata/simple_automaton.py
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,37 @@
 | 
			
		||||
 | 
			
		||||
states={0:"z1",1:"z2",2:"f"}
 | 
			
		||||
active=True
 | 
			
		||||
activestate=0
 | 
			
		||||
intext=""
 | 
			
		||||
 | 
			
		||||
print("Alphabet: a, b .")
 | 
			
		||||
print("Im Endzustand beendet '.'")
 | 
			
		||||
 | 
			
		||||
while active:
 | 
			
		||||
	
 | 
			
		||||
	print("Zustand: " +states.get(activestate))
 | 
			
		||||
	userin = input("Eingabe: ")
 | 
			
		||||
 | 
			
		||||
	if activestate==0:
 | 
			
		||||
		if userin == "a":
 | 
			
		||||
			activestate=1
 | 
			
		||||
			intext=intext+userin
 | 
			
		||||
		else:
 | 
			
		||||
			pass
 | 
			
		||||
	elif activestate==1:
 | 
			
		||||
		if userin == "b":
 | 
			
		||||
			activestate=2
 | 
			
		||||
			intext=intext+userin
 | 
			
		||||
		else:
 | 
			
		||||
			pass
 | 
			
		||||
	elif activestate==2:
 | 
			
		||||
		if userin == "a":
 | 
			
		||||
			activestate=1
 | 
			
		||||
			intext=intext+userin
 | 
			
		||||
		elif userin == ".":
 | 
			
		||||
			intext=intext+userin
 | 
			
		||||
			active=False
 | 
			
		||||
		else:
 | 
			
		||||
			pass
 | 
			
		||||
 | 
			
		||||
print("Eingabe " + intext + " akzeptiert.")
 | 
			
		||||
		Reference in New Issue
	
	Block a user