• Post Reply Bookmark Topic Watch Topic
  • New Topic

GridWorld MoveSouthActor  RSS feed

 
Ashley Eat
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm using GridWorld, and trying to complete this lab, but I can't seem to get the Actor to move correctly. When I run the program, only my gif is visible, but it doesn't move...

The prompt is as follows:
Make a new actor that will only move SOUTH. When the actor reaches the bottom row, then the actor should move to the top most row and restart its march to the SOUTH. The actor should only move to valid cells in the grid. (Assume that if the cell is valid, it is also empty.)
 
Piet Souris
Master Rancher
Posts: 2044
75
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi Ashely,

just did a quick search for Gridworld, and I read what was written on Wikipedia.
It says that the Actor class manages, amongst other things, the direction.

Well, I suppose the gridworld has some coordinate system, where each grid square
is referenced by some (x, y) coordinate pair, y indicating the row of the grid.
(if not, then ignore the rest of this reply).

If that is so, then you must decrement the y value of the Actor in some form of loop,
and after each y adjustment check if y has become less (or more, depending on the
the coordinate system) then the bottom row of the grid. If so, put y = 0, and there
you go again.

From the text supplied you should check whether this jump does not lead to some occupied
square.

If all this is not relevant to how Gridworld operates, then tell us how how it does operate.

Greetings,
Piet
 
Consider Paul's rocket mass heater.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!