-
Notifications
You must be signed in to change notification settings - Fork 0
/
test_encora.py
76 lines (59 loc) · 1.31 KB
/
test_encora.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
# Problem :
# You have to implement a point animation screen, something similar to this: https://www.youtube.com/watch?v=5mGuCdlCcNM
# For this problem
# - Assume you already have a grid to draw(x, y) or erase(x, y)
# - Assume you already have functions, whose will draw and erase
# - The point/ball needs to bounce in each edge of the screen
x_dvd, y_dvd = 100, 100
def draw(x, y):
pass
def erase(x, y):
pass
def movimiento(x_dvd,y_dvd):
draw(x_dvd, y_dvd)
time.sleep(2)
erase(x_dvd, y_dvd)
def validacion():
if x_dvd+5 <= x_limit and y_dvd+5 <= y_limit:
movimiento(x_dvd+5, y_dvd+5)
x_dvd = x_dvd+5
y_dvd = y_dvd+5
elif x_dvd+5 > x_limit:
movimiento(x_dvd-5, y_dvd)
x_dvd = x_dvd+5
y_dvd = y_dvd-5
elif y_dvd+5 > y_limit:
movimiento(x_dvd+5, y_dvd-5)
x_dvd = x_dvd+5
y_dvd = y_dvd-5
x_limit = 200
y_limit = 200
while:
validacion()
A
########################
# #
# #
A# #
# #
# #100 *
# # *
# #*
# *#
# * * #
# * #
############
200, 100
B
############
# #
# #
# #
# #
# #
# #
# #
# *#
# * * #
# * #
############