コード例 #1
0
ファイル: ReversiBoard.cs プロジェクト: bdvries/ReversiOnline
        private bool DisksToChangeForDirection(int place, Players player, WindDirection direction, List <int> disksToChange)
        {
            bool directionIsValid;

            place = direction.TranslateDirection()
                    .AddDirectionToCoordinate(place, BOARD_WIDTH);

            // Iterate over opponents pieces
            if (Board[place] == player.Negate())
            {
                directionIsValid = DisksToChangeForDirection(place, player, direction, disksToChange);
                if (directionIsValid)
                {
                    disksToChange.Add(place);
                }
            }
            else
            {
                // Return whetere there is a piece of the palyer at the end.
                directionIsValid = Board[place] == player;
            }

            return(directionIsValid);
        }