public GamePoint(GameInformation gameInformation, int index)
        {
            if (index < 0)
            {
                throw new ArgumentException();
            }
            if (index >= gameInformation.FieldLetters.Length)
            {
                throw new ArgumentException();
            }

            this.GameInformation = gameInformation;
            this.Index           = index;
        }
        public GamePoint(GameInformation gameInformation, int xHorizontal, int yVertical)
        {
            if (xHorizontal < 0)
            {
                throw new ArgumentException();
            }
            if (xHorizontal >= gameInformation.HorizontalDimension)
            {
                throw new ArgumentException();
            }
            if (yVertical < 0)
            {
                throw new ArgumentException();
            }
            if (yVertical >= gameInformation.VerticalDimension)
            {
                throw new ArgumentException();
            }

            this.GameInformation = gameInformation;
            this.Index           = gameInformation.HorizontalDimension * yVertical + xHorizontal;
        }
Example #3
0
        public GameState(GameInformation gameInformation, IEnumerable <GameWord> words)
        {
            this.OccupationField = new BitArray(gameInformation.FieldLetters.Length, false);
            this.GameInformation = gameInformation;

            if (words != null)
            {
                var listBuilder = ImmutableSortedSet.CreateBuilder <GameWord>();
                foreach (var word in words)
                {
                    listBuilder.Add(word);
                    foreach (var letter in word.GamePoints)
                    {
                        OccupationField[letter.Index] = true;
                    }
                }
                this.Words = listBuilder.ToImmutable();
            }
            else
            {
                this.Words = ImmutableSortedSet <GameWord> .Empty;
            }
        }
 public GameWord(GameInformation gameInformation, IEnumerable <GamePoint> gamePoints)
 {
     this.GamePoints      = gamePoints.ToImmutableList();
     this.GameInformation = gameInformation;
 }
Example #5
0
 private GameState CreateInitialGameState(GameInformation gameInformation)
 {
     return(new GameState(gameInformation));
 }
Example #6
0
 public async Task <GameSolution> SolveGameAsync(GameInformation gameInformation, CancellationToken cancellationToken = default(CancellationToken))
 {
     return(await SolveGameAsync(CreateInitialGameState(gameInformation), cancellationToken));
 }
Example #7
0
 public GameState(GameInformation gameInformation) : this(gameInformation, null)
 {
 }