Example #1
0
        private (Game game, GameState gameState) BuildGame(string boardString, Color turn, int?captureSequenceFrom = null)
        {
            var board     = BoardPosition.FromString(boardString);
            var game      = GameTestHelper.StartedMiniGame().WithTurn(turn).Build();
            var gameState = GameState.FromStorage(game.Id, boardString, captureSequenceFrom);

            return(game, gameState);
        }
Example #2
0
        private static List <string> CalculatePossibleMoves(string boardString, Color color, GameSettings settings)
        {
            var board = BoardPosition.FromString(boardString);

            return(PossibleMoveCalculator.ForNewTurn(board, color, settings)
                   .Calculate()
                   .Select(m => m.ToString())
                   .ToList());
        }
Example #3
0
        public void OnlyCaptureFromRestrictedFieldWhenChaining()
        {
            // |_|.|_|.|
            // |.|_|5|_|
            // |_|4|_|4|
            // |.|_|5|_|
            var board         = BoardPosition.FromString("00054405");
            var posisbleMoves = PossibleMoveCalculator.ForChainCaptures(board, new SquareId(5), InternationalSettings(4))
                                .Calculate()
                                .Select(m => m.ToString())
                                .ToList();

            posisbleMoves.Should().BeEquivalentTo("5x2");
        }
Example #4
0
 private BoardPosition Board(string board) => BoardPosition.FromString(board);
 public void LongStringToBoard()
 {
     BoardPosition.FromString(" 4 4,0 0 , 0 0,5 5 ", ",").Should().Be(BoardPosition.InitialSetup(4));
 }
 public void StringToBoard()
 {
     BoardPosition.FromString("44000055").Should().Be(BoardPosition.InitialSetup(4));
 }
        public void InitialBoard10x10()
        {
            var board = BoardPosition.InitialSetup(10);

            board.Should().Be(BoardPosition.FromString("44444,44444,44444,44444,00000,00000,55555,55555,55555,55555", ","));
        }