dragonsword40's Profile User Rating: -----

Reputation: 0 Apprentice
Group:
New Members
Active Posts:
2 (0 per day)
Joined:
01-May 12
Profile Views:
846
Last Active:
User is offline May 01 2012 09:18 AM
Currently:
Offline

Previous Fields

Dream Kudos:
0
Icon   dragonsword40 has not set their status

Posts I've Made

  1. In Topic: GridWorld Problem

    Posted 1 May 2012

    Plus for the isValid method you should just use the method that is in BoundedGrid, which is what is below. You don't have to have that long if else statement. The computer will check what is below itself, and whether that is true or false that is what it will return.

    public boolean isValid(Location loc)
        {
            return 0 <= loc.getRow() && loc.getRow() < getNumRows()
                    && 0 <= loc.getCol() && loc.getCol() < getNumCols();
        }
     
    


    also in your isValid method you have equals signs next to the less than row and col part you should remove those equals signs the equals for the 0 part though are suppose to stay.
  2. In Topic: GridWorld Problem

    Posted 1 May 2012

    First off I copied everything from the resource file for gridworld to my own packages and classes, but kept the same names. First thing I recommend is keep the Tester in the default package, but move the other two to info.gridworld.grid package. The second thing I did was I made a copy of the image BoundedGrid.gif and changed the copies name to SparseGrid.gif, so that instead of null appearing next to what is the SparseGrid command in the menu there is an image of a grid next to that command. The third thing I noticed is that for the UnboundedGrid and BoundedGrid they both use 2 values for the thing that holds the data, while yours only uses one. I'm currently working on changing the code, so I have yet to find the complete solution, but those three things could help.

    Also I moved the addcommand for the Sparse grid directly into the World Class and below is what that looks like
     
    public World(Grid<T> g){
        gr = g;
        gridClassNames = new TreeSet<String>();
        occupantClassNames = new TreeSet<String>();
        addGridClass("info.gridworld.grid.BoundedGrid");
        addGridClass("info.gridworld.grid.UnboundedGrid");
        addGridClass("info.gridworld.grid.SparseGrid");
    }
    
    

My Information

Member Title:
New D.I.C Head
Age:
Age Unknown
Birthday:
Birthday Unknown
Gender:

Contact Information

E-mail:
Private

Friends

dragonsword40 hasn't added any friends yet.

Comments

dragonsword40 has no profile comments yet. Why not say hello?