2023-10-07 07:07:44 +00:00
|
|
|
#!/usr/bin/env python3
|
|
|
|
|
|
|
|
import toyrobot
|
|
|
|
|
2023-11-15 02:32:08 +00:00
|
|
|
|
2023-10-07 07:07:44 +00:00
|
|
|
def feed_file(filename: str, robot: toyrobot.Robot):
|
|
|
|
with open(filename) as f:
|
|
|
|
for line in f:
|
|
|
|
line = line.strip()
|
|
|
|
print(line)
|
|
|
|
robot.interpret_command(line)
|
|
|
|
|
2023-11-15 02:32:08 +00:00
|
|
|
|
2023-10-07 07:07:44 +00:00
|
|
|
def main():
|
|
|
|
print('a)')
|
2023-10-07 07:26:17 +00:00
|
|
|
feed_file('example_a.txt', toyrobot.Robot())
|
2023-10-07 07:07:44 +00:00
|
|
|
print()
|
|
|
|
|
|
|
|
print('b)')
|
2023-10-07 07:26:17 +00:00
|
|
|
feed_file('example_b.txt', toyrobot.Robot())
|
2023-10-07 07:07:44 +00:00
|
|
|
print()
|
|
|
|
|
|
|
|
print('c)')
|
2023-10-07 07:26:17 +00:00
|
|
|
feed_file('example_c.txt', toyrobot.Robot())
|
2023-10-07 07:07:44 +00:00
|
|
|
print()
|
|
|
|
|
|
|
|
print('d)')
|
2023-10-07 07:26:17 +00:00
|
|
|
feed_file('example_d.txt', toyrobot.Robot())
|
2023-10-07 07:07:44 +00:00
|
|
|
print()
|
|
|
|
|
2023-11-15 02:32:08 +00:00
|
|
|
print('e)')
|
|
|
|
feed_file('example_e.txt', toyrobot.Robot())
|
|
|
|
print()
|
|
|
|
|
|
|
|
print('f)')
|
|
|
|
feed_file('example_f.txt', toyrobot.Robot())
|
|
|
|
print()
|
2023-10-07 07:07:44 +00:00
|
|
|
if __name__ == "__main__":
|
|
|
|
main()
|