I'm writing a chess game using 2-dimensional array . The idea is simple:
each piece has its own value, the destination got the piece's value if the move is valid.
My trouble is my display fundtion does not read in the updated value.
code:
display() {
int value;
//display a blank board
//display the char according to the piece's value
for (int i=1; i<=8; i++
for (int j=1, j<=8; j++) {
value = board[i][j];
switch(value) {
case: 1 //do the output
.case: 2
...
}
}
board is a public member in my class. I don't understand why the changed values did not get in. Without using list or pointers, is this
achievable?
Any help is appreciated!