-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathController.py
More file actions
63 lines (55 loc) · 1.83 KB
/
Controller.py
File metadata and controls
63 lines (55 loc) · 1.83 KB
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
import drawShipsandStuff
global scoresPlayer1, scoresPlayer2, inputFile1, inputFile2;
scoresPlayer1 = [ [0]*10 for _ in xrange(10) ]
inputFile1 = open("scoresp1.txt");
for i in xrange(10):
for j in xrange(10):
xx = inputFile1.readline();
xx = xx[:-1]
scoresPlayer1[i][j] = int(xx)
scoresPlayer2 = [ [0]*10 for _ in xrange(10) ]
inputFile2 = open("scoresp2.txt");
for i in xrange(10):
for j in xrange(10):
yy = inputFile2.readline();
yy = yy[:-1]
scoresPlayer2[i][j] = int(yy)
inputFile1.close();
inputFile2.close();
def checkAction(ownship, ship, x, y):
check = True
# x = (mx-360)/30
# y = (my)/30
if ship.delFromObject(y,x) == 'deleted':
print 'We got a hit Admiral!'
print x,y
scoresPlayer1[x][y]=scoresPlayer1[x][y]+1;
check = False
# draw.drawEnemyShip(draw.DISPLAYSURF, ship, x, y)
else:
print 'Nah! you suck :('
print x, y
scoresPlayer1[x][y]=scoresPlayer1[x][y]-1;
check = True
drawShipsandStuff.reDrawAll(ownship, ship, drawShipsandStuff.OWNSHIPCOLOR, 'own', drawShipsandStuff.DISPLAYSURF, x,y)
# zxc = input("asdfsdfdsaf")
return check
def checkAction1(ownship, ship, x, y):
check = True
# x = (mx)/30
# y = my/30
# print mx, my
if ship.delFromObject(y,x) == 'deleted':
print 'We got a hit Admiral!'
print x,y
scoresPlayer2[x][y] = scoresPlayer2[x][y]+1;
check = False
# draw.drawEnemyShip(draw.DISPLAYSURF, ship, x, y)
else:
print 'Nah! you suck :('
print x,y
scoresPlayer2[x][y]=scoresPlayer2[x][y]-1;
check = True
drawShipsandStuff.reDrawAll(ownship, ship, drawShipsandStuff.ENEMYSHIPCOLOR, 'enemy', drawShipsandStuff.DISPLAYSURF, x,y, 0)
# zxc = input("asdfsdfdsaf")
return check