0

Having trouble compiling to due this error:

Inconsistent accessibility: parameter type 'TrianglePegSolver.Board' is less accessible than method 'TrianglePegSolver.Form1.DFS(TrianglePegSolver.Board)' C:\Users\pini\Desktop\COP3530\TrianglePegSolver\TrianglePegSolver\Form1.cs 85 37 TrianglePegSolver

Tried to follow instructions of other threads but even after I set the functions and types to public it still gives me issues.

Code where issue is pointed in form1:

public void DFS(Board board)
{

Here is the class that it gets the functions from:

using System; 
using System.Collections.Generic; 
using System.Linq;
using System.Text; 
using System.Threading.Tasks;

namespace TrianglePegSolver {
    class Board
    {
         public int n, sI, sJ, fI, fJ;
         public string goal = "";        
         public bool[,] pegArray, parent;
         public Board(Board copyBoard)
         {
             n = copyBoard.n;
             fI = copyBoard.fI;
             fJ = copyBoard.fJ;
             goal = copyBoard.goal;
             parent = copyBoard.pegArray;
             pegArray = copyBoard.pegArray;
         }

         public Board(int size,int startI, int startJ, int finishI, int finishJ)
         {
              n = size;
              sI = startI;
              sJ = startJ;
              fI = finishI;
              fJ = finishJ;
              pegArray = new bool[n, n];
              parent = null;
              goal = getGoal(pegArray);
              setPegs(pegArray);
         }

         public void setPegs(bool[,] p)
         {
              int x = n;
              for (int a = 0; a < n; a++)
              {
                  for (int b = 0; b < x; b++)
                  {
                      p[a,b] = true;
                  }
                  x--;
              }

              p[sI,sJ] = false;
         }

         public string getGoal(bool[,] p)
         {
              int x = n;
              String goal = "";
              for(int a = 0; a < n; a++)
              {
                  for(int b = 0; b < x; b++)
                  {
                      if (a == fI && b == fJ) goal += "1";
                      else if (p[a, b]) goal += "0";
                      else /* (p[a, b].hasPeg == 0)*/ goal += "1";
                  }
                  x--;
              }
              return goal;
         }

         public string getCurrent(bool[,] p)
         {
              int x = n;
              String current = "";
              for (int a = 0; a < n; a++)
              {
                  for (int b = 0; b < x; b++)
                  {
                      if (p[a, b]) current += 1;
                      else current += 0;
                  }
                  x--;
              }
              return current;
         }

         public bool isSolution(bool[,] p)
         {
              return ((getCurrent(p) == goal));
         }

         public bool hasChild(int i, int j)
         {
              if ((i + j + 2) < n)
              {
                  if ((pegArray[i, j + 1] == true && pegArray[i, j + 2] == false) ||
                     (pegArray[i + 1, j] == true && pegArray[i + 2, j] == false))
                  {
                      return true;
                  }
              }

              if ((i - 2)  = 0)
              {
                  if ((pegArray[i - 1, j + 1] == true && pegArray[i - 2, j + 2] == false) ||
                     (pegArray[i - 1, j] == true && pegArray[i - 2, j] == false))
                  {
                      return true;
                  }
              }

              if((j-2)  = 0)
              {
                  if ((pegArray[i, j - 1] == true && pegArray[i, j - 2] == false) ||
                     (pegArray[i + 1, j - 1] == true && pegArray[i + 2, j - 2] == false))
                  {
                      return true;
                  }
              }            
              return false;      
          }
      } 
 }

Not sure where the problem is and why I'm getting this issue but I searched throughout the class and the main and had no luck finding anything protected.

Any advice is appreciated.

marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
user1927242
  • 27
  • 2
  • 8

0 Answers0