exemple grid test

4
GRID 3x3 String word1 = "ADA"; String word2 = "RAC"; String word3 = "DAN"; String word4 = "ANA"; GRID 9x9 String word1 = "ANCA"; String word2 = "CART"; String word3 = "MARI"; String word4 = "TATI"; String word5 = "ANA"; String word6 = "TALC"; String word7 = "STETOSCOP"; String word8 = "ALGORITM"; String word9 = "CIORBA"; String word10 = "RAD"; String word11 = "CROISANT"; GRID 10x10 String word1 = "ANCA"; String word2 = "CART"; String word3 = "MARI"; String word4 = "TATI"; String word5 = "ANA"; String word6 = "TALC"; String word7 = "STETOSCOP"; String word8 = "ALGORITM"; String word9 = "CIORBA"; String word10 = "RAD"; String word11 = "CROISANT"; String word12 = "CALCULATOR"; String word13 = "VACANTA"; Output cu VACANTA 0,0,0 1,1,1 1,2,9 0,7,1

Upload: anna-maria

Post on 14-Sep-2015

212 views

Category:

Documents


0 download

DESCRIPTION

WordSearch material

TRANSCRIPT

GRID 3x3

String word1 = "ADA";String word2 = "RAC";String word3 = "DAN";String word4 = "ANA";

GRID 9x9

String word1 = "ANCA";String word2 = "CART";String word3 = "MARI";String word4 = "TATI";String word5 = "ANA";String word6 = "TALC";String word7 = "STETOSCOP";String word8 = "ALGORITM";String word9 = "CIORBA";String word10 = "RAD";String word11 = "CROISANT";GRID 10x10

String word1 = "ANCA";String word2 = "CART";String word3 = "MARI";String word4 = "TATI";String word5 = "ANA";String word6 = "TALC";String word7 = "STETOSCOP";String word8 = "ALGORITM";String word9 = "CIORBA";String word10 = "RAD";String word11 = "CROISANT";String word12 = "CALCULATOR";String word13 = "VACANTA";Output cu VACANTA0,0,0

1,1,1

1,2,9

0,7,1

0,1,3

0,3,3

1,1,0

1,2,7

0,2,3

1,6,7

1,2,8

0,9,6

0,4,2Output fara VACANTA0,0,0

1,1,1

1,2,9

0,7,1

0,3,5

1,0,3

0,1,5

1,1,2

0,2,5

1,5,8

1,3,7

1,1,6

GRID 10X10

String word1 = "CANDELABRU";String word2 = "ANUNT";String word3 = "FEREASTRA";String word4 = "PLATFORMA";String word5 = "ANEMIC";String word6 = "TACAM";String word7 = "STETOSCOP";String word8 = "ALGORITM";String word9 = "CIORBA";String word10 = "RADU";String word11 = "CROISANT";String word12 = "CALCULATOR";String word13 = "VACANTA";Output:0,0,0

1,0,0

1,1,9

0,1,1

0,9,1

0,2,1

0,3,1

1,3,6

1,4,5

1,4,2

1,4,7

0,4,1

State s = (State) allStates.toArray()[allStates.size() - 1];s.printState();char[][] grid = new char[10][10];

for (int i = 0; i < 10; i++) {for (int j = 0; j < 10; j++) {grid[i][j] = '*';}}

for (String wordState : s.getState()) {int orientation = PuzzlePriorityQueue.getSplitedOrientation(wordState);int startColumn = PuzzlePriorityQueue.getSplitedColumn(wordState);int startRow = PuzzlePriorityQueue.getSplitedRow(wordState);String wordString = dictionary.get(s.getState().indexOf(wordState)).getWordString();int wordCharAt;if (orientation == 1) {wordCharAt = 0;for (int i = startRow; i < startRow + wordString.length(); i++) {grid[i][startColumn] = wordString.charAt(wordCharAt);wordCharAt++;}} else if (orientation == 0) {wordCharAt = 0;for (int j = startColumn; j < startColumn + wordString.length(); j++) {grid[startRow][j] = wordString.charAt(wordCharAt);wordCharAt++;}}}

for (int i = 0; i < 4; i++) {for (int j = 0; j < 4; j++) {System.out.print(grid[i][j] + " ");}System.out.println();}