diff --git a/TP1/Minimax.class b/TP1/Minimax.class new file mode 100644 index 0000000..7c27f83 Binary files /dev/null and b/TP1/Minimax.class differ diff --git a/TP1/Minimax.java b/TP1/Minimax.java new file mode 100644 index 0000000..aa3f45f --- /dev/null +++ b/TP1/Minimax.java @@ -0,0 +1,44 @@ + +public class Minimax { + + public static int pire; + public static int res; + public static int meilleurRes; + + public static void main(String[] args) { + System.out.println(ExploreMin(1)); + + } + + public static int ExploreMin(int n){ + if(n <= 0) { + return -1; + } + + pire = 2; + + for (int coups = 1; coups <= 3; coups++) { + res = ExploreMax(n - coups); + if(res < pire){ + pire = res; + } + } + + return pire; + } + + public static int ExploreMax(int n){ + if(n <= 0) { + return -1; + } + + for (int coups = 1; coups <= 3; coups++) { + res = ExploreMin(n - coups); + if(res > meilleurRes){ + meilleurRes = res; + } + } + + return meilleurRes; + } +} \ No newline at end of file