示例#1
0
        private void BuildReplayStates(IEnumerable <string> allMoves)
        {
            allReplayStates = new List <BoardState>();


            var topPlayer    = new Player(PlayerType.TopPlayer);
            var bottomPlayer = new Player(PlayerType.BottomPlayer);

            var boardState = BoardStateTransition.CreateInitialBoadState(topPlayer, bottomPlayer);

            allReplayStates.Add(boardState);

            var playerAtMove = bottomPlayer;

            foreach (var move in allMoves)
            {
                var nextMove = MoveParser.GetMove(move);

                boardState = boardState.ApplyMove(nextMove);
                allReplayStates.Add(boardState);

                playerAtMove = playerAtMove == topPlayer ? bottomPlayer : topPlayer;
            }
        }
示例#2
0
 public static bool IsValidMove(string move)
 {
     return(MoveParser.GetMove(move) != null);
 }