I am trying to make an 8x8 board with an array. The only problem I run into is making a box or square that will be placed into that array.

for instance:
@@@@@ @@@@@ @@@@@
@@@@@ @@@@@ @@@@@
@@@@@ @@@@@ @@@@@
@@@@@ @@@@@ @@@@@

@@@@@ @@@@@ @@@@@
@@@@@ @@@@@ @@@@@
@@@@@ @@@@@ @@@@@
@@@@@ @@@@@ @@@@@

@@@@@ @@@@@ @@@@@
@@@@@ @@@@@ @@@@@
@@@@@ @@@@@ @@@@@
@@@@@ @@@@@ @@@@@

And this goes for an 8x8 board.

Any suggestions?

Recommended Answers

All 2 Replies

Please clarify more.

I am trying to make an 8x8 board with an array. The only problem I run into is making a box or square that will be placed into that array.

for instance:
@@@@@ @@@@@ @@@@@
@@@@@ @@@@@ @@@@@
@@@@@ @@@@@ @@@@@
@@@@@ @@@@@ @@@@@

@@@@@ @@@@@ @@@@@
@@@@@ @@@@@ @@@@@
@@@@@ @@@@@ @@@@@
@@@@@ @@@@@ @@@@@

@@@@@ @@@@@ @@@@@
@@@@@ @@@@@ @@@@@
@@@@@ @@@@@ @@@@@
@@@@@ @@@@@ @@@@@

And this goes for an 8x8 board.

Any suggestions?

So, you want to make a game board (8x8) out of an array. Why don't you just use arrays of arrays (2D arrays) to represent the game board?

Something like this:

// if you want to use C arrays
typedef char[8][8] game_board;
// if you want to use boost arrays
#include <boost/array.hpp>
typedef boost::array< boost::array<char, 8>, 8 > game_board;
commented: BOOST??? For a 2D Array? Why????? -4
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.