private bool validatePaths(Tilemap p_tilemap)
        {
            List<int[]> walkables = new List<int[]>();
            for (int y = 0; y < p_tilemap.getRows(); y++)
            {
                for (int x = 0; x < p_tilemap.getColumns(); x++)
                {
                    if (p_tilemap.isWalkable(x, y))
                    {
                        walkables.Add(new int[2]{x, y});
                    }
                }
            }

            if (walkables.Count > 0)
            {
                List<int[]> toCheck = new List<int[]>();
                toCheck.Add(walkables[0]);
                walkables.RemoveAt(0);

                while (toCheck.Count > 0)
                {
                    int[] pos = toCheck[0];
                    toCheck.RemoveAt(0);
                    if (p_tilemap.isWalkable(pos[0], pos[1] - 1)) // North
                    {
                        int index = walkables.FindIndex(delegate(int[] p){return p[0]==pos[0] && p[1] == pos[1] - 1;});
                        if (index != -1)
                        {
                            walkables.RemoveAt(index);
                            toCheck.Add(new int[2]{pos[0], pos[1] - 1});
                        }
                    }
                    if (p_tilemap.isWalkable(pos[0] + 1, pos[1])) // West
                    {
                        int index = walkables.FindIndex(delegate(int[] p){return p[0]==pos[0] + 1 && p[1] == pos[1];});
                        if (index != -1)
                        {
                            walkables.RemoveAt(index);
                            toCheck.Add(new int[2]{pos[0] + 1, pos[1]});
                        }
                    }
                    if (p_tilemap.isWalkable(pos[0], pos[1] + 1)) // South
                    {
                        int index = walkables.FindIndex(delegate(int[] p){return p[0]==pos[0] && p[1] == pos[1] + 1;});
                        if (index != -1)
                        {
                            walkables.RemoveAt(index);
                            toCheck.Add(new int[2]{pos[0], pos[1] + 1});
                        }
                    }
                    if (p_tilemap.isWalkable(pos[0] - 1, pos[1])) // West
                    {
                        int index = walkables.FindIndex(delegate(int[] p){return p[0]==pos[0] - 1 && p[1] == pos[1];});
                        if (index != -1)
                        {
                            walkables.RemoveAt(index);
                            toCheck.Add(new int[2]{pos[0] - 1, pos[1]});
                        }
                    }
                }
            }
            else {
                return false;
            }

            int walkableWithoutPills = 0;
            foreach (int[] p in walkables)
            {
                int state = p_tilemap.getState(p[0], p[1]);
                if(state >= 6 * 30) {
                    walkableWithoutPills++;
                }
            }

            if(walkables.Count - walkableWithoutPills == 0)
                return true;
            return false;
        }