I am trying to do an assignment using Gridworld, a case study put out as part of the AP CS curriculum. Could anyone familiar with Gridworld tell me what the method getDirectionToward(Location target) does exactly? I think I need to use it for an assignment in which I need to be able to tell if one object is facing another, but the documentation isnt helpful, stating that it “returns the closest compass direction toward target.” I’m not exactly sure what that even means.
Thanks
I am trying to do an assignment using Gridworld, a case study put out
Share
It returns the closest compass direction towards the
target. The direction system in GridWorld (Page B1 for theLocationclass) works with the following integer constants (IE, the method will only return one of these constants):