Exploit
New member
- Joined
- May 28, 2015
- Messages
- 2
- Programming Experience
- Beginner
Hello everyone.
I made method(1) for checking if my pieces in board game are in goal ,base and ordered if in goal.
Thing i don't know how to do is how to check in another method(2) is that bool VALUE property from method(1) true or false.
method(1)
method(2) this is where i am stuck need to check if Value from isAllPiecesInBaseOrGoalOrdered is true or false
Any help is appreciated.
Sorry for bad English.
Thank you in advance.
I made method(1) for checking if my pieces in board game are in goal ,base and ordered if in goal.
Thing i don't know how to do is how to check in another method(2) is that bool VALUE property from method(1) true or false.
method(1)
C#:
public bool isAllPiecesInBaseOrGoalOrdered(List<int> goalPositions,List<int> basePositions,List<int> piecePositions )
{
List<int> piecesOnGoal =new List<int>();
List<int> piecesOnBase = new List<int>();
bool value = false;
for (int i = 0; i < 4; i++)
{
if (goalPositions.Contains(piecePositions[i]))
{
piecesOnGoal.Add(i);
if (basePositions.Contains(piecePositions[i]))
{
piecesOnBase.Add(i);
}
}
else
value = false;
}
if (piecesOnBase.Count + piecesOnGoal.Count == 4)
{
value = true;
}
for (int i = 3; i >= 0; i++)
{
if (piecesOnGoal.Count > 0)
if (piecesOnGoal.Contains(goalPositions[i]))
piecesOnGoal.Remove(goalPositions[i]);
else
value=false;
}
return value;
}
method(2) this is where i am stuck need to check if Value from isAllPiecesInBaseOrGoalOrdered is true or false
C#:
public void resetAmountOfThrows()
{
if (isAllPiecesInBaseOrGoalOrdered()) //here i get error
//no overload for method 'isAllPiecesInBaseOrGoalOrdered' takes 0 arguments
numberOfThrows = 3;
else
numberOfThrows = 1;
}
Any help is appreciated.
Sorry for bad English.
Thank you in advance.