简体   繁体   中英

3D Array or a dynamic 2D array?

I'm developing a shogi (shogi is a Japanese variant of chess) application. Once a piece is taken, I want it to move to a separate part of the screen, but not on the board.

I was wondering whether it would be best to a 3D array (one element would store the type, the other would be the location of the piece and the third would store the amount of that piece type);

The other option is a dynamic 2D array, to store the piece type and location, then keep the same types of pieces close together.

Which would be best for an Android application?

this is not really an android-related question ,but more of a game design question .

anyway ,if it's similar to chess , how about have a 2d array of pieces , each has its own properties : piece type and player owning the piece ?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM