Example #1
0
        public void ScoreRow(BoardRow row, int wallPosition, DiscardPile discardPile)
        {
            if (Board.PatternLineFull(row))
            {
                var tile = Board.PatternLines[row].First();
                Board.PatternLines[row].Remove(tile);

                if (!Board.Wall.Place(tile, (int)(row) - 1, wallPosition))
                {
                    discardPile.Put(tile);
                }

                discardPile.Put(Board.PatternLines[row]);
                Board.PatternLines[row].Clear();
            }

            if (Board.Wall.RowFull(row))
            {
                OnPlayerEvent(TriggeredGameEndCondition);
            }

            if (Board.AllPatternLinesProcessed())
            {
                OnPlayerEvent(ScoredThisRound);
            }
        }
Example #2
0
        public void PlacePendingTiles(BoardRow boardRow, DiscardPile discardPile)
        {
            if (pendingTiles.Count == 0)
            {
                throw new AzulGameplayException("No tiles staged for placing.");
            }

            var surplusTiles = Board.PlaceOnPatternLine(boardRow, pendingTiles);

            if (surplusTiles.Count > 0)
            {
                discardPile.Put(surplusTiles);
            }

            pendingTiles.Clear();
        }