Question: PlayerRandom.java class contents: package ca . yorku.eecs 3 3 1 1 . a 1 ; import java.util.ArrayList; import java.util.Random; / * * * PlayerRandom makes

PlayerRandom.java class contents: package ca.yorku.eecs3311.a1; import java.util.ArrayList; import java.util.Random; /*** PlayerRandom makes a move by first determining all possible moves that this * player can make, putting them in an ArrayList, and then randomly choosing one * of them. ** @author ilir **/ public class PlayerRandom { private Random rand = new Random(); public Move getMove(){ return null; }} The test cases are saved in three classes. The test case classes are: MoveTest.java, OthelloBoardTest.java and OthelloTest.java. Don't change those test case classes but use them as a reference to understand how to modify and implement those 10 classes to test all of these test cases below. MoveTest.java class contents which shouldn't be changed: package ca.yorku.eecs3311.a1test; import static org.junit.Assert.*; import org.junit.Test; import static org.junit.Assert.*; import org.junit.Before; import org.junit.Test; import ca.yorku.eecs3311.a1.Move; public class MoveTest { Move move; @Before public void setUp() throws Exception { move=new Move(3,5); } @Test public void testGetRow(){ assertEquals("getRow", move.getRow(),3); } @Test public void testGetCol(){ assertEquals("getCol", move.getCol(),5); } @Test public void testToString(){ assertEquals("toString", move.toString(),"(3,5)"); }} OthelloBoardTest.java class contents which shouldn't be changed: package ca.yorku.eecs3311.a1test; import static org.junit.Assert.*; import org.junit.Before; import org.junit.Test; import ca.yorku.eecs3311.a1.Move; import ca.yorku.eecs3311.a1.Othello; import ca.yorku.eecs3311.a1.OthelloBoard; public class OthelloBoardTest { OthelloBoard board; Move[] moves ={ new Move(2,4), new Move(2,5), new Move(2,6), new Move(2,3), new Move(2,2), new Move(3,2), new Move(4,2), new Move(5,4), new Move(6,4)}; @Before public void setUp() throws Exception { board=new OthelloBoard(Othello.DIMENSION); //8x8 board board.move(2,4, OthelloBoard.P1); board.move(2,5, OthelloBoard.P2); board.move(2,6, OthelloBoard.P1); board.move(2,3, OthelloBoard.P2); // Board now looks like //01234567//+-+-+-+-+-+-+-+-+//0|||||||||0//+-+-+-+-+-+-+-+-+//1|||||||||1//+-+-+-+-+-+-+-+-+//2||||O|X|X|X||2//+-+-+-+-+-+-+-+-+//3||||O|O||||3//+-+-+-+-+-+-+-+-+//4||||O|X||||4//+-+-+-+-+-+-+-+-+//5|||||||||5//+-+-+-+-+-+-+-+-+//6|||||||||6//+-+-+-+-+-+-+-+-+//7|||||||||7//+-+-+-+-+-+-+-+-+//01234567//// X:4 O:4 X moves next // row: col: X makes move (2,2)////01234567//+-+-+-+-+-+-+-+-+//0|||||||||0//+-+-+-+-+-+-+-+-+//1|||||||||1//+-+-+-+-+-+-+-+-+//2|||X|X|X|X|X||2//+-+-+-+-+-+-+-+-+//3||||X|O||||3//+-+-+-+-+-+-+-+-+//4||||O|X||||4//+-+-+-+-+-+-+-+-+//5|||||||||5//+-+-+-+-+-+-+-+-+//6|||||||||6//+-+-+-+-+-+-+-+-+//7|||||||||7//+-+-+-+-+-+-+-+-+//01234567//// X:7 O:2 O moves next } @Test public void testOthelloBoard(){ OthelloBoard b=new OthelloBoard(Othello.DIMENSION); // Check initial position assertEquals("Initial tokens P1",b.get(3,3), OthelloBoard.P1); assertEquals("Initial tokens P1",b.get(4,4), OthelloBoard.P1); assertEquals("Initial tokens P2",b.get(3,4), OthelloBoard.P2); assertEquals("Initial tokens P2",b.get(4,3), OthelloBoard.P2); for(int row=0;row

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!