I think thats my question? Basically this code won't work no matter how many ways I try it. The state won't set to the given array.
if(difficulty == "easy") {
state= new int[] {1,3,4,8,6,2,7,0,5};
blankTile = 7;
Node start = new Node(difficulty,state,blankTile);
openList.add(start);
}
else if(difficulty == "medium") {
state= new int[] {2,8,1,0,4,3,7,6,5};
blankTile = 3;
Node start = new Node(difficulty,state,blankTile);
openList.add(start);
}
else if(difficulty == "hard") {
state= new int[] {2,8,1,4,6,3,0,7,5};
blankTile = 6;
Node start = new Node(difficulty,state,blankTile);
openList.add(start);
}
else if(difficulty == "worst"){
state= new int[] {5,6,7,4,0,8,3,2,1};
blankTile = 4;
Node start = new Node(difficulty,state,blankTile);
openList.add(start);
}
I had this in the constructor of Node at first, where I would just pass in difficulty and it would set the state and blankTile in the constructor. but that wasn't working either. Would somebody be kind enough to help me?