|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcs131test.tron.TronStateUtil
public class TronStateUtil
A sample solution of the state utilities. April 2010
| Constructor Summary | |
|---|---|
TronStateUtil()
|
|
| Method Summary | |
|---|---|
static java.lang.String |
dump(TronStateInterface state)
Generates and returns a multi-line string representing a human-readable pretty version of the board. |
static java.lang.String |
toString(TronStateInterface state)
Generates and returns a single line string that must contain exactly (dim*dim) string representations of integers separated by commas (with no spaces), where dim is the dimension of the board. |
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public TronStateUtil()
| Method Detail |
|---|
public static java.lang.String dump(TronStateInterface state)
The string must have multiple lines separated by '\n'. There must be one line per row of the board, and each line must have exactly the same number characters as the width of the board. In other words, the string should be displayed as a grid of characters, one per cell in the board. The characters should be:
Unlike in the previous project, you do not have any flexibility in what this method generates - it must create a string exactly as described above.
public static java.lang.String toString(TronStateInterface state)
A simple example would be as follows for a 4x4 board with one obstacle in the lower-left, and two short traces ending in heads in the upper-left and upper-right corners, respectively: "-2,-1,-1,-2,0,-1,-1,1,0,-1,-1,1,-3,-1,-1,-1".
Note that toString() is used by the tournament engine, so it won't have any impact anywhere except there (and in the release tests.)
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||