This site requires JavaScript, please enable it in your browser!
Greenfoot back
ZigZagNinja
ZigZagNinja wrote ...

2017/9/14

Make Wombat move to every spot

ZigZagNinja ZigZagNinja

2017/9/14

#
So maybe this scenario is a little outdated but in the Wombat scenario I want to place the Wombat anywhere in the map and he´ll move to every single spot in the map so he can eat every leaf in the map if the hole map is filled with them. How do i change the Wombat source code, sothat he will do this?
danpost danpost

2017/9/14

#
ZigZagNinja wrote...
So maybe this scenario is a little outdated but in the Wombat scenario I want to place the Wombat anywhere in the map and he´ll move to every single spot in the map so he can eat every leaf in the map if the hole map is filled with them. How do i change the Wombat source code, sothat he will do this?
There are multiple ways to accomplish this. There are adding random turns; or moving random distances; or finding a corner and zig-zagging across the rows or columns; or finding a corner and counting steps across and down to spiral in toward the middle. I am quite sure there are even more ways. Some ways take longer than others; but all can be done with the standard one grid square moves or eat per each act step. How you want your wombat to transgress the grid will determine what kind of code you will use. Before anyone can help in this matter, you will need to both (a) post the current code you have in your Wombat class and (b) indicate which method of transgressing you require your wombat to have.
You need to login to post a reply.