fix package, fix get random node

This commit is contained in:
Loredana Crusoveanu 2018-08-25 20:36:12 +03:00
parent f60debdcd3
commit aa8afa5b6e
13 changed files with 13 additions and 13 deletions

View File

@ -87,7 +87,7 @@ public class State {
void randomPlay() {
List<Position> availablePositions = this.board.getEmptyPositions();
int totalPossibilities = availablePositions.size();
int selectRandom = (int) (Math.random() * ((totalPossibilities - 1) + 1));
int selectRandom = (int) (Math.random() * totalPossibilities);
this.board.performMove(this.playerNo, availablePositions.get(selectRandom));
}

View File

@ -65,7 +65,7 @@ public class Node {
public Node getRandomChildNode() {
int noOfPossibleMoves = this.childArray.size();
int selectRandom = (int) (Math.random() * ((noOfPossibleMoves - 1) + 1));
int selectRandom = (int) (Math.random() * noOfPossibleMoves);
return this.childArray.get(selectRandom);
}

View File

@ -1,4 +1,4 @@
package algorithms;
package com.baeldung.algorithms;
import org.junit.Assert;
import org.junit.Test;

View File

@ -1,4 +1,4 @@
package algorithms;
package com.baeldung.algorithms;
import org.junit.Assert;
import org.junit.Test;

View File

@ -1,4 +1,4 @@
package algorithms;
package com.baeldung.algorithms;
import com.baeldung.algorithms.hillclimbing.HillClimbing;
import com.baeldung.algorithms.hillclimbing.State;

View File

@ -1,4 +1,4 @@
package algorithms;
package com.baeldung.algorithms;
import com.baeldung.algorithms.middleelementlookup.MiddleElementLookup;
import com.baeldung.algorithms.middleelementlookup.Node;

View File

@ -1,4 +1,4 @@
package algorithms;
package com.baeldung.algorithms;
import com.baeldung.algorithms.automata.*;
import org.junit.Test;

View File

@ -1,4 +1,4 @@
package algorithms;
package com.baeldung.algorithms;
import org.junit.Assert;
import org.junit.Test;

View File

@ -1,4 +1,4 @@
package algorithms;
package com.baeldung.algorithms;
import org.junit.Assert;

View File

@ -1,4 +1,4 @@
package algorithms.binarysearch;
package com.baeldung.algorithms.binarysearch;
import java.util.Arrays;
import java.util.List;

View File

@ -1,4 +1,4 @@
package algorithms.mcts;
package com.baeldung.algorithms.mcts;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;

View File

@ -1,4 +1,4 @@
package algorithms.minimax;
package com.baeldung.algorithms.minimax;
import org.junit.Before;
import org.junit.Test;