Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import random
- print("Welcome to the Alexander's Terminal\n Type help to see all available options \nand type help dir to see help about directory\n To clear just relaunch!\nTerminal 3.0 coming soon...!\n========================================================================================================\n To clear just relaunch!\n To see spanish version go see \njgoterris's terminal in webpage: gotxer.webnode.es\n When you are logged in (with the command 'login') you can play two games\nType:\n 'play guess the number' \n or\n 'play tic tac toe'")
- import os
- import sys
- import shutil
- while True:
- n=input("Command>")
- if n=="help dir":
- print()
- print('Commands:\nhelp dir : See all directory files\nls : See files in the actual directory\nlsdir : See files of a selected directory\nsysinfo : Display system information\npyversion : Display python information\ncopyright : Display copyright\nlocation : See directory of the current folder\ncd : Change of directory\nmkdir : Create folder\nrmc : Erase folder\nrename : Rename folder/file')
- print()
- elif n=='ls':
- print(os.listdir ())
- elif n=='lsdir':
- directory=str(input('Directory: '))
- print(os.listdir (directory))
- elif n=='sysinfo':
- print(os.uname ())
- elif n=='pyversion':
- print(sys.version)
- elif n=='copyright':
- print(sys.copyright)
- elif n=='location':
- print(os.getcwd())
- elif n=='cd':
- diectory=str(input('Directory: '))
- os.chdir(directory)
- elif n=='mkdir':
- nc=str(input('Folder name: '))
- os.system('mkdir '+nc)
- elif n=='rmc':
- nc=str(input('Folder name: '))
- shutil.rmtree(nc)
- elif n=='rename':
- na=str(input('File name: '))
- nn=str(input('Rename file by: '))
- os.rename(na, nn)
- elif n=='login2':
- usuario=str(input('User: '))
- contraseña=str(input('password: '))
- if usuario=='Gotxer' and contraseña=='7391':
- print('Hola Jesús')
- elif n=="exit":
- print("\nexiting...")
- break
- elif n=="Hello":
- print("Hello? Why are you asking this? This is a terminal.")
- elif n=="calculate":
- while True:
- b=float(input("Enter the first number\n>>>"))
- w=float(input("Enter the second number\n>>>"))
- x=input("Type:\n Multiplicate for a multiplication\n Divide for a division\n Add for an addition\n Sous for a soustraction\nAnd End to exit calculate mode\nType Help to see all available options in calculate mode\n>>>")
- if x=="Multiplicate" or "multiplicate":
- print("=",b*w, "\n")
- elif x=="Divide" or "divide":
- print("=",b/w, "\n")
- elif x=="Add" or "add":
- print("=",b+w, "\n")
- elif x=="Sous" or "sous":
- print("=",b-w, "\n")
- elif x=="Help":
- print("Multiplicate for a multiplication\n Divide for a division\n Add for an addition\n Sous for a soustraction\nAnd End to exit calculate mode\nType Help to see all available options in calculate mode\n")
- elif x=="End":
- print("Exiting calculate mode...")
- print("You exited the calculate mode")
- break
- else:
- print("Unknow command.")
- elif n=="help":
- print(" credits: to see the credits\n calculate: to open the calculator\n exit: to exit the terminal\n help dir: to see directory help\n login to login in your account if you don't have one use the guest account with no password\n")
- elif n=="credits":
- print("Created by Alexander Williams-Chamarro and jgoterris(Jesus Goterris Pitarch)\n")
- elif n=="login":
- while True:
- c=input("user: ")
- if c=="guest":
- while True:
- o=input("password: ")
- if o=="":
- print("Welcome, guest\n Type help to see more options when you are logged in")
- print("To logout type end until you see : Command>")
- t=input(">>>")
- while True:
- if t=="play guess the number":
- maxn = 10
- n = random.randint(1, maxn)
- print('Welcome to guess the number game!')
- print('Guess the number from 1 to %d' % maxn)
- guess = None
- while guess != n:
- guess = int(input('Your try: '))
- if guess > n:
- print('Too high')
- if guess < n:
- print('Too low')
- else:
- print('Enter a valid number')
- print('Congratulations, you won!')
- elif t=="end":
- break
- elif t=="play tic tac toe":
- print('Bienvenido al tres en raya\n\nNormas:\nSi colocas el numero de un lugar ocupado, pasara al \nsiguiente jugador y no se colocara\nPara poner el numero de casilla primero columna y después \nfila\n')
- p1=str(input('Introduzca el nombre del primer jugador: '))
- p2=str(input('Introduzca el nombre del segundo jugador: '))
- f=1
- print()
- n1=['?','?','?']
- n2=['?','?','?']
- n3=['?','?','?']
- print(n1)
- print(n2)
- print(n3)
- while f==1:
- print()
- p=int(input(p1+' introduzca XY: '))
- #X
- if p==11:
- if n1[0]==('?'):
- n1[0]=('x')
- else:
- print('\nSitio ocupado\n')
- elif p==21:
- if n1[1]==('?'):
- n1[1]=('x')
- else:
- print('\nSitio ocupado\n')
- elif p==31:
- if n1[2]==('?'):
- n1[2]=('x')
- else:
- print('\nSitio ocupado\n')
- elif p==12:
- if n2[0]==('?'):
- n2[0]=('x')
- else:
- print('\nSitio ocupado\n')
- elif p==22:
- if n2[1]==('?'):
- n2[1]=('x')
- else:
- print('\nSitio ocupado\n')
- elif p==32:
- if n2[2]==('?'):
- n2[2]=('x')
- else:
- print('\nSitio ocupado\n')
- elif p==13:
- if n3[0]==('?'):
- n3[0]=('x')
- else:
- print('\nSitio ocupado\n')
- elif p==23:
- if n3[1]==('?'):
- n3[1]=('x')
- else:
- print('\nSitio ocupado\n')
- elif p==33:
- if n3[2]==('?'):
- n3[2]=('x')
- else:
- print('\nSitio ocupado\n')
- print(n1)
- print(n2)
- print(n3)
- #Primera columna ganadora
- if n1[0]=='x':
- if n2[0]=='x':
- if n3[0]=='x':
- f=2
- print()
- print(p1+' ha ganado')
- input()
- break
- #Columna del medio ganadora
- if n1[1]=='x':
- if n2[1]=='x':
- if n3[1]=='x':
- f=2
- print()
- print(p1+' ha ganado')
- input()
- break
- #Columna del final ganadora
- if n1[2]=='x':
- if n2[2]=='x':
- if n3[2]=='x':
- f=2
- print()
- print(p1+' ha ganado')
- input()
- break
- #Primera fila ganadora
- if n1[0]=='x':
- if n1[1]=='x':
- if n1[2]=='x':
- f=2
- print()
- print(p1+' ha ganado')
- input()
- break
- #Segunda fila ganadora
- if n2[0]=='x':
- if n2[1]=='x':
- if n2[2]=='x':
- f=2
- print()
- print(p1+' ha ganado')
- input()
- break
- #Tercera fila ganadora
- if n3[0]=='x':
- if n3[1]=='x':
- if n3[2]=='x':
- f=2
- print()
- print(p1+' ha ganado')
- input()
- break
- #Diagonal arriba izquierda
- if n1[0]=='x':
- if n2[1]=='x':
- if n3[2]=='x':
- f=2
- print()
- print(p1+' ha ganado')
- input()
- break
- #Diagonal arriba derecha
- if n1[2]=='x':
- if n2[1]=='x':
- if n3[0]=='x':
- f=2
- print()
- print(p1+' ha ganado')
- input()
- break
- print()
- p=int(input(p2+' introduzca XY: '))
- #O
- if p==11:
- if n1[0]==('?'):
- n1[0]=('o')
- else:
- print('\nSitio ocupado\n')
- elif p==21:
- if n1[1]==('?'):
- n1[1]=('o')
- else:
- print('\nSitio ocupado\n')
- elif p==31:
- if n1[2]==('?'):
- n1[2]=('o')
- else:
- print('\nSitio ocupado\n')
- elif p==12:
- if n2[0]==('?'):
- n2[0]=('o')
- else:
- print('\nSitio ocupado\n')
- elif p==22:
- if n2[1]==('?'):
- n2[1]=('o')
- else:
- print('\nSitio ocupado\n')
- elif p==32:
- if n2[2]==('?'):
- n2[2]=('o')
- else:
- print('\nSitio ocupado\n')
- elif p==13:
- if n3[0]==('?'):
- n3[0]=('o')
- else:
- print('\nSitio ocupado\n')
- elif p==23:
- if n3[1]==('?'):
- n3[1]=('o')
- else:
- print('\nSitio ocupado\n')
- elif p==33:
- if n3[2]==('?'):
- n3[2]=('o')
- else:
- print('\nSitio ocupado\n')
- print(n1)
- print(n2)
- print(n3)
- #Primera columna ganadora
- if n1[0]=='o':
- if n2[0]=='o':
- if n3[0]=='o':
- f=2
- print()
- print(p2+' ha ganado')
- input()
- break
- #Columna del medio ganadora
- if n1[1]=='o':
- if n2[1]=='o':
- if n3[1]=='o':
- f=2
- print()
- print(p2+' ha ganado')
- input()
- break
- #Columna del final ganadora
- if n1[2]=='o':
- if n2[2]=='o':
- if n3[2]=='o':
- f=2
- print()
- print(p2+' ha ganado')
- input()
- break
- #Primera fila ganadora
- if n1[0]=='o':
- if n1[1]=='o':
- if n1[2]=='o':
- f=2
- print()
- print(p2+' ha ganado')
- input()
- break
- #Segunda fila ganadora
- if n2[0]=='o':
- if n2[1]=='o':
- if n2[2]=='o':
- f=2
- print()
- print(p2+' ha ganado')
- input()
- break
- #Tercera fila ganadora
- if n3[0]=='o':
- if n3[1]=='o':
- if n3[2]=='o':
- f=2
- print()
- print(p2+' ha ganado')
- input()
- break
- #Diagonal arriba izquierda
- if n1[0]=='o':
- if n2[1]=='o':
- if n3[2]=='o':
- f=2
- print()
- print(p2+' ha ganado')
- input()
- break
- #Diagonal arriba derecha
- if n1[2]=='o':
- if n2[1]=='o':
- if n3[0]=='o':
- f=2
- print()
- print(p2+' ha ganado')
- input()
- break
- elif o=="end":
- break
- elif c=="end":
- break
- elif c=="admin":
- m=input("password: ")
- if m=="Manchi2015sg":
- print("\nWelcome administrator\n")
- v=input("What would you like to do?\n")
- if v=="Block":
- n=1
- while n==1:
- if n==1:
- print("Blocked Blocked Blocked Blocked Blocked Blocked Blocked Blocked Blocked")
- elif v=="play guess the number":
- maxn = 10
- n = random.randint(1, maxn)
- print('Welcome to guess the number game!')
- print('Guess the number from 1 to %d' % maxn)
- guess = None
- while guess != n:
- guess = int(input('Your try: '))
- if guess > n:
- print('Too high')
- if guess < n:
- print('Too low')
- print('Congratulations, you won!')
- elif v=="Secure mode":
- print("Yes, sir.\n We are in secure mode")
- a=input("Your orders>")
- if a=="Message":
- print("""crypted message ultracode: 110000 110010 110010 110011""")
- elif a=="end":
- break
- else:
- while True:
- print("Warning! Lockdown! ")
- else:
- print("Unknown user")
- else:
- print("Unknown command\n")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement