0

I need to program a simple card game for final work. So, I have database with cards (each card has ID, name, type, sub-type, mana, energy, effect,attack). I connected to BD with java class (public Connection getConnection() throws SQLException), now I need to shuffle cards to begin the game - shuffle with ID. And I dont know how. I hope this is the way to ask help. :/

I goggled, but no help. (I 'm terrible with programming, I'm designer..)

4

1 回答 1

1

如果您将卡片存储在 ArrayList 中,这很简单。

private ArrayList<Card> cards;

// add your cards however you like

Collections.shuffle(cards);

查看Java 教程并阅读 Java 集合和数据结构。

于 2013-09-15T14:11:28.803 回答