1) why cant my static function see the class variables and a non-static method can:
example:
class Chess
{
int columnStart;
int rowStart;
int columnEnd;
int rowEnd;
public static void Main(string[] args)
{
int[] locationMap = new locationMap[4];
columnStart = locationMap[0];
rowStart = locationMap[1];
columnEnd = locationMap[2];
rowEnd = locationMap[3];
}
i am trying to do the following manipulation. But i am not sure that it works?!?
public static void Main(string[] args)
{
int columnStart;
int rowStart;
int columnEnd;
int rowEnd;
int b = 0;
Pieces[,] pieces = ChessBoard();
do
{
// prints chessboard
printChessBoard(pieces);
//Users Answer
i want all the location map array variables to get values once the return from the function (the method. assigns them values at the end of the operation).
User c = new User(pieces);
int[] locationMap = c.answerReturned(pieces);
Game g = new Game(pieces, locationMap[0],locationMap[1],locationMap[2], locationMap[3]);
pieces = g.makeMove();
//Once those location variables return , i want the new variables to get them.
rowStart = locationMap[0];
columnStart = locationMap[1];
rowEnd = locationMap[2];
columnEnd = locationMap[3];
//Promotion
// i want the new variables assigned above to have the same values as those parameters
Promotion(pieces, rowStart, columnStart, rowEnd, columnEnd);
b++;
} while (b < 50);
thank you!! rep will be given with any help!!