Ejemplo n.º 1
0
        private bool isBoardFree(int x, int y, Block block)
        {
            if (block == null)
            {
                return(false);
            }

            bool free = true;

            for (int row = 0; row < block.rows; row++)
            {
                for (int lane = 0; lane < block.lanes; lane++)
                {
                    int globalRow  = row + block.rowPosititon;
                    int globalLane = lane + block.lanePosititon;

                    if (block != null && block.isGlobalPositionOccupied(globalRow, globalLane))
                    {
                        if (globalRow + x >= board.rows ||
                            globalRow + x < 0 ||
                            globalLane + y >= board.lanes ||
                            globalLane + y < 0)
                        {
                            return(false);
                        }
                        free = free && board.isEmpty(globalRow + x, globalLane + y);
                    }
                }
            }
            return(free);
        }