简体   繁体   English

3D阵列还是动态2D阵列?

[英]3D Array or a dynamic 2D array?

I'm developing a shogi (shogi is a Japanese variant of chess) application. 我正在开发shogi(将棋是日本象棋的一种变体)应用程序。 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); 我想知道对于3D数组是否最好(一个元素将存储类型,另一个元素将是块的位置,第三个元素将存储该块类型的数量);

The other option is a dynamic 2D array, to store the piece type and location, then keep the same types of pieces close together. 另一个选项是动态2D数组,用于存储样片类型和位置,然后将相同类型的样片保持在一起。

Which would be best for an Android application? 哪个最适合Android应用程序?

this is not really an android-related question ,but more of a game design question . 这并不是一个与Android相关的问题,而是更多的游戏设计问题。

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 ? 无论如何,如果类似于国际象棋,那么二维棋子阵列又如何呢?每个棋子都有自己的属性:棋子类型和棋手拥有棋子?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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