From 001ee7622865424c0fb70ca224e2bdb5a869893c Mon Sep 17 00:00:00 2001 From: Boutaric James Date: Thu, 4 Sep 2025 13:56:57 +0200 Subject: [PATCH] ajout TP1 --> exo1 --- TP1/Minimax.class | Bin 0 -> 809 bytes TP1/Minimax.java | 44 ++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 44 insertions(+) create mode 100644 TP1/Minimax.class create mode 100644 TP1/Minimax.java diff --git a/TP1/Minimax.class b/TP1/Minimax.class new file mode 100644 index 0000000000000000000000000000000000000000..7c27f83671fed01a8f53ea55e57127804c9a992a GIT binary patch literal 809 zcmX^0Z`VEs1_pBmT`mSL25C+P83tJ{22KV!E(Uo91x^M|21O883B*zc5i0Bqs_YDE zj0`LVnMJ9L42+(P49rET#f%Kxxv7~sIjN;ZK_DKRO=ezZi5(*Yvxa6EBLjDkB3+ZenI0BZHVmv`AsxL?ti-xDBCnE!Ia7kivwr^qq)C{a1|CKRcBp1X z1_6+Eh|~O&vQm>vP=taji%U{-85x-KOG_9TL?Qmj%-0Vn%FHVXE-6Y)%(Z4@5C)rp zD$K~hUI0>*lgG#a@>>{#A_FG_7Xt$WGXp2cO$-bSoFEs0X+8!X1_lNe21bxS7#JA@ z85kI385kKD85kH?wYD=bZe(C!U}O+tU|?Va3oK$WU9Fo8w6H!(1=>|kKt z#=wHmz{S7>wu6g-n}HJ)G*C@73`}4dW2w0etW0ZIH#4xZ*hsT2W>A!pPT9f0wwZx_ z69};`V&L4wz`mJ*wS|#!`Tqx-7+BXZFfcHIU8Bap$-uzC$H2nC&%nkY#K6TM!XU^X z${@uc#-Pj~&Y;O4!l2I}%^=Rez`)JG!uE%Ol~Lvw11ke3C`zC%DS^5~AL0^ZS1`j| z!LbDD3J#bnI1sK-V&Gt4V322EVNhUTV^C(`Wl&)dV^C#~XHa8MWl(0&X3#=%0VBi( Lj0}=sZ%6?E2`Gq& literal 0 HcmV?d00001 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