This repository was archived by the owner on Apr 10, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathadvait.py
More file actions
56 lines (56 loc) · 1.77 KB
/
advait.py
File metadata and controls
56 lines (56 loc) · 1.77 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
def moveon(key='0'):
global pos
check()
over()
print(pos)
if(pos[0]==[px,py]):
size()
if(key=='0'):
if(pos[0][0]>pos[1][0] and pos[0][1]==pos[1][1]):
temp=[pos[0][0],pos[0][1]]
pos[0][0]=pos[0][0]+10
shift(temp)
if(pos[0][0]<pos[1][0] and pos[0][1]==pos[1][1]):
temp=[pos[0][0],pos[0][1]]
pos[0][0]=pos[0][0]-10
shift(temp)
if(pos[0][1]>pos[1][1] and pos[0][0]==pos[1][0]):
temp=[pos[0][0],pos[0][1]]
pos[0][1]=pos[0][1]+10
shift(temp)
if(pos[0][1]<pos[1][1] and pos[0][0]==pos[1][0]):
temp=[pos[0][0],pos[0][1]]
pos[0][1]=pos[0][1]-10
shift(temp)
if(key!='0'):
print(key)
if(str(key)=='38'and pos[0][1]==pos[1][1] and pos[0][1]!=10):
temp=[pos[0][0],pos[0][1]]
pos[0][1]-=10
print(key)
shift(temp)
if(str(key)=='39'and pos[0][1]!=pos[1][1] and pos[0][0]!=490):
temp=[pos[0][0],pos[0][1]]
pos[0][0]+=10
print(key)
shift(temp)
if(str(key)=='40'and pos[0][1]==pos[1][1] and pos[0][1]!=490):
temp=[pos[0][0],pos[0][1]]
pos[0][1]+=10
print(key)
shift(temp)
if(str(key)=='37'and pos[0][1]!=pos[1][1] and pos[0][0]!=0):
temp=[pos[0][0],pos[0][1]]
pos[0][0]-=10
print(key)
shift(temp)
def size():
global pos,px,py
n=len(pos)
if(pos[n-2][0]==pos[n-1][0]):
pos.append([pos[n-1][0],pos[n-1][1]+10])
elif(pos[n-2][1]==pos[n-1][1]):
pos.append([pos[n-1][0]+10,pos[n-1][1]])
px,py=random.randint(1,49),random.randint(1,49)
px*=10
py*=10