package net.woodyfolsom.msproj.policy;

import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;

import java.util.List;

import net.woodyfolsom.msproj.Action;
import net.woodyfolsom.msproj.GameConfig;
import net.woodyfolsom.msproj.GameState;
import net.woodyfolsom.msproj.Player;

import org.junit.Test;


public class ValidMoveGeneratorTest {

	@Test
	public void test() {
/* move generator should not include A1 here when playing as black:
   A B C D E
 5 . . . . . 5
 4 . O . . . 4
 3 . . . . . 3     WHITE(O) has captured 0 stones
 2 O . O . . 2     BLACK(X) has captured 0 stones
 1 . O . . . 1
   A B C D E
 */
		GameConfig gameConfig = new GameConfig(5);
		GameState gameState = new GameState(gameConfig);
		
		assertTrue(gameState.placeStone(Player.WHITE, Action.getInstance("A2")));
		assertTrue(gameState.placeStone(Player.WHITE, Action.getInstance("B1")));
		assertTrue(gameState.placeStone(Player.WHITE, Action.getInstance("B4")));
		assertTrue(gameState.placeStone(Player.WHITE, Action.getInstance("C2")));
		
		assertFalse(gameState.playStone(Player.BLACK, Action.getInstance("A1")));
		
		List<Action> validMoves = new ValidMoveGenerator().getActions(gameConfig, gameState, Player.BLACK,0);
		
		assertTrue(validMoves.size() > 0);
		
		for (Action vm : validMoves) {
			System.out.println(vm);
		}
		
		assertFalse(validMoves.contains(Action.getInstance("A1")));
		
		System.out.println(gameState);
	}

}
