Exemplo n.º 1
0
        protected void PlacePuzzlePieceOutOfGrid(PuzzlePiece piece)
        {
            PuzzlePiece p;

            while (true)
            {
                SetRandomPosition(piece);
                if (!IsPieceOutsideOfGrid(piece))
                {
                    continue;
                }

                if (IsPieceOverlapingWithOthers(piece, out p))
                {
                    continue;
                }

                piece.PaintShape(this);
                drawings.Add(piece);
                AddPuzzlePieceTolLevelMatrix(piece);
                break;
            }
        }