started with the TicTacToe_MinMax Project. Finished the rendering of the game.

TODO: Make a playable version and add MinMax
This commit is contained in:
2020-06-14 23:13:33 +02:00
parent c1ebe11e2f
commit 99d9170365
145 changed files with 8952 additions and 0 deletions

12
BruitForce/BruitForce.iml Normal file
View File

@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="JAVA_MODULE" version="4">
<component name="NewModuleRootManager" inherit-compiler-output="true">
<exclude-output />
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="module" module-name="TOOLS" exported="" />
</component>
</module>

View File

@@ -0,0 +1,3 @@
Manifest-Version: 1.0
Main-Class: com.BiteCoding.github.Simulation

View File

@@ -0,0 +1,17 @@
package com.BiteCoding.github;
public class Decoder {
private char[] possibleChars;
public Decoder() {
possibleChars = new char[]{ 'a','b','c','d','e','f','g','h','i','j','k','l',
'm','n','o','p','q','r','s','t','u','v','w', 'x',
'y','z' };
}
public String decode(int n){
return Character.toString(possibleChars[n]);
}
}

View File

@@ -0,0 +1,73 @@
package com.BiteCoding.github;
import javax.swing.*;
import util.Timer;
public class Simulation {
private Decoder decoder;
private Timer timer;
private String password;
private boolean properPassword;
public Simulation() {
decoder = new Decoder();
timer = new Timer();
properPassword = false;
}
public void start(){
String s = new String();
while (!properPassword) {
s = JOptionPane.showInputDialog("put in a password with 6 chars and only using" +
" the alphabet");
if (s.length() == 6 && s.matches(".*[a-zA-Z]+.*")){
properPassword = true;
} else {
JOptionPane.showMessageDialog(null, "not a valid entry");
}
}
password = s.toLowerCase();
timer.start();
crackIt();
}
private void crackIt(){
for (int i = 0; i < 26; i++) {
String s1 = decoder.decode(i);
for (int j = 0; j < 26; j++) {
String s2 = decoder.decode(j);
for (int k = 0; k < 26; k++) {
String s3 = decoder.decode(k);
for (int l = 0; l < 26; l++) {
String s4 = decoder.decode(l);
for (int m = 0; m < 26; m++) {
String s5 = decoder.decode(m);
for (int n = 0; n < 26; n++) {
String s6 = decoder.decode(n);
String possiblePassword = s1+s2+s3+s4+s5+s6;
if (possiblePassword.equals(password)){
timer.end();
JOptionPane.showMessageDialog(null, "Das Passwort war " + password);
JOptionPane.showMessageDialog(null, timer.timeNeeded());
System.exit(0);
}
}
}
}
}
}
}
}
public static void main(String[] args) {
Simulation simulation = new Simulation();
simulation.start();
}
}