Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 3 additions & 6 deletions src/mastermind/Mastermind.java
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
package mastermind;

public class Mastermind
{
static void main()
{
MastermindFuncties spel = new MastermindFuncties();
spel.start();
public class Mastermind {
public static void main(String[] args) {
MastermindFuncties.start();
}
}
22 changes: 11 additions & 11 deletions src/mastermind/MastermindFuncties.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,16 @@
public class MastermindFuncties
{
// === Variables (instead of inside main, like your teacher started with) ===
private final Scanner scanner = new Scanner(System.in);
private static final Scanner scanner = new Scanner(System.in);

private String[] beschikbareKleuren;
private String[] geheimeCode;
private static String[] beschikbareKleuren;
private static String[] geheimeCode;

private int codeLengte;
private int maxPogingen;
private static int codeLengte;
private static int maxPogingen;

// === Main vraagt dit aan om te starten ===
public void start()
public static void start()
{
toonSpelUitleg();
kiesMoeilijkheid();
Expand All @@ -25,7 +25,7 @@ public void start()
}

// === Toont Speluitleg ===
public void toonSpelUitleg()
public static void toonSpelUitleg()
{
System.out.println("=================================");
System.out.println(" Welcome to Mastermind");
Expand All @@ -42,7 +42,7 @@ public void toonSpelUitleg()
}

// === Kies de Moeilijkheid (switch-case, do-while) ===
private void kiesMoeilijkheid()
private static void kiesMoeilijkheid()
{
int keuze = 0;

Expand Down Expand Up @@ -91,7 +91,7 @@ private void kiesMoeilijkheid()
}

// === Kies aantal Pogining (try/catch + while loop) ===
private void kiesPogingen()
private static void kiesPogingen()
{
boolean geldig = false;

Expand Down Expand Up @@ -121,7 +121,7 @@ private void kiesPogingen()
}

// === Genereer code (Random + for-loop) ===
private void genereerCode()
private static void genereerCode()
{
geheimeCode = new String[codeLengte];
Random random = new Random();
Expand All @@ -133,7 +133,7 @@ private void genereerCode()
}

// === Main game loop ===
private void speelSpel()
private static void speelSpel()
{
int poging = 1;
boolean gewonnen = false;
Expand Down