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

时间:2022-09-15 13:11:52

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.

我正在开发一个shogi(shogi是日本的国际象棋变体)应用程序。一旦拍完一张,我希望它移动到屏幕的一个单独部分,但不是在电路板上。

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应用程序?

1 个解决方案

#1


0  

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 ?

无论如何,如果它与国际象棋相似,那么如何拥有一个2d数组,每个都有自己的属性:棋子类型和拥有该棋子的玩家?

#1


0  

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 ?

无论如何,如果它与国际象棋相似,那么如何拥有一个2d数组,每个都有自己的属性:棋子类型和拥有该棋子的玩家?