TRABAJO FINAL AGENTES BIEN
ESCUELA SUPERIOR DE INGENIERÍA MECÁNICA ELÉCTRICA
INGENIERÍA EN COMUNICACIONES Y ELECTRÓNICA
ENTREGA DE REPORTES DE PRÁCTICA #1 Y PRÁCTICA #2:
CIFRADO DE TEXTODOBLE; ROMPECABEZAS LINEAL EN PYTHON
AGENTES INTELIGENTES EXPERTOS
INTEGRANTES DEL EQUIPO:
NUÑEZ PEZA MONSERRATH
DANIEL ANTONIO TORRES VIQUEZ
RAMÍREZ ROSARIO CARLOS GIOVANI
ENTREGA DE REPORTES DEPRÁCTICA #1 Y PRÁCTICA #2:
CIFRADO DE TEXTO DOBLE; ROMPECABEZAS LINEAL EN PYTHON
FECHA: 5/Octubre/2015.
CÓDIGO PRÁCTICA #1.
CIFRADO DOBLE DE TEXTO.
#coding: utf-8
from string importletters,punctuation,digits
class Mensaje(object):
def __init__(self, pivote):
'''
Constructor de la clase
'''
self.vocabulario = letters[:52] + punctuation + digits + " "self.mensaje = ""
self.pivote = self.vocabulario.find(pivote)
def cifra(self, mensaje):
self.mensaje = ""
mensaje = list(mensaje)
for item in mensaje:idx = self.vocabulario.find(item)
if idx > -1:
idx += self.pivote
self.mensaje += self.vocabulario[idx%len(self.vocabulario)]
else:self.mensaje += item
return self.mensaje
def descifra(self):
temp = ""
mensaje = list(self.mensaje)
for item in mensaje:
idx =self.vocabulario.find(item)
if idx > -1:
idx -= self.pivote
temp += self.vocabulario[idx%len(self.vocabulario)]
else:
temp += itemprint temp
class Desc(object):
def __init__(self, pivote):
'''
Constructor de la clase
'''
self.vocabulario = letters[:52] + punctuation + digits + " "self.mensaje = ""
self.pivote = self.vocabulario.find(pivote)
def frado(self, mensaje):
self.mensaje = ""
mensaje = list(mensaje)
for item in mensaje:...
Regístrate para leer el documento completo.