forked from 20241144010013/20241144010013
V2.0
This commit is contained in:
parent
13fa277cdf
commit
92a6efc621
|
@ -4,12 +4,39 @@ import random
|
|||
|
||||
posx = [-200, -100, 0, 100, 200]
|
||||
posy = [-200, -100, 0, 100, 200]
|
||||
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.setup(650,650,None,None)
|
||||
tl.title("Naval Battle 1943 Loading...")
|
||||
tl.speed(0)
|
||||
|
||||
#posições possiveis
|
||||
tiro_pos = {
|
||||
"A1": (200,200),
|
||||
"A2": (200,100),
|
||||
"A3": (200,0),
|
||||
"A4": (200,-100),
|
||||
"A5": (200,-200),
|
||||
"B1": (100,200),
|
||||
"B2": (100,100),
|
||||
"B3": (100,0),
|
||||
"B4": (100,-100),
|
||||
"B5": (100,-100),
|
||||
"C1": (0,200),
|
||||
"C2": (0,100),
|
||||
"C3": (0,0),
|
||||
"C4": (0,-100),
|
||||
"C5": (0,-200),
|
||||
"D1": (-100,200),
|
||||
"D2": (-100,100),
|
||||
"D3": (-100,0),
|
||||
"D4": (-100,-100),
|
||||
"D5": (-100,-200),
|
||||
"E1": (-200,200),
|
||||
"E2": (-200,100),
|
||||
"E3": (-200,0),
|
||||
"E4": (-200,-100),
|
||||
"E5": (-200,-200),
|
||||
}
|
||||
|
||||
|
||||
|
||||
#funções
|
||||
|
@ -33,18 +60,18 @@ linhay(300,-300)
|
|||
linhax(-300,300)
|
||||
|
||||
#linhas X
|
||||
linhax(-300,-200); tl.write("-200",False,align="right")
|
||||
linhax(-300,-100); tl.write("-100",False,align="right")
|
||||
linhax(-300,0); tl.write("0",False,align="right")
|
||||
linhax(-300,100); tl.write("100",False,align="right")
|
||||
linhax(-300,200); tl.write("200",False,align="right")
|
||||
linhax(-300,-200); tl.write("5",False,align="right")
|
||||
linhax(-300,-100); tl.write("4",False,align="right")
|
||||
linhax(-300,0); tl.write("3",False,align="right")
|
||||
linhax(-300,100); tl.write("2",False,align="right")
|
||||
linhax(-300,200); tl.write("1",False,align="right")
|
||||
|
||||
#linhas Y
|
||||
linhay(-200,-300); tl.write("-200",False,align="right")
|
||||
linhay(-100,-300); tl.write("-200",False,align="right")
|
||||
linhay(0,-300); tl.write("-200",False,align="right")
|
||||
linhay(100,-300); tl.write("-200",False,align="right")
|
||||
linhay(200,-300); tl.write("-200",False,align="right")
|
||||
linhay(-200,-300); tl.write("E",False,align="right")
|
||||
linhay(-100,-300); tl.write("D",False,align="right")
|
||||
linhay(0,-300); tl.write("C",False,align="right")
|
||||
linhay(100,-300); tl.write("B",False,align="right")
|
||||
linhay(200,-300); tl.write("A",False,align="right")
|
||||
#Tabuleiro pronto
|
||||
tl.title("Naval Battle 1943")
|
||||
tl.hideturtle()
|
||||
|
@ -55,7 +82,7 @@ boat.up(); boat.goto(0,0); boat.left(90)
|
|||
e1 = tl.Turtle()
|
||||
e1.up()
|
||||
e1.color("red")
|
||||
e1.goto(-100,-100)
|
||||
e1.goto(random.choice(posx), random.choice(posy))
|
||||
|
||||
|
||||
e2 = tl.Turtle()
|
||||
|
@ -78,15 +105,14 @@ if e2.pos() == e3.pos():
|
|||
#partidas
|
||||
win = False
|
||||
while win == False:
|
||||
tirox = tl.numinput("linha X do disparo","Em qual quadrante X devemos disparar a artilharia")
|
||||
tiroy = tl.numinput("linha Y do disparo","Em qual quadrante Y devemos disparar a artilharia")
|
||||
if (tirox,tiroy) == e1.pos():
|
||||
boat.goto(tirox,tiroy)
|
||||
tiro = tl.textinput("linha X do disparo","Em qual quadrante X devemos disparar a artilharia")
|
||||
if (tiro_pos[tiro]) == e1.pos() or (tiro_pos[tiro]) == e2.pos() or (tiro_pos[tiro]) == e3.pos():
|
||||
boat.goto(tiro_pos[tiro])
|
||||
print("Acerto!")
|
||||
boat.write("U-boat Afundado\n Capitão!",False,align="center")
|
||||
break
|
||||
else:
|
||||
boat.goto(tirox,tiroy)
|
||||
boat.goto(tiro_pos[tiro])
|
||||
print("errou!")
|
||||
boat.write("Erramos o alvo\n Capitão!",False,align="center")
|
||||
continue
|
||||
|
|
Loading…
Reference in New Issue