<p>In Gridworld, what does "valid" loc for the Grid interface? Does it mean it doesn't have any Actors on the location?</p>
<p>Say you have a Grid that is 10 rows by 10 columns and a Location loc.</p>
<p>If that method returns true, then loc.getRow() is from 0 to 9 and loc.getCol() is from 0 to 9.</p>
<p>If it is false, then each is either negative or greater than 9. </p>
<p>It basically checks if the location is within the bounds for the grid.</p>
<p>if loc == null then loc has no actor in it. Otherwise, it has something in it.</p>
<p>Oh, I see now.</p>
<p>Also, in general if you extend one of the Bug or Critter Classes and create say xBug or jumpCritter, and you need to modify one of the methods. What happens to the original method? You’re overriding the method, right? Do I need to rewrite the entire thing if I need to change just one line or can I just change that one line and end brace? Finally, how does “super” work then?</p>
<p>I say general because extending classes isn’t just for the GridWorld classes.</p>
<p>Thank you OtherWindow, I know you’ve been so much help. I’m not sure if you’re taking any APs this year, but if you do, don’t hesitate to ask me questions in what you’re taking, I’ll try my best to help you :)</p>
<p>If you modify the method, you override it. It’ll use the subclass’ method. Unless you do something like Bug bug = new XBug(); and try to use an XBug’s method that you’ve already overridden. I think it’ll use the method from Bug. If you want the code from the super method, you say super(parameter) in the method’s body and it’ll do whatever the super method does to the parameter. If it takes no parameters, just say super(). Otherwise you’re going to have to copy down whatever you need.</p>
<p>Hopefully that’s a lucid explanation. I hate GridWorld though…haha.</p>
<p>Wait, no, I was wrong. With Bug bug = new XBug(), it’ll use XBug’s method as long as the method is polymorphic; “left legality,” unless you cast bug to be an XBug while using a method that is unique to XBug.</p>