I am doing a chess game using arrays in java I have my array set up I just need to figure out how to write an algorithom that goes over the chess board and reports what is on what spot --(i,j) coordinate. Here is my array. Also let me know if I have the array wrong somehow.
char[][] chessBoard = {
{'R', 'N', 'B', 'Q', 'K', 'B', 'N', 'R'},
{'P', 'P', 'P', 'P', 'P', 'P', 'P', 'P'},
{'Z', 'Z', 'Z', 'Z', 'Z', 'Z', 'Z', 'Z'},
{'Z', 'Z', 'Z', 'Z', 'Z', 'Z', 'Z', 'Z'},
{'Z', 'Z', 'Z', 'Z', 'Z', 'Z', 'Z', 'Z'},
{'Z', 'Z', 'Z', 'Z', 'Z', 'Z', 'Z', 'Z'},
{'P', 'P', 'P', 'P', 'P', 'P', 'P', 'P'},
{'R', 'N', 'B', 'Q', 'K', 'B', 'N', 'R'}};

You have an 8x8 array. All you need to go through that is two for loops.

for row one through row eight
for column one through column eight{
what piece is in the current index?
}

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.