Beispiel #1
0
def rodaEmTk(mundoA, mundoL, dormir):
    #####################
    janela = tkinter.Tk()  #
    canvas_altura = 820  #
    canvas_largura = 820  #
    tela = tkinter.Canvas(janela,
                          bg='white',
                          width=canvas_largura,
                          height=canvas_altura)
    ###prepara
    mundo = vida.mundo(mundoA, mundoL)
    ######### vidas :
    #vidas imortais:
    #~ vidas = [(1,5),(1,6),(1,7),\
    #~ (6,5),(6,6),(7,5),(8,6),(7,7),\
    #~ (10,11),(10,12),(10,13),(11,10),(11,11),(11,12),\
    #~ (15,15),(15,16),(16,15),(16,16)] ## blink, bote, sapo e cubo; respectivamente

    vidas = [(22, 25), (22, 26), (23, 24), (24, 23), (25, 23), (26, 23),
             (27, 24), (28, 25), (28, 26)]  ## Gun

    #~ vidas= [(25,20),(25,21),(25,22),(25,23),(25,24),(25,25),(25,26),\
    #~ (25,27),(25,28),(25,29),(25,30),(25,31),(25,32),(25,33),(25,34),\
    #~ (25,35),(25,36),(25,37),(25,38),(25,39),(25,40),(25,41),(25,42),\
    #~ (25,43),(25,44),(25,45),(25,46),(25,47),(25,48),(25,49),(25,50),\
    #~ (25,51),(25,52) ,(25,53),(25,54),(25,55),(25,56),(25,57),(25,58),\
    #~ (25,59),(25,60),(25,61),(25,62),(25,63),(25,64),(25,65),(25,66),]

    mundo = vida.adiciona_vida(vidas, mundo)
    matriz = []
    matriz = cria_mundo(matriz, mundo, tela)
    tela.pack()
    time.sleep(dormir)
    ###inicia
    while 1:
        mundo = vida.vida(mundo)
        matriz = atualiza_mundo(matriz, mundo, tela)
        tela.update()
        time.sleep(dormir)
        #~ print("tic")
    ########################
    janela.mainloop()
Beispiel #2
0
def rodaEmTk(mundoA,mundoL,dormir):
	#####################
	janela = tkinter.Tk()	#
	canvas_altura = 820	#
	canvas_largura = 820	#
	tela = tkinter.Canvas(janela, bg='white', width=canvas_largura, height=canvas_altura)
	###prepara
	mundo = vida.mundo(mundoA,mundoL)
	######### vidas :
	#vidas imortais:
	#~ vidas = [(1,5),(1,6),(1,7),\
	#~ (6,5),(6,6),(7,5),(8,6),(7,7),\
	#~ (10,11),(10,12),(10,13),(11,10),(11,11),(11,12),\
	#~ (15,15),(15,16),(16,15),(16,16)] ## blink, bote, sapo e cubo; respectivamente
	
	vidas= [(22,25),(22,26),(23,24),(24,23),(25,23),(26,23),(27,24),(28,25),(28,26)] ## Gun
	
	#~ vidas= [(25,20),(25,21),(25,22),(25,23),(25,24),(25,25),(25,26),\
	#~ (25,27),(25,28),(25,29),(25,30),(25,31),(25,32),(25,33),(25,34),\
	#~ (25,35),(25,36),(25,37),(25,38),(25,39),(25,40),(25,41),(25,42),\
	#~ (25,43),(25,44),(25,45),(25,46),(25,47),(25,48),(25,49),(25,50),\
	#~ (25,51),(25,52) ,(25,53),(25,54),(25,55),(25,56),(25,57),(25,58),\
	#~ (25,59),(25,60),(25,61),(25,62),(25,63),(25,64),(25,65),(25,66),]

	mundo = vida.adiciona_vida(vidas,mundo)
	matriz=[]
	matriz = cria_mundo(matriz,mundo,tela)
	tela.pack()
	time.sleep(dormir)
	###inicia
	while 1:
		mundo = vida.vida(mundo)
		matriz = atualiza_mundo(matriz,mundo,tela)
		tela.update()
		time.sleep(dormir)
		#~ print("tic")
	########################
	janela.mainloop()
Beispiel #3
0
def rodaEmConsole(mundoA,mundoL,dormir):
		#~ #### modo console
	mundo = vida.mundo(mundoA,mundoL)  ## mudar aqui o tamanho do mundo
	
	######### vidas :
	#vidas imortais:
	vidas = [(1,5),(1,6),(1,7),\
	(6,5),(6,6),(7,5),(8,6),(7,7),\
	(10,11),(10,12),(10,13),(11,10),(11,11),(11,12),\
	(15,15),(15,16),(16,15),(16,16)] ## blink, bote, sapo e cubo; respectivamente
	#gun atira projeteis (precisa de um espaço grande)
	#~ vidas= [(12,15),(12,16),(13,14),(14,13),(15,13),(16,13),(17,14),(18,15),(18,16)]
	###
	
	## fim vidas
	mundo = vida.adiciona_vida(vidas,mundo)
	conta=0
	while 1:
		vida.printamundo(mundo)
		mundo = vida.vida(mundo)
		print("geração",conta)
		time.sleep(dormir)
		conta+=1
		os.system("clear")
Beispiel #4
0
def rodaEmConsole(mundoA, mundoL, dormir):
    #~ #### modo console
    mundo = vida.mundo(mundoA, mundoL)  ## mudar aqui o tamanho do mundo

    ######### vidas :
    #vidas imortais:
    vidas = [(1,5),(1,6),(1,7),\
    (6,5),(6,6),(7,5),(8,6),(7,7),\
    (10,11),(10,12),(10,13),(11,10),(11,11),(11,12),\
    (15,15),(15,16),(16,15),(16,16)] ## blink, bote, sapo e cubo; respectivamente
    #gun atira projeteis (precisa de um espaço grande)
    #~ vidas= [(12,15),(12,16),(13,14),(14,13),(15,13),(16,13),(17,14),(18,15),(18,16)]
    ###

    ## fim vidas
    mundo = vida.adiciona_vida(vidas, mundo)
    conta = 0
    while 1:
        vida.printamundo(mundo)
        mundo = vida.vida(mundo)
        print("geração", conta)
        time.sleep(dormir)
        conta += 1
        os.system("clear")