Pergunta

I am trying to follow the steps to change the Gridworld appearance according to this. I've already imported source code for my gridworld jar file; ie. I can go and look at Bug.class or Gridpanel.class if I wanted to. However, I can't edit these files to produce the results that that pdf suggests. How do I do this? Did I import the source code incorrectly?

Foi útil?

Solução

I don't think you can edit an external resource like gridworld.jar. You are going to need to create 4 new packages:

  • actor
  • grid
  • gui
  • world

Then copy the class files from gridworld.jar packages into your corresponding ones. Now you can edit the files. Make sure you include any miscellaneous files that might also be in the gridworld.jar packages, their important.

With your own packages you no longer need the gridworld.jar external resource, and there is a difference in your import statements. Instead of

import gridworld.actor.Actor;

Do this:

import actor.Actor;

Note: You will need to change all of the import statements in the new package classes to reference the other new packages. I believe that there were also some errors, not project breaking, but I just added suppressors.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top