forked from 20241144010013/20241144010013
batalha naval v1.0
This commit is contained in:
parent
2f4ed66753
commit
13fa277cdf
|
@ -1,11 +1,13 @@
|
||||||
#setup
|
#setup
|
||||||
import turtle as tl
|
import turtle as tl
|
||||||
import random
|
import random
|
||||||
import time as tm
|
|
||||||
posx = [-300, -250, -200, -150, -100, -50, 50, 100, 150, 200, 250, 300]
|
posx = [-200, -100, 0, 100, 200]
|
||||||
posy = [-300, -250, -200, -150, -100, -50, 50, 100, 150, 200, 250, 300]
|
posy = [-200, -100, 0, 100, 200]
|
||||||
tl.setup(600,600,None,None)
|
postiro = ['-200 -200', '-200 -100', '-200 0', '-200 100', '-200 200', '-100 -200', '-100 -100', '-100 0', '-100 100', '-100 200', '0 -200', '0 -100', '0 0', '0 100', '0 200', '100 -200', '100 -100', '100 0', '100 100', '100 200', '200 -200', '200 -100', '200 0', '200 100', '200 200']
|
||||||
tl.title("U-Boat Radar 1943")
|
|
||||||
|
tl.setup(650,650,None,None)
|
||||||
|
tl.title("Naval Battle 1943 Loading...")
|
||||||
tl.speed(0)
|
tl.speed(0)
|
||||||
|
|
||||||
|
|
||||||
|
@ -29,31 +31,22 @@ linhax(-300,-300)
|
||||||
linhay(-300,-300)
|
linhay(-300,-300)
|
||||||
linhay(300,-300)
|
linhay(300,-300)
|
||||||
linhax(-300,300)
|
linhax(-300,300)
|
||||||
|
|
||||||
#linhas X
|
#linhas X
|
||||||
linhax(-300,-250)
|
linhax(-300,-200); tl.write("-200",False,align="right")
|
||||||
linhax(-300,-200)
|
linhax(-300,-100); tl.write("-100",False,align="right")
|
||||||
linhax(-300,-150)
|
linhax(-300,0); tl.write("0",False,align="right")
|
||||||
linhax(-300,-100)
|
linhax(-300,100); tl.write("100",False,align="right")
|
||||||
linhax(-300,-50)
|
linhax(-300,200); tl.write("200",False,align="right")
|
||||||
linhax(-300,0)
|
|
||||||
linhax(-300,50)
|
|
||||||
linhax(-300,100)
|
|
||||||
linhax(-300,150)
|
|
||||||
linhax(-300,200)
|
|
||||||
linhax(-300,250)
|
|
||||||
#linhas Y
|
#linhas Y
|
||||||
linhay(-250,-300)
|
linhay(-200,-300); tl.write("-200",False,align="right")
|
||||||
linhay(-200,-300)
|
linhay(-100,-300); tl.write("-200",False,align="right")
|
||||||
linhay(-150,-300)
|
linhay(0,-300); tl.write("-200",False,align="right")
|
||||||
linhay(-100,-300)
|
linhay(100,-300); tl.write("-200",False,align="right")
|
||||||
linhay(-50,-300)
|
linhay(200,-300); tl.write("-200",False,align="right")
|
||||||
linhay(0,-300)
|
|
||||||
linhay(50,-300)
|
|
||||||
linhay(100,-300)
|
|
||||||
linhay(150,-300)
|
|
||||||
linhay(200,-300)
|
|
||||||
linhay(250,-300)
|
|
||||||
#Tabuleiro pronto
|
#Tabuleiro pronto
|
||||||
|
tl.title("Naval Battle 1943")
|
||||||
tl.hideturtle()
|
tl.hideturtle()
|
||||||
boat = tl.Turtle()
|
boat = tl.Turtle()
|
||||||
boat.up(); boat.goto(0,0); boat.left(90)
|
boat.up(); boat.goto(0,0); boat.left(90)
|
||||||
|
@ -62,7 +55,7 @@ boat.up(); boat.goto(0,0); boat.left(90)
|
||||||
e1 = tl.Turtle()
|
e1 = tl.Turtle()
|
||||||
e1.up()
|
e1.up()
|
||||||
e1.color("red")
|
e1.color("red")
|
||||||
e1.goto(random.choice(posx), random.choice(posy))
|
e1.goto(-100,-100)
|
||||||
|
|
||||||
|
|
||||||
e2 = tl.Turtle()
|
e2 = tl.Turtle()
|
||||||
|
@ -85,10 +78,19 @@ if e2.pos() == e3.pos():
|
||||||
#partidas
|
#partidas
|
||||||
win = False
|
win = False
|
||||||
while win == False:
|
while win == False:
|
||||||
print("Ola Comandante, Onde devemos bombardear:")
|
tirox = tl.numinput("linha X do disparo","Em qual quadrante X devemos disparar a artilharia")
|
||||||
tiro1 = int(input("Onde miraremos a primeira salva:"))
|
tiroy = tl.numinput("linha Y do disparo","Em qual quadrante Y devemos disparar a artilharia")
|
||||||
tiro2 = int(input("Onde miraremos a segunda salva"))
|
if (tirox,tiroy) == e1.pos():
|
||||||
tiro3 = int(input("Onde miraremos a terceira salva"))
|
boat.goto(tirox,tiroy)
|
||||||
|
print("Acerto!")
|
||||||
|
boat.write("U-boat Afundado\n Capitão!",False,align="center")
|
||||||
|
break
|
||||||
|
else:
|
||||||
|
boat.goto(tirox,tiroy)
|
||||||
|
print("errou!")
|
||||||
|
boat.write("Erramos o alvo\n Capitão!",False,align="center")
|
||||||
|
continue
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue