Пример #1
0
        /// <summary>
        /// Player places tile on a grid.
        /// </summary>
        /// <param name="player">Color of player making the move.</param>
        /// <param name="tile">Tile that is being placed.</param>
        /// <param name="coords">Coordinates of tile.</param>
        /// <param name="orientation">Orientation of the tile.</param>
        /// <exception cref="GameException">Exeption describing the error.</exception>
        public void PlaceTile(PlayerColor player, TileScheme tile, Coords coords, TileOrientation orientation)
        {
            // Check if the first tile is being placed
            if (player == PlayerColor.NONE && (CurrentGameState.CurrentPhase == GamePhase.BEFORE_START || _TileSetType != TileSetType.STANDARD))
            {
                // Check the tile placement
                GridExplorer.CheckTilePlacement(CurrentGameState.Grid, tile, coords, orientation, first: true);

                if (_TileSetType == TileSetType.STANDARD_PASSIVE)
                {
                    ((StandardPassiveTileSetSupplier)CurrentGameState.TileSupplier).DiscardTile(tile);
                }

                CurrentGameState.Grid.Add(coords, new TilePlacement()
                {
                    Orientation = orientation,
                    Scheme      = tile
                });
                TilePlacedEvent.Invoke(PlayerColor.NONE, tile, coords, orientation);

                return;
            }

            // Check if correct player is making the request
            if (CurrentGameState.Params.PlayerOrder[CurrentGameState.CurrentPlayerIndex] != player)
            {
                throw new NotOnMoveException();
            }

            // Check if it is correct time to place a tile
            if (CurrentGameState.CurrentPhase != GamePhase.TILE_SELECTED)
            {
                throw new WrongMovePhaseException();
            }

            // Check if tile is the same
            if ((_TileSetType == TileSetType.STANDARD) && !CurrentGameState.CurrentTile.IsSameAs(tile))
            {
                throw new WrongTileException();
            }

            // Check the tile placement
            GridExplorer.CheckTilePlacement(CurrentGameState.Grid, tile, coords, orientation, first: false);

            // Place the tile
            CurrentGameState.Grid.Add(coords, new TilePlacement()
            {
                Orientation = orientation,
                Scheme      = tile
            });
            CurrentGameState.CurrentCoords = coords;
            CurrentGameState.CurrentPhase  = GamePhase.TILE_PLACED;
            TilePlacedEvent.Invoke(player, tile, coords, orientation);

            if (_TileSetType == TileSetType.STANDARD_PASSIVE)
            {
                ((StandardPassiveTileSetSupplier)CurrentGameState.TileSupplier).DiscardTile(tile);
            }
        }
Пример #2
0
        public void DiscardTile(TileScheme tile)
        {
            var foundTile = _RemainingTiles.Where(x => x.IsSameAs(tile)).FirstOrDefault();

            if (foundTile == null)
            {
                throw new InvalidOperationException("Tile was not found in the tile set.");
            }

            _RemainingTiles.Remove(foundTile);
        }
Пример #3
0
        /// <summary>
        /// Starts move.
        /// </summary>
        private void StartNextMove()
        {
            // Move to the next player
            CurrentGameState.CurrentPlayerIndex = (CurrentGameState.CurrentPlayerIndex + 1) % CurrentGameState.Params.PlayerAmount;

            // Select next tile
            TileScheme selectedTile = CurrentGameState.TileSupplier.GetNext();

            CurrentGameState.CurrentTile = selectedTile;

            // Notify about the move and change state type
            CurrentGameState.CurrentPhase = GamePhase.TILE_SELECTED;
            MoveStartedEvent.Invoke(CurrentGameState.Params.PlayerOrder[CurrentGameState.CurrentPlayerIndex], selectedTile);
        }
        /// <summary>
        /// Creates "1,7-tile".
        /// </summary>
        /// <param name="type1">First type of region on the tile.</param>
        /// <param name="type2">Second type of region on the tile.</param>
        /// <param name="city">Is there a city between the regions?</param>
        /// <returns>Created tile.</returns>
        private TileScheme Create17Tile(RegionType type1, RegionType type2, bool city)
        {
            var result = new TileScheme()
            {
                Layout      = TileSchemeLayout.L17,
                CityCount   = 0,
                RegionInfos = new TileScheme.RegionInfo[2] {
                    new TileScheme.RegionInfo()
                    {
                        Type    = type1,
                        Borders = new List <TileOrientation>()
                        {
                            TileOrientation.N
                        },
                        NeighbouringCitiesIds  = new List <int>(),
                        NeighbouringRegionsIds = new List <int>()
                        {
                            1
                        }
                    },
                    new TileScheme.RegionInfo()
                    {
                        Type    = type2,
                        Borders = new List <TileOrientation>()
                        {
                            TileOrientation.E,
                            TileOrientation.S,
                            TileOrientation.W
                        },
                        NeighbouringCitiesIds  = new List <int>(),
                        NeighbouringRegionsIds = new List <int>()
                        {
                            0
                        }
                    }
                }
            };

            if (city)
            {
                result.CityCount = 1;
                result.RegionInfos[0].NeighbouringCitiesIds.Add(0);
                result.RegionInfos[1].NeighbouringCitiesIds.Add(0);
            }

            return(result);
        }
        /// <summary>
        /// Loads standard tile set to the list.
        /// </summary>
        private void LoadTiles()
        {
            // TODO: Load the tiles with 3 types of regions...

            // 8-tiles
            _RemainingTiles.Add(Create8Tile(RegionType.MOUNTAIN));
            _RemainingTiles.Add(Create8Tile(RegionType.GRASSLAND));
            _RemainingTiles.Add(Create8Tile(RegionType.SEA));

            // 4,4-tiles
            _RemainingTiles.Add(Create44Tile(RegionType.MOUNTAIN, RegionType.GRASSLAND, false));
            _RemainingTiles.Add(Create44Tile(RegionType.MOUNTAIN, RegionType.GRASSLAND, false));
            _RemainingTiles.Add(Create44Tile(RegionType.MOUNTAIN, RegionType.GRASSLAND, false));
            _RemainingTiles.Add(Create44Tile(RegionType.MOUNTAIN, RegionType.SEA, true));
            _RemainingTiles.Add(Create44Tile(RegionType.MOUNTAIN, RegionType.SEA, true));
            _RemainingTiles.Add(Create44Tile(RegionType.MOUNTAIN, RegionType.SEA, false));
            _RemainingTiles.Add(Create44Tile(RegionType.GRASSLAND, RegionType.SEA, true));
            _RemainingTiles.Add(Create44Tile(RegionType.GRASSLAND, RegionType.SEA, true));
            _RemainingTiles.Add(Create44Tile(RegionType.GRASSLAND, RegionType.SEA, false));

            // 1,7-tiles
            _RemainingTiles.Add(Create17Tile(RegionType.MOUNTAIN, RegionType.GRASSLAND, false));
            _RemainingTiles.Add(Create17Tile(RegionType.MOUNTAIN, RegionType.GRASSLAND, false));
            _RemainingTiles.Add(Create17Tile(RegionType.MOUNTAIN, RegionType.GRASSLAND, false));
            _RemainingTiles.Add(Create17Tile(RegionType.MOUNTAIN, RegionType.SEA, true));
            _RemainingTiles.Add(Create17Tile(RegionType.MOUNTAIN, RegionType.SEA, true));
            _RemainingTiles.Add(Create17Tile(RegionType.MOUNTAIN, RegionType.SEA, false));
            _RemainingTiles.Add(Create17Tile(RegionType.GRASSLAND, RegionType.SEA, true));
            _RemainingTiles.Add(Create17Tile(RegionType.GRASSLAND, RegionType.SEA, true));
            _RemainingTiles.Add(Create17Tile(RegionType.GRASSLAND, RegionType.SEA, false));

            // 1,1,1,1,4-tiles
            _RemainingTiles.Add(Create11114Tile(RegionType.GRASSLAND, RegionType.GRASSLAND, RegionType.MOUNTAIN, RegionType.MOUNTAIN, RegionType.SEA, false, false, false, false));

            // 1,1,1,5-tiles (2 types)
            _RemainingTiles.Add(Create1115Tile(RegionType.MOUNTAIN, RegionType.MOUNTAIN, RegionType.MOUNTAIN, RegionType.GRASSLAND, false, false, false));
            _RemainingTiles.Add(Create1115Tile(RegionType.MOUNTAIN, RegionType.MOUNTAIN, RegionType.MOUNTAIN, RegionType.GRASSLAND, false, false, false));
            _RemainingTiles.Add(Create1115Tile(RegionType.MOUNTAIN, RegionType.MOUNTAIN, RegionType.MOUNTAIN, RegionType.SEA, false, true, false));
            _RemainingTiles.Add(Create1115Tile(RegionType.MOUNTAIN, RegionType.MOUNTAIN, RegionType.MOUNTAIN, RegionType.SEA, false, false, false));
            _RemainingTiles.Add(Create1115Tile(RegionType.GRASSLAND, RegionType.GRASSLAND, RegionType.GRASSLAND, RegionType.MOUNTAIN, false, false, false));
            _RemainingTiles.Add(Create1115Tile(RegionType.GRASSLAND, RegionType.GRASSLAND, RegionType.GRASSLAND, RegionType.MOUNTAIN, false, false, false));
            _RemainingTiles.Add(Create1115Tile(RegionType.GRASSLAND, RegionType.GRASSLAND, RegionType.GRASSLAND, RegionType.SEA, false, true, false));
            _RemainingTiles.Add(Create1115Tile(RegionType.GRASSLAND, RegionType.GRASSLAND, RegionType.GRASSLAND, RegionType.SEA, false, false, false));
            _RemainingTiles.Add(Create1115Tile(RegionType.SEA, RegionType.SEA, RegionType.SEA, RegionType.MOUNTAIN, false, true, false));
            _RemainingTiles.Add(Create1115Tile(RegionType.SEA, RegionType.SEA, RegionType.SEA, RegionType.MOUNTAIN, false, false, false));
            _RemainingTiles.Add(Create1115Tile(RegionType.SEA, RegionType.SEA, RegionType.SEA, RegionType.GRASSLAND, false, true, false));
            _RemainingTiles.Add(Create1115Tile(RegionType.SEA, RegionType.SEA, RegionType.SEA, RegionType.GRASSLAND, false, false, false));

            // 1,1,6-tiles (2 types)
            _RemainingTiles.Add(Create116Tile(RegionType.MOUNTAIN, RegionType.MOUNTAIN, RegionType.GRASSLAND, false, false));
            _RemainingTiles.Add(Create116Tile(RegionType.MOUNTAIN, RegionType.MOUNTAIN, RegionType.GRASSLAND, false, false));
            _RemainingTiles.Add(Create116Tile(RegionType.MOUNTAIN, RegionType.MOUNTAIN, RegionType.SEA, true, false));
            _RemainingTiles.Add(Create116Tile(RegionType.MOUNTAIN, RegionType.MOUNTAIN, RegionType.SEA, false, false));
            _RemainingTiles.Add(Create116Tile(RegionType.GRASSLAND, RegionType.GRASSLAND, RegionType.MOUNTAIN, false, false));
            _RemainingTiles.Add(Create116Tile(RegionType.GRASSLAND, RegionType.GRASSLAND, RegionType.MOUNTAIN, false, false));
            _RemainingTiles.Add(Create116Tile(RegionType.GRASSLAND, RegionType.GRASSLAND, RegionType.SEA, true, false));
            _RemainingTiles.Add(Create116Tile(RegionType.GRASSLAND, RegionType.GRASSLAND, RegionType.SEA, false, false));
            _RemainingTiles.Add(Create116Tile(RegionType.SEA, RegionType.SEA, RegionType.MOUNTAIN, true, false));
            _RemainingTiles.Add(Create116Tile(RegionType.SEA, RegionType.SEA, RegionType.MOUNTAIN, false, false));
            _RemainingTiles.Add(Create116Tile(RegionType.SEA, RegionType.SEA, RegionType.GRASSLAND, true, false));
            _RemainingTiles.Add(Create116Tile(RegionType.SEA, RegionType.SEA, RegionType.GRASSLAND, false, false));

            // 1,6,1-tiles (2 types)
            _RemainingTiles.Add(Create161Tile(RegionType.MOUNTAIN, RegionType.GRASSLAND, RegionType.MOUNTAIN, false, false));
            _RemainingTiles.Add(Create161Tile(RegionType.MOUNTAIN, RegionType.GRASSLAND, RegionType.MOUNTAIN, false, false));
            _RemainingTiles.Add(Create161Tile(RegionType.MOUNTAIN, RegionType.SEA, RegionType.MOUNTAIN, true, false));
            _RemainingTiles.Add(Create161Tile(RegionType.MOUNTAIN, RegionType.SEA, RegionType.MOUNTAIN, false, false));
            _RemainingTiles.Add(Create161Tile(RegionType.GRASSLAND, RegionType.MOUNTAIN, RegionType.GRASSLAND, false, false));
            _RemainingTiles.Add(Create161Tile(RegionType.GRASSLAND, RegionType.MOUNTAIN, RegionType.GRASSLAND, false, false));
            _RemainingTiles.Add(Create161Tile(RegionType.GRASSLAND, RegionType.SEA, RegionType.GRASSLAND, true, true));
            _RemainingTiles.Add(Create161Tile(RegionType.GRASSLAND, RegionType.SEA, RegionType.GRASSLAND, true, false));
            _RemainingTiles.Add(Create161Tile(RegionType.SEA, RegionType.MOUNTAIN, RegionType.SEA, true, false));
            _RemainingTiles.Add(Create161Tile(RegionType.SEA, RegionType.MOUNTAIN, RegionType.SEA, false, false));
            _RemainingTiles.Add(Create161Tile(RegionType.SEA, RegionType.GRASSLAND, RegionType.SEA, true, false));
            _RemainingTiles.Add(Create161Tile(RegionType.SEA, RegionType.GRASSLAND, RegionType.SEA, false, false));

            // TEMP
            _First = Create161Tile(RegionType.SEA, RegionType.MOUNTAIN, RegionType.GRASSLAND, true, false);
        }
        /// <summary>
        /// Creates "2,2,1,3-tile".
        /// </summary>
        /// <param name="type1">Type of region on index 0.</param>
        /// <param name="type2">Type of region on index 1.</param>
        /// <param name="type3">Type of region on index 2.</param>
        /// <param name="type4">Type of region on index 3.</param>
        /// <param name="city12">Is there a city between the regions 1 and 2?</param>
        /// <param name="city14">Is there a city between the regions 1 and 4?</param>
        /// <param name="city24">Is there a city between the regions 2 and 4?</param>
        /// <param name="city34">Is there a city between the regions 3 and 4?</param>
        /// <returns>Created tile.</returns>
        private TileScheme Create2213Tile(RegionType type1, RegionType type2, RegionType type3, RegionType type4, bool city12, bool city14, bool city24, bool city34)
        {
            var result = new TileScheme()
            {
                Layout      = TileSchemeLayout.L2231,
                CityCount   = 0,
                RegionInfos = new TileScheme.RegionInfo[4] {
                    new TileScheme.RegionInfo()
                    {
                        Type    = type1,
                        Borders = new List <TileOrientation>()
                        {
                            TileOrientation.N
                        },
                        NeighbouringCitiesIds  = new List <int>(),
                        NeighbouringRegionsIds = new List <int>()
                        {
                            1, 3
                        }
                    },
                    new TileScheme.RegionInfo()
                    {
                        Type    = type2,
                        Borders = new List <TileOrientation>()
                        {
                            TileOrientation.E
                        },
                        NeighbouringCitiesIds  = new List <int>(),
                        NeighbouringRegionsIds = new List <int>()
                        {
                            0, 3
                        }
                    },
                    new TileScheme.RegionInfo()
                    {
                        Type    = type3,
                        Borders = new List <TileOrientation>()
                        {
                            TileOrientation.S
                        },
                        NeighbouringCitiesIds  = new List <int>(),
                        NeighbouringRegionsIds = new List <int>()
                        {
                            3
                        }
                    },
                    new TileScheme.RegionInfo()
                    {
                        Type    = type4,
                        Borders = new List <TileOrientation>()
                        {
                            TileOrientation.W
                        },
                        NeighbouringCitiesIds  = new List <int>(),
                        NeighbouringRegionsIds = new List <int>()
                        {
                            0, 1, 2
                        }
                    }
                }
            };

            if (city12)
            {
                result.RegionInfos[0].NeighbouringCitiesIds.Add(result.CityCount);
                result.RegionInfos[1].NeighbouringCitiesIds.Add(result.CityCount);
                result.CityCount++;
            }

            if (city14)
            {
                result.RegionInfos[0].NeighbouringCitiesIds.Add(result.CityCount);
                result.RegionInfos[3].NeighbouringCitiesIds.Add(result.CityCount);
                result.CityCount++;
            }

            if (city24)
            {
                result.RegionInfos[1].NeighbouringCitiesIds.Add(result.CityCount);
                result.RegionInfos[3].NeighbouringCitiesIds.Add(result.CityCount);
                result.CityCount++;
            }

            if (city34)
            {
                result.RegionInfos[2].NeighbouringCitiesIds.Add(result.CityCount);
                result.RegionInfos[3].NeighbouringCitiesIds.Add(result.CityCount);
                result.CityCount++;
            }

            return(result);
        }
 /// <summary>
 /// Gives back tile when it could not be played.
 /// </summary>
 /// <param name="returning">Tile to be returned to the set.</param>
 public void GiveBack(TileScheme returning)
 {
     _RemainingTiles.Add(returning);
 }
        /// <summary>
        /// Creates "1,1,1,1,4-tile".
        /// </summary>
        /// <param name="type1">Type of region on index 0.</param>
        /// <param name="type2">Type of region on index 1.</param>
        /// <param name="type3">Type of region on index 2.</param>
        /// <param name="type4">Type of region on index 3.</param>
        /// <param name="type5">Type of region on index 4.</param>
        /// <param name="city15">Is there a city between the regions 1 and 5?</param>
        /// <param name="city25">Is there a city between the regions 2 and 5?</param>
        /// <param name="city35">Is there a city between the regions 3 and 5?</param>
        /// <param name="city45">Is there a city between the regions 4 and 5?</param>
        /// <returns>Created tile.</returns>
        private TileScheme Create11114Tile(RegionType type1, RegionType type2, RegionType type3, RegionType type4, RegionType type5, bool city15, bool city25, bool city35, bool city45)
        {
            var result = new TileScheme()
            {
                Layout      = TileSchemeLayout.L11114,
                CityCount   = 0,
                RegionInfos = new TileScheme.RegionInfo[5] {
                    new TileScheme.RegionInfo()
                    {
                        Type    = type1,
                        Borders = new List <TileOrientation>()
                        {
                            TileOrientation.N
                        },
                        NeighbouringCitiesIds  = new List <int>(),
                        NeighbouringRegionsIds = new List <int>()
                        {
                            4
                        }
                    },
                    new TileScheme.RegionInfo()
                    {
                        Type    = type2,
                        Borders = new List <TileOrientation>()
                        {
                            TileOrientation.E
                        },
                        NeighbouringCitiesIds  = new List <int>(),
                        NeighbouringRegionsIds = new List <int>()
                        {
                            4
                        }
                    },
                    new TileScheme.RegionInfo()
                    {
                        Type    = type3,
                        Borders = new List <TileOrientation>()
                        {
                            TileOrientation.S
                        },
                        NeighbouringCitiesIds  = new List <int>(),
                        NeighbouringRegionsIds = new List <int>()
                        {
                            4
                        }
                    },
                    new TileScheme.RegionInfo()
                    {
                        Type    = type4,
                        Borders = new List <TileOrientation>()
                        {
                            TileOrientation.W
                        },
                        NeighbouringCitiesIds  = new List <int>(),
                        NeighbouringRegionsIds = new List <int>()
                        {
                            4
                        }
                    },
                    new TileScheme.RegionInfo()
                    {
                        Type    = type5,
                        Borders = new List <TileOrientation>()
                        {
                        },
                        NeighbouringCitiesIds  = new List <int>(),
                        NeighbouringRegionsIds = new List <int>()
                        {
                            0, 1, 2, 3
                        }
                    }
                }
            };

            if (city15)
            {
                result.RegionInfos[0].NeighbouringCitiesIds.Add(result.CityCount);
                result.RegionInfos[4].NeighbouringCitiesIds.Add(result.CityCount);
                result.CityCount++;
            }

            if (city25)
            {
                result.RegionInfos[1].NeighbouringCitiesIds.Add(result.CityCount);
                result.RegionInfos[4].NeighbouringCitiesIds.Add(result.CityCount);
                result.CityCount++;
            }

            if (city35)
            {
                result.RegionInfos[2].NeighbouringCitiesIds.Add(result.CityCount);
                result.RegionInfos[4].NeighbouringCitiesIds.Add(result.CityCount);
                result.CityCount++;
            }

            if (city45)
            {
                result.RegionInfos[3].NeighbouringCitiesIds.Add(result.CityCount);
                result.RegionInfos[4].NeighbouringCitiesIds.Add(result.CityCount);
                result.CityCount++;
            }

            return(result);
        }
        /// <summary>
        /// Creates "4,2,2-tile".
        /// </summary>
        /// <param name="type1">Type of region on index 0.</param>
        /// <param name="type2">Type of region on index 1.</param>
        /// <param name="type3">Type of region on index 2.</param>
        /// <param name="city12">Is there a city between the regions 1 and 2?</param>
        /// <param name="city13">Is there a city between the regions 1 and 3?</param>
        /// <param name="city23">Is there a city between the regions 2 and 3?</param>
        /// <returns>Created tile.</returns>
        private TileScheme Create442Tile(RegionType type1, RegionType type2, RegionType type3, bool city12, bool city13, bool city23)
        {
            var result = new TileScheme()
            {
                Layout      = TileSchemeLayout.L422,
                CityCount   = 0,
                RegionInfos = new TileScheme.RegionInfo[3] {
                    new TileScheme.RegionInfo()
                    {
                        Type    = type1,
                        Borders = new List <TileOrientation>()
                        {
                            TileOrientation.N,
                            TileOrientation.E
                        },
                        NeighbouringCitiesIds  = new List <int>(),
                        NeighbouringRegionsIds = new List <int>()
                        {
                            1, 2
                        }
                    },
                    new TileScheme.RegionInfo()
                    {
                        Type    = type2,
                        Borders = new List <TileOrientation>()
                        {
                            TileOrientation.S
                        },
                        NeighbouringCitiesIds  = new List <int>(),
                        NeighbouringRegionsIds = new List <int>()
                        {
                            0, 2
                        }
                    },
                    new TileScheme.RegionInfo()
                    {
                        Type    = type3,
                        Borders = new List <TileOrientation>()
                        {
                            TileOrientation.W
                        },
                        NeighbouringCitiesIds  = new List <int>(),
                        NeighbouringRegionsIds = new List <int>()
                        {
                            0, 1
                        }
                    }
                }
            };

            if (city12)
            {
                result.RegionInfos[0].NeighbouringCitiesIds.Add(result.CityCount);
                result.RegionInfos[1].NeighbouringCitiesIds.Add(result.CityCount);
                result.CityCount++;
            }

            if (city13)
            {
                result.RegionInfos[0].NeighbouringCitiesIds.Add(result.CityCount);
                result.RegionInfos[2].NeighbouringCitiesIds.Add(result.CityCount);
                result.CityCount++;
            }

            if (city23)
            {
                result.RegionInfos[1].NeighbouringCitiesIds.Add(result.CityCount);
                result.RegionInfos[2].NeighbouringCitiesIds.Add(result.CityCount);
                result.CityCount++;
            }

            return(result);
        }
Пример #10
0
 public void GiveBack(TileScheme returning)
 {
 }
Пример #11
0
        /// <summary>
        /// Checks whether tile can be placed on given position.
        /// </summary>
        /// <param name="grid">Grid with all placed tiles.</param>
        /// <param name="tile">Scheme of the tile.</param>
        /// <param name="coords">Coordinates of the tile.</param>
        /// <param name="orientation">Orientation of the tile.</param>
        /// <param name="first">Is the tile first to be placed?</param>
        /// <exception cref="GameException">Exception describing the error.</exception>
        public static void CheckTilePlacement(Dictionary <Coords, TilePlacement> grid, TileScheme tile, Coords coords, TileOrientation orientation, bool first)
        {
            bool hasNeighbour = false;

            // Check all neighbours
            foreach (var or in new TileOrienationEnumerator())
            {
                if (grid.TryGetValue(coords.GetNeighbouringCoords(or), out TilePlacement neighTile))
                {
                    hasNeighbour = true;

                    // Retrieve IDs of regions on appropriate positions
                    var thisSchemeOr  = or.Derotate(orientation);
                    var neighSchemeOr = or.Rotate(TileOrientation.S).Derotate(neighTile.Orientation);

                    int thisRegionId  = tile.GetRegionOnBorder(thisSchemeOr);
                    int neighRegionId = neighTile.Scheme.GetRegionOnBorder(neighSchemeOr);

                    // Check if region types are corresponding
                    if (neighTile.Scheme.GetRegionType(neighRegionId) != tile.GetRegionType(thisRegionId))
                    {
                        throw new WrongTileSurroundingsException();
                    }
                }
            }

            // If first tile has neighbour or not-first tile has not neighbour
            if (first == hasNeighbour)
            {
                throw new NoTileSurroundingsException();
            }
        }