After playing around with what was given to us, the wombat and leaf actors, we decided to create our own actor, Man. Studying the wombat subclass, we were able to edit it and make the man eat the wombat, much like the wombat eats the leaves. Then we stationed the man at some points on the grid, and as the wombat travels around and runs into the man, it will be eaten. One thing that we learned doing this is that if you put multiple wombats on top of each other on the same grid location and run them (act()), once they both run into the man class, one of the wombats will escape while the other is eaten. We also put a leaf and man on the same grid location and once the wombat reaches that location, the man eats the wombat before the wombat eats the leaf. However, if there are many wombats stacked that go over the man class, one of the wombats will actually eat the leaf and escape without getting eaten.
Before:
No comments:
Post a Comment