package samegame.tests;

import static org.junit.Assert.*;

import java.awt.Point;
import java.util.ArrayList;
import java.util.Optional;
import java.util.Random;
import java.util.stream.Stream;

import org.junit.Test;

import montecarlo.INmcsState;
import montecarlo.NestedMonteCarloSearch;
import montecarlo.Pair;
import samegame.BoardGenerator;
import samegame.SGBoard;
import samegame.SGNmctsState;

public class SGBoardTests {

	@Test
	public void removeGroup_noBonus_scoreShouldBeCorrect() {
		Optional<int[][]> board = BoardGenerator.generateBoard("1,2,1,2,1;1,2,1,1,2;1,2,1,1,2;2,2,2,2,2;1,2,2,2,1;");

		if (!board.isPresent())
			fail();

		board.ifPresent(x -> {
			SGBoard sgBoard = new SGBoard(x);
			sgBoard.removeGroup(new Point(0, 2));
			sgBoard.removeGroup(new Point(0, 1));
			sgBoard.removeGroup(new Point(0, 0));

			assertEquals(158, sgBoard.getScore());
		});
	}

	@Test
	public void removeGroup_withBonus_scoreShouldBeCorrect() {
		Optional<int[][]> board = BoardGenerator.generateBoard("1,2,1,2,1;1,2,1,1,2;1,2,1,1,2;2,2,2,2,2;1,2,2,2,1;");

		if (!board.isPresent())
			fail();

		board.ifPresent(x -> {
			SGBoard sgBoard = new SGBoard(x);
			sgBoard.removeGroup(new Point(2, 2));
			sgBoard.removeGroup(new Point(0, 1));
			sgBoard.removeGroup(new Point(0, 0));

			assertEquals(1169, sgBoard.getScore());
		});
	}
}

@@ -97,223 +97,42 @@
 til.
-ArrayList;%0Aimport java.util.Optional;%0Aimport java.util.Random;%0Aimport java.util.stream.Stream;%0A%0Aimport org.junit.Test;%0A%0Aimport montecarlo.INmcsState;%0Aimport montecarlo.NestedMonteCarloSearch;%0Aimport montecarlo.Pair;
+Optional;%0A%0Aimport org.junit.Test;%0A
 %0Aimp
@@ -188,38 +188,8 @@
 ard;
-%0Aimport samegame.SGNmctsState;
 %0A%0Apu

clean up