我試圖重新創建pushori益智遊戲,我的主要問題在於下一個問題。每當用戶需要輸入一個令牌時,我們就會把它稱爲「1」,就像下面的例子那樣,它需要以某種方式與當時放置的矩陣行「合併」。Pushori Java編程矩陣
考慮這一點,該令牌是在矩陣意味着用戶需要按下右箭頭鍵做「行合併」爲左側:
0 0 0 0 the 0s are the main game matrix, 0 0 0 0 after you place
0 0 0 0 the number 1 is the element 0 0 0 0 it when the user
0 0 0 0 that's going to enter in the 0 0 0 0 press the right
1 0 0 0 0 row (3) from the left direction ->0 0 0 1 arrow key
這會是基本的例子現在真正的問題在於,當你有下以下:
0 3 0 3 there are many tokens around 0 3 0 3 after you place
2 1 0 2 0 the matrix and when the user -> 0 2 1 2 it when the user
1 0 2 0 wants to input the next token 1 0 2 0 press the right
0 1 0 1 now it needs to behave like 0 1 0 1 arrow key
1 0 2 0行(1)和下一個標記將被輸入的數字2,它也需要它的所有元素合併到新的用戶輸入(數字2)作爲新的結果0 2 1 2行(1),我很困惑,在這部分,因爲我有下一個功能,從目前的矩陣表類左表輸入LeftDirection但我卡住試圖想辦法實際實現此功能
public void enterFromLeftDirection(int index,int actualRow){
where index would be element from the Left Direction that needs to merge
and actualRow would be actualRow from the matrix that the user is located
however I don't get how I would be able to merge everything as I've already said
}
任何提示/建議將不勝感激!提前致謝!
Pushori < - 你可以從我從遊戲中收集來看看遊戲從這裏
哈哈呀!這真棒,我有點想到類似的東西,但我正在創建一個新的數組,並將其分配給currentRow,但這似乎更合適!感謝人真的很感激! – NeptaliD
是的 - 你可能會創建另一個數組,但是一般來說,如果你可以在數組內部完成它,你應該 - 它可以節省內存。這可能不是一個問題,但它的好習慣無論如何。 –