-
Notifications
You must be signed in to change notification settings - Fork 0
/
hit.py
103 lines (71 loc) · 2.14 KB
/
hit.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
from random import randint
import request
import pygame
from pygame.locals import *
import startNewGame
pygame.init()
screen = pygame.display.set_mode((800, 600))
lovit=[]
<<<<<<< HEAD
def hit(x,y):
print("Am pornit")
print(x,y)
if (s[x-1][y-1]=="1") :
print("lovit")
for i in range(0,4):
m,n=xoy[i]
if(x+m<11)&(y+n<11)&(x+m>-1)&(y+n>-1):
if (request.request(chr(x+m-1+ord('A')),y+n+1)in["HIT","DESTROYED"]) & ((x+m,y+n) not in lovit):
hit(x+m,y+n)
lovit.append((m+x,n+y))
=======
>>>>>>> origin/master
def hit(x, y):
pygame.draw.rect(screen, (255, 0, 0), Rect(x*26, y*26, 25, 25))
pygame.display.update()
def search(x,y):
print("Am pornit")
print(x,y)
for i in range(0,4):
m,n=xoy[i]
if(x+m<11)&(y+n<11)&(x+m>-1)&(y+n>-1):
lovit.append((x, y))
if (request.request(chr(x+m-1+ord('A')),y+n+1)in["HIT","DESTROYED"]) & ((x+m,y+n) not in lovit):
search(x+m,y+n)
hit(m+x,n+y)
running = True
startNewGame.startNewGame(1)
xoy=[(0,-1),(1,0),(0,1),(-1,0)]
while running:
for event in pygame.event.get():
if event.type == QUIT:
running = False
while len(lovit)<100:
x=randint(1,10)
y=randint(1,10)
g=chr(x+ord('A')-1)
if (request.request(g,y)in["HIT","DESTROYED"]) & ((x,y) not in lovit):
hit(x, y)
search(x,y)
else:
lovit.append((x, y))
print(request.request(g,y)+str(g)+str(y))
print("Gata!")
<<<<<<< HEAD
for event in pygame.event.get():
if event.type == QUIT:
running = False
ok=True
file=open("matrix.txt","r")
s=file.readlines()
while len(lovit)<100:
x= randint(1,10)
y=randint(1,10)
g=chr(x+ord('A')-1)
if (request.request(g,y)in["HIT","DESTROYED"]) & ((x,y) not in lovit):
lovit.append((x,y))
hit(x,y)
print(request.request(g,y)+str(g)+str(y))
pygame.display.update()
=======
>>>>>>> origin/master