package cs6601.p1.generator;

import static org.junit.Assert.assertEquals;

import org.junit.Test;

import cs6601.p1.GameBoard;
import cs6601.p1.GameConfig;
import cs6601.p1.GameState;

public class AlphaBetaTest {
	@Test
	public void testGenmoveAsW() {
		MoveGenerator moveGenerator = new AlphaBetaMoveGenerator();
		GameState gameState = new GameState(6);
		gameState.playStone('A', 2, GameBoard.WHITE_STONE);
		gameState.playStone('B', 1, GameBoard.WHITE_STONE);
		gameState.playStone('C', 2, GameBoard.WHITE_STONE);
		gameState.playStone('B', 2, GameBoard.BLACK_STONE);
		
		String move = moveGenerator.genMove(new GameConfig(), gameState, "b");
		System.out.println(gameState);
		
		System.out.println("Generated move: " + move);
		assertEquals("Expected B3 but was: " + move, "B3", move);
		gameState.playStone("b", move);
		
		System.out.println(gameState);
		
		assertEquals(MoveGenerator.PASS,moveGenerator.genMove(new GameConfig(), gameState, "?"));
	}
	
	@Test
	public void testGenmoveAsB() {
		MoveGenerator moveGenerator = new AlphaBetaMoveGenerator();
		GameState gameState = new GameState(6);
		gameState.playStone('A', 2, GameBoard.BLACK_STONE);
		gameState.playStone('B', 1, GameBoard.BLACK_STONE);
		gameState.playStone('C', 2, GameBoard.BLACK_STONE);
		gameState.playStone('B', 2, GameBoard.WHITE_STONE);
		
		String move = moveGenerator.genMove(new GameConfig(), gameState, "b");
		System.out.println(gameState);
		
		System.out.println("Generated move: " + move);
		assertEquals("Expected B3 but was: " + move, "B3", move);
		gameState.playStone("b", move);
		
		System.out.println(gameState);
		
		assertEquals(MoveGenerator.PASS,moveGenerator.genMove(new GameConfig(), gameState, "?"));
	}
}