diff --git a/build/UNO.exe b/build/UNO.exe index 7b02d4290cf370600925f3797b1324bc8dd080cf..24c04a85383e7b3a45d9b1da0512aa333a1b49e5 100644 Binary files a/build/UNO.exe and b/build/UNO.exe differ diff --git a/build/UNO.jar b/build/UNO.jar index 365f80e115053236b82069b88b800e2e52f805a1..4506946099cb81162d33c6af50b069bf6b495184 100644 Binary files a/build/UNO.jar and b/build/UNO.jar differ diff --git a/class/application/Controller$1.class b/class/application/Controller$1.class index cb6164bf35f48e44279460b1f67738084343a204..14ed6b8e80e5c4d4891bf3dce388576e82e452ad 100644 Binary files a/class/application/Controller$1.class and b/class/application/Controller$1.class differ diff --git a/class/application/Controller$2.class b/class/application/Controller$2.class index c817c8bff08ffebfca784208764feb1e71ef913e..f5616d1b191b7e73fa1b875e9e1d573856867c65 100644 Binary files a/class/application/Controller$2.class and b/class/application/Controller$2.class differ diff --git a/class/application/Controller$3.class b/class/application/Controller$3.class index cb09ad2228fd51b5be495c3f74989d99b9c7bb93..9afb9245a591d0f13b34ececa765046dba188c6e 100644 Binary files a/class/application/Controller$3.class and b/class/application/Controller$3.class differ diff --git a/class/application/Controller$4.class b/class/application/Controller$4.class index 12000491658f84a5cf997f640f6719614c1a6de0..5401780cacdb69f7cff9ddd35461158563e9f4d6 100644 Binary files a/class/application/Controller$4.class and b/class/application/Controller$4.class differ diff --git a/class/application/Controller$5.class b/class/application/Controller$5.class index 5c0b126293a150a7faa5f95616128d37e57402ad..2b2796fc9887e54886f1caf58feb6010769f7dc0 100644 Binary files a/class/application/Controller$5.class and b/class/application/Controller$5.class differ diff --git a/class/application/Controller$6.class b/class/application/Controller$6.class index 5294c4bbf5fa45cb1c42ce8adab8139d6670c9ef..9ccb5609ede1a0709df682cf71cf85bab78efdff 100644 Binary files a/class/application/Controller$6.class and b/class/application/Controller$6.class differ diff --git a/class/application/Controller$7.class b/class/application/Controller$7.class index 45eb526fb5a72939124fd0e191c2791c7c49f084..847ca23abf0a1cd572061476f4a1fea401b0b7d7 100644 Binary files a/class/application/Controller$7.class and b/class/application/Controller$7.class differ diff --git a/class/application/Controller$8.class b/class/application/Controller$8.class index 14d4ee6282a3ef0da2c25f9bdbcfdd7f744e27ff..b370f40501e46fb60191ae608e87ed7546a44f03 100644 Binary files a/class/application/Controller$8.class and b/class/application/Controller$8.class differ diff --git a/class/application/Controller$9.class b/class/application/Controller$9.class index cd3f4e26daec5e48266ae36a59e8ea2555256e2d..ebf88fc1634ea94c324240f3213eea951007467a 100644 Binary files a/class/application/Controller$9.class and b/class/application/Controller$9.class differ diff --git a/class/application/Controller.class b/class/application/Controller.class index 6761f57b5cda095f75b35f72431cd1ef4e83e667..726f541192c50dd97fd813549dfcc350b1567f94 100644 Binary files a/class/application/Controller.class and b/class/application/Controller.class differ diff --git a/class/logic/AI.class b/class/logic/AI.class index e54608b3bdd23e131beb98974db60b01601c4d69..0bbd63156039250c46dacf4eb32ca7cc6f38415d 100644 Binary files a/class/logic/AI.class and b/class/logic/AI.class differ diff --git a/src/application/Controller.java b/src/application/Controller.java index 03d122b7f9fc3b75d8abe0905849ef0aa6705297..2e84bdfa45f7802688edeae7c38798e31d53e94e 100644 --- a/src/application/Controller.java +++ b/src/application/Controller.java @@ -4,13 +4,8 @@ import java.io.IOException; import java.util.ArrayList; import java.util.Iterator; import java.util.Locale; -import java.util.Random; import java.util.ResourceBundle; -import tools.PathUtils; -import achievements.Achievement; -import achievements.AchievementHandler; -import achievements.Achievement.Status; import javafx.animation.TranslateTransition; import javafx.collections.ObservableList; import javafx.event.ActionEvent; @@ -46,6 +41,10 @@ import logic.Color; import logic.Direction; import logic.Game; import logic.Player; +import tools.PathUtils; +import achievements.Achievement; +import achievements.Achievement.Status; +import achievements.AchievementHandler; public class Controller { @@ -584,7 +583,7 @@ public class Controller } } - public void moveAICardToDeadDeck(AI ai, int currentPlayer, Card card, Color newWishColor) + public void moveAICardToDeadDeck(AI ai, int currentPlayer, Card card, int cardPosition, Color newWishColor) { ObservableList<Node> nodes = mainPane.getChildren(); ArrayList<Integer> possibleNodes = new ArrayList<Integer>(); @@ -596,11 +595,8 @@ public class Controller possibleNodes.add(i); } } - - Random random = new Random(); - int viewNumber = random.nextInt(possibleNodes.size()); - - ImageView view = (ImageView)mainPane.getChildren().get(possibleNodes.get(viewNumber)); + + ImageView view = (ImageView)mainPane.getChildren().get(possibleNodes.get(cardPosition)); view.setImage(new Image("images/" + card.getType() + "-" + card.getColor() + ".png")); Point2D deckPosition = iconLastCard.localToScene(Point2D.ZERO); diff --git a/src/logic/AI.java b/src/logic/AI.java index 5dc93985f994f35a043ba1f5192b0958a38fb92e..f48af6eba63a9a959e445ffcf4ab634580bce829 100644 --- a/src/logic/AI.java +++ b/src/logic/AI.java @@ -196,7 +196,7 @@ public class AI if(game.isRunning()) { - game.getController().moveAICardToDeadDeck(this, game.getCurrentPlayer(), playedCard, newWishColor); + game.getController().moveAICardToDeadDeck(this, game.getCurrentPlayer(), playedCard, getCardPositionInDeck(playedCard), newWishColor); } } } @@ -214,6 +214,18 @@ public class AI return highestValuedCard; } + + private int getCardPositionInDeck(Card card) + { + for(int i = 0; i < deck.size(); i++) + { + if(deck.get(i).equals(card)) + { + return i; + } + } + return 0; + } private Color getBestColor() {