Skip to content

Commit

Permalink
Fix for #182
Browse files Browse the repository at this point in the history
  • Loading branch information
Sen66 committed Jun 18, 2021
1 parent c085da2 commit 250aee8
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import de.uni_passau.fim.se.memory.model.MainMenue;
import de.uni_passau.fim.se.memory.view.OutputStream;
import de.uni_passau.fim.se.memory.view.OutputStreamMainMenue;
import de.uni_passau.fim.se.memory.view.OutputStream;

import java.util.Scanner;

Expand All @@ -14,6 +13,8 @@ public class InputStreamMainMenue {
MainMenue mainMenue = new MainMenue() ;
InputStreamPlayer player = new InputStreamPlayer() ;

int[] gameBoardSize = new int[]{5, 4};

/**
* user can pick an option
*/
Expand All @@ -29,7 +30,10 @@ public void pickMainMenueOption () {
} else {
player = new InputStreamPlayer();
}


player.game.setGameBoardSize(gameBoardSize[0],
gameBoardSize[1]);

if (MainMenue.getActivateHelp()) {
OutputStream.printOpenBoard(player.game);
player.game.timer(5000);
Expand Down Expand Up @@ -60,13 +64,13 @@ public void pickMainMenueOption () {
int difficulty = setGameBoardSize.nextInt();

if (difficulty == 1) {
player.game.setGameBoardSize(3, 4);
gameBoardSize = new int[]{3, 4};
break;
} else if (difficulty == 2) {
player.game.setGameBoardSize(4, 4);
gameBoardSize = new int[]{4, 4};
break;
} else if (difficulty == 3) {
player.game.setGameBoardSize(5, 4);
gameBoardSize = new int[]{5, 4};
break;
} else if (difficulty == 4) {
OutputStreamMainMenue.showPleaseInsertGameBoardSizeX();
Expand All @@ -80,7 +84,7 @@ public void pickMainMenueOption () {
OutputStreamMainMenue.showPleaseInsertGameBoardSizeY();
y = setGameBoardSize.nextInt();
}
player.game.setGameBoardSize(x, y);
gameBoardSize = new int[]{x, y};
break;
}
}
Expand Down
3 changes: 3 additions & 0 deletions src/main/java/de/uni_passau/fim/se/memory/model/Game.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ public class Game {

public void setGameBoardSize(int x, int y) {
this.gameBoardSize = new int[]{x,y};
cards.clear();
generateCards();
mixCards();
}

public int[] getGameBoardSize() {
Expand Down

0 comments on commit 250aee8

Please sign in to comment.