summaryrefslogtreecommitdiff
path: root/Mastermind/Test.java
diff options
context:
space:
mode:
authorMiguel <m.i@gmx.at>2021-04-06 12:59:50 +0200
committerMiguel <m.i@gmx.at>2021-04-06 12:59:50 +0200
commita42682a68706ca10592bc2417d0990b941d282a6 (patch)
treee8121f0cf576e5fdf835d54e14b205f5c3866eb2 /Mastermind/Test.java
parent60e0c4b3cf4111a80e48153e997fe9cf91315cf1 (diff)
add Test.java
Diffstat (limited to 'Mastermind/Test.java')
-rw-r--r--Mastermind/Test.java36
1 files changed, 36 insertions, 0 deletions
diff --git a/Mastermind/Test.java b/Mastermind/Test.java
new file mode 100644
index 0000000..a7f27ce
--- /dev/null
+++ b/Mastermind/Test.java
@@ -0,0 +1,36 @@
+package Mastermind;
+import Mastermind.FranekEngine;
+import Mastermind.MiguelEngine;
+
+class Test
+{
+ public static void main (String args[])
+ {
+ System.out.println("Test all possible combos");
+ for (int c1=1;c1<=6;c1++)
+ for (int c2=1;c2<=6;c2++)
+ for (int c3=1;c3<=6;c3++)
+ for (int c4=1;c4<=6;c4++)
+ {
+ System.out.println("Test all guesses for code: "+c1+c2+c3+c4);
+ for (int g1=1;g1<=6;g1++)
+ for (int g2=1;g2<=6;g2++)
+ for (int g3=1;g3<=6;g3++)
+ for (int g4=1;g4<=6;g4++)
+ {
+ int fra=FranekEngine.run(c1,c2,c3,c4,g1,g2,g3,g4);
+ int mig=MiguelEngine.run(c1,c2,c3,c4,g1,g2,g3,g4);
+ if(fra!=mig)
+ {
+ System.out.println("Mismatch on Guess: "+g1+g2+g3+g4);
+ System.out.println("FRA: "+fra);
+ System.out.println("MIG: "+mig);
+ return;
+ }
+
+ }
+ }
+ System.out.println("ALL OK");
+ }
+}
+