java - Choosing design method for ladder-like word game -


I am trying to create a simple application, with the program ending in this way:

< P>

I have to apply two separate GUI layouts for this too. Now I am trying to figure out the best way to do this. My professor asked me to present element class with 4 states:
- empty
- invisible (used in grid layout)

first letter
- other letter < / P>

I thought about the following solutions (I have any collection from the list): 1. Element is a letter, and each row element is []. The array of game array arrays will be [] I think this is the worst way, and verification can be problematic.
Like before but there is a list of line elements There is an array of game lines.
Like before but there is a list of game lines.

Whom should I choose? Or do you have better ideas? What collections would be best to use one?

Your grid is your internal data model (i.e. none other than yours will use it) This is the reason why you can choose one that is most valid for you.

I like the first solution with Array because the code will be slightly more readable (at least for me) just compare:

  grid [3] [4] = Element;  

and

  grid.get (3) .add (4, element);  

In addition, if you want to use the archive, you may

  map & lt; Integer, list & lt; Element & gt; & Gt; Grid  

where integer line row index represents, it is very difficult to incorporate new words with lists of lists (just think, how would you implement with list only)


Comments