2 public Tile( int n, int s, int e, int w ) {
13 Tile t = new Tile( n, s, e, w );
17 public void printTile() {
18 printRow0(); System.printString("\n");
19 printRow1(); System.printString("\n");
20 printRow2(); System.printString("\n");
21 printRow3(); System.printString("\n");
22 printRow4(); System.printString("\n");
25 public void printRow0(){ System.printString( "+-------+" ); }
26 public void printRow1(){ if( n < 0 ) {
27 System.printString( "| " );
29 System.printString( "| " ); }
31 System.printString( " |" ); }
32 public void printRow2(){ if( w < 0 ) {
33 System.printString( "|" );
35 System.printString( "| " ); }
38 System.printString( " " );
40 System.printString( " " ); }
42 System.printString( " |" ); }
43 public void printRow3(){ if( s < 0 ) {
44 System.printString( "| " );
46 System.printString( "| " ); }
48 System.printString( " |" ); }
49 public void printRow4(){ System.printString( "+-------+" ); }
51 // position in the grid
52 // this information is also represented by
53 // the indices into a TileGrid, but it is
54 // convenient to duplicate it