-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathcomputer.py
More file actions
42 lines (31 loc) · 765 Bytes
/
computer.py
File metadata and controls
42 lines (31 loc) · 765 Bytes
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
class Computer:
def __init__(self, name=None, robots=[]):
self.name = name
self.robots = robots
def check(self, name):
# 数据库读取名字
# 验证用户是否存在
return True
def fetchProd(self, product):
# print("hhh")
# hasGot = False
for robot in self.robots:
# print("hhhh")
if robot.self_check()==True and robot.use==False:
# print("hhhhhh")
# 标记机器人正在运送
# robot.setInUse()
robot.move(product)
break
# print("fetchProd")
# print(hasGot)
# return hasGot
def control(self, computer):
pass
# for item in prod_list
def addRobot(self, robot):
self.robots.append(robot)
def delRobot(self, robot):
index = robots.index(robot)
if index!=-1:
self.robots.pop(index)