Skip to content
This repository was archived by the owner on Dec 6, 2020. It is now read-only.

Commit 4968cdd

Browse files
committed
Add UML, fix spelling mistakes and now second version is released :)
1 parent 7902183 commit 4968cdd

13 files changed

Lines changed: 43 additions & 27 deletions

UML/MasterMind_Core.png

31.9 KB
Loading

UML/MasterMind_Default.png

5.72 KB
Loading

UML/MasterMind_GUI_Templates.png

30.1 KB
Loading

UML/MasterMind_Gui.png

107 KB
Loading

UML/MasterMind_Save_Load.png

7.94 KB
Loading
File renamed without changes.

mastermind_core/core.java

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
package mastermind_core;
2-
import java.util.*;
2+
3+
import java.util.Random;
4+
import java.util.Vector;
35

46
/**
5-
*
6-
* Central game engine. Contains the secret code, all colors, done tries and a list with all turnsi and hints
7+
* Central game engine. Contains the secret code, all colors, done tries and a list with all turns and hints
78
*/
89
public class core {
910

@@ -58,13 +59,13 @@ public core (Object[] o) {
5859
}
5960

6061
/**
61-
* Class construction for "user sets color"
62+
* Class construction for given code (User set code - Mode)
6263
*/
6364
public core(int codeLength, int enabledColorRange, int tries, String[] code) {
6465
generateColors(enabledColorRange);
6566
this.code = new String[codeLength];
6667
core_bot = new bot(this);
67-
if(code != null) {
68+
if(code != null) { // If given code is not set, generate random code
6869
this.code = code;
6970
} else {
7071
generateCode();
@@ -87,7 +88,7 @@ private void generateColors(int enabledColorRange) {
8788
/**
8889
* Generate randomize secret code
8990
*/
90-
public void generateCode() {
91+
private void generateCode() {
9192
int randomizeColor = 0;
9293
Random r = new Random();
9394
for (int i = 0; i < code.length; i++) {
@@ -329,7 +330,7 @@ public Object[] makePKG() {
329330
}
330331

331332
/**
332-
* Let the Bot check the turn (before creating a new try)
333+
* Let the bot check the turn (before creating a new try)
333334
*/
334335
public void doitBot() {
335336
core_bot.setBestColors();

mastermind_gui/gameAboutDialog.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
import java.awt.Dimension;
44
import java.awt.event.*;
5-
import java.awt.Desktop;
65
import javax.swing.JDialog;
76
import javax.swing.JButton;
87
import javax.swing.JLabel;
@@ -11,6 +10,7 @@
1110
/**
1211
* Shows about dialog to know who developed this nice programm
1312
*/
13+
@SuppressWarnings("serial")
1414
class gameAboutDialog extends JDialog {
1515

1616
/**

mastermind_gui/gameArea.java

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,6 @@ public void componentResized(ComponentEvent event) {
5959
});
6060
addWindowListener(this);
6161
pack();
62-
// setLocationRelativeTo(null);
6362
setVisible(true);
6463
}
6564

@@ -160,7 +159,8 @@ protected void setGameInitialization(Box gI) {
160159
}
161160

162161
/**
163-
* Remove table
162+
* Remove table (gameGround)
163+
* @see gameGround
164164
*/
165165
protected void removeGameInitialization() {
166166
if(gameInit == null) { return; }
@@ -191,17 +191,22 @@ protected void setEnabledNextTry(boolean b) {
191191
}
192192

193193
/**
194-
* Check how to set code - automatically or manuell
194+
* Check how to set code - automatically or manually
195195
*
196-
* @return <code>true</code> if code should be set manuell<br>
196+
* @return <code>true</code> if code should be set manually<br>
197197
* <code>false</code> if code should be set auto
198+
* @see options_gui#manualCode
198199
*/
199-
protected boolean isManuellCode() {
200-
return options.manuellCode;
200+
protected boolean isManualCode() {
201+
return options.manualCode;
201202
}
202203

203-
protected void removeManuellCode() {
204-
options.manuellCode = false;
204+
/**
205+
* Set manualCode in options gui to false, ready to start game
206+
* @see options_gui#manualCode
207+
*/
208+
protected void removeManualCode() {
209+
options.manualCode = false;
205210
}
206211

207212
/**

mastermind_gui/gameHelpDialog.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
import java.awt.Dimension;
44
import java.awt.event.*;
5-
import java.awt.Desktop;
65
import javax.swing.JDialog;
76
import javax.swing.JButton;
87
import javax.swing.JLabel;
@@ -11,6 +10,7 @@
1110
/**
1211
* Shows help dialog, to get starting with the mastermind game
1312
*/
13+
@SuppressWarnings("serial")
1414
class gameHelpDialog extends JDialog {
1515

1616
/**

0 commit comments

Comments
 (0)