Zmiany env i tractor
This commit is contained in:
parent
a369f12928
commit
29632d3693
11
env.py
11
env.py
@ -92,6 +92,11 @@ def try_move(field, tractor):
|
||||
return True
|
||||
return False
|
||||
|
||||
def look_at_plats(field, location):
|
||||
wsp = []
|
||||
|
||||
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
||||
@ -110,9 +115,13 @@ if __name__ == "__main__":
|
||||
writer.write("OK\n".encode())
|
||||
else:
|
||||
writer.write("FAIL\n".encode())
|
||||
else:
|
||||
elif message[0] == "move":
|
||||
tractor.move()
|
||||
writer.write(("OK\n").encode())
|
||||
elif message[0] == "look":
|
||||
tractor.move()
|
||||
writer.write(("OK\n").encode())
|
||||
|
||||
|
||||
print_field(field, tractor)
|
||||
# print(tractor.get_position().get_x())
|
||||
|
@ -26,6 +26,14 @@ class Tractor:
|
||||
time.sleep(self.sleep_time)
|
||||
writer.close()
|
||||
|
||||
async def look_at_plants(self):
|
||||
reader, writer = await asyncio.open_connection('127.0.0.1', 8888)
|
||||
writer.write(("rotate " + direction + "\n").encode())
|
||||
await reader.readline()
|
||||
time.sleep(self.sleep_time)
|
||||
writer.close()
|
||||
|
||||
|
||||
async def try_move(self):
|
||||
reader, writer = await asyncio.open_connection('127.0.0.1', 8888)
|
||||
writer.write("try\n".encode())
|
||||
|
Loading…
Reference in New Issue
Block a user