-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtransp_tasks.py
65 lines (54 loc) · 1.44 KB
/
transp_tasks.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
import pyhop
def already_there(state):
print "Entro en already_there"
return state
def walk(state,driver,y):
print "Entro en walk"
print driver
print state.at_cond[driver]
if y in state.ruta_cond[state.at_cond[driver]]:
state.at_cond[driver]=y
return state
else:
return False
def drive(state,transp,y):
print "Entro en drive"
if y in state.ruta_cam[state.at_camiones[transp]]:
state.at_camiones[transp]=y
return state
else:
return False
def descarga(state,transp,paquete):
print "Entro en descarga"
ciudad=state.at_camiones[transp]
if state.at_paquete[paquete]==transp:
state.at_paquete[paquete]=ciudad
state.carga_camion[transp].remove(paquete)
return state
else:
return False
def carga(state,transp,paquete):
print "Entro en carga"
ciudad=state.at_paquete[paquete]
if state.at_camiones[transp]==ciudad:
state.at_paquete[paquete]=transp
state.carga_camion[transp].append(paquete)
return state
else:
return False
def subir_camion(state,transp,driver):
print "Entro en subir_camion"
if state.at_camiones[transp]==state.at_cond[driver]:
state.at_cond[driver]=transp
return state
else:
return False
def bajar_camion(state,transp,driver):
print "Entro en bajar_camion"
ciudad = state.at_camiones[transp]
if state.at_cond[driver]==transp:
state.at_cond[driver]=ciudad
return state
else:
return False
pyhop.declare_operators(walk,drive,carga,descarga,subir_camion,bajar_camion,already_there)