juego: familia en cascada. ¿cuáles son las salidas?
TRANSCRIPT
PROYECTO #1
JUEGO: Familia en Cascada
DIAGRAMA DE FLUJO
PREGUNTAS INSUSTITUIBLES
¿Cuáles son las salidas?
¿Cuáles son las entradas?
¿Cuáles son las condiciones o restricciones?
¿Cuáles son los procesos o cálculos realizados?
FUNCIONES
FUNCIÓN ENTERO PARA EL MENÚ
def entero(text ) ok = Falsetexto = raw_input(text)while not ok : texto = raw_input(text) ok = False try: texto = int(texto) ok = True if (texto<1) or (texto>3) ok = False print "el numero no corresponde a alguna opción del menú, escoja una opción del 1 al 3" except: print "[",texto,"] no es un numero, o no es numero entero" return texto
FUNCIÓN ENTERO PARA EL PROGRAMA
def enterop(text): ok = False while not ok : texto = raw_input(text) ok = False try: texto = int(texto) ok = True if (texto<0) or (texto>5) or (not VerificarPosicion(texto)): ok = False print "el numero no corresponde a algun jugador, ingrese un numero entre uno y cinco" except: print "[",texto,"] no es un numero, o no es numero entero" return texto
FUNCIÓN PARA VERIFICAR POSICIÓN
def VerificarPosicion(x):
if x==0:
return True
if(lampara):
if(LD[x-1]==1):
return True
else:
if(LI[x-1]==1):
return True
return False
FUNCIONES PARA POSICIONES
def prsonasnLD():
return LD
def prsonasnLI():
return LI
FUNCIÓN PARA EL TIEMPOdef RestarT (x,y):
global tiempo
if y==-1:
tiempo = tiempo - ContT[x]
return
if x==-1:
tiempo= tiempo - ContT[y]
return
if ContT[x]>ContT[y]:
tiempo= tiempo-ContT[x]
else:
tiempo= tiempo-ContT[y]
FUNCIÓN PARA DETERMINACIÓN DE LADO
def Mov(x):
global LD
global LI
if lampara== True:
LD[x]=0
LI[x]=1
else:
LD[x]=1
LI[x]=0
FUNCIÓN CAMBIAR LÁMPARA
def CambiarLampara(): global lampara if lampara: lampara=False else: lampara=True
FUNCIÓN GANADOR, PERDEDOR
def WIN(): print '\n' print "Buen trabajo, has logrado lo que muchos no ;) "
def LOOSER(): print '\n' print "UUUPS....! lo siento te has quedado sin tiempo.. :( "
FUNCIÓN TODOS LADO IZQUIERDO
def Todos(): for i in range(0,5): if(LD[i]==1): return False return True
FUNCIÓN NUEVO JUEGO
def nuevojuego() global tiempo,lampara, LD, LI, ConT tiempo = 30 lampara = True LD = [1,1,1,1,1] LI = [0,0,0,0,0] ContT = [1,3,6,8,12]
APÉNDICE Link para wiki: http://programacion-quimica1.wikispaces.com/home
Link para video: http://www.youtube.com/watch?v=vP0IrQUgFmA&feature=youtu.be
INTEGRANTES:ALEJANDRA PAOLA VELASQUEZ BARILLAS vel12141
EMMA VERONICA ABAC SUCHI aba12383
VENUS ESMERALDACEBALLOS URRUELA ceb12088