SearchTest Code
/**
* SearchTest - apply a search algorithm to a root search node
*
* @author Todd Neller
* @version 1.0
*
Copyright (C) 2003 Todd Neller
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
Information about the GNU General Public License is available online at:
http://www.gnu.org/licenses/
To receive a copy of the GNU General Public License, write to the Free
Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
02111-1307, USA.
*/
public class SearchTest {
int[][] map;
int goal;
int start;
public SearchTest(int[][] _map, int _start, int _goal) {
map = _map;
start = _start;
goal = _goal;
}
public int[] findit() {
BreadthFirstSearcher searcher = new BreadthFirstSearcher();
// Create the root search node (uncomment desired code)
//PegSolitaireNode root = new PegSolitaireNode();
MapNode root = new MapNode(start, map, goal);
if (searcher.search(root)) {
//This will get an array of
int[] fart = searcher.getGoalPath(searcher.getNodeCount());
int[] x = new int[fart.length];
for(int i = 0; i < fart.length; i++) {
x[i] = fart[fart.length - i - 1];
}
return x;
}
return null;
}
/**
* main
- apply a search algorithm to a root search
* node
*
* @param args a String[]
value */
public static void main(String[] args) {
}
} // SearchTest