toyrobot/trexamples.py

31 lines
638 B
Python
Raw Normal View History

#!/usr/bin/env python3
import toyrobot
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)
def main():
print('a)')
feed_file('example_a.txt', toyrobot.Robot())
print()
print('b)')
feed_file('example_b.txt', toyrobot.Robot())
print()
print('c)')
feed_file('example_c.txt', toyrobot.Robot())
print()
print('d)')
feed_file('example_d.txt', toyrobot.Robot())
print()
if __name__ == "__main__":
main()