From 72a1bae2fe0b455895c5cc9ca3a5d1c15e02d03e Mon Sep 17 00:00:00 2001 From: "emile.malcuit" Date: Wed, 26 Mar 2025 15:44:44 +0100 Subject: [PATCH] dsfdsf --- ChasseTresor/build.xml | 73 + ChasseTresor/manifest.mf | 3 + ChasseTresor/nbproject/build-impl.xml | 1771 +++++++++++++++++ ChasseTresor/nbproject/genfiles.properties | 8 + ChasseTresor/nbproject/project.properties | 102 + ChasseTresor/nbproject/project.xml | 15 + .../src/chasseAuTresor/Interface.form | 335 ++++ .../src/chasseAuTresor/Interface.java | 382 ++++ ChasseTresor/src/metier/Jeu.java | 140 ++ ChasseTresor/src/metier/Joueur.java | 137 ++ ChasseTresor/src/metier/Position.java | 52 + ChasseTresor/src/metier/Recif.java | 95 + ChasseTresor/src/metier/Tresor.java | 64 + ChasseTresor/test/metier/JoueurTest.java | 125 ++ ChasseTresor/test/metier/PositionTest.java | 92 + ChasseTresor/test/metier/RecifTest.java | 121 ++ ChasseTresor/test/metier/sqdd.java | 22 + 17 files changed, 3537 insertions(+) create mode 100644 ChasseTresor/build.xml create mode 100644 ChasseTresor/manifest.mf create mode 100644 ChasseTresor/nbproject/build-impl.xml create mode 100644 ChasseTresor/nbproject/genfiles.properties create mode 100644 ChasseTresor/nbproject/project.properties create mode 100644 ChasseTresor/nbproject/project.xml create mode 100644 ChasseTresor/src/chasseAuTresor/Interface.form create mode 100644 ChasseTresor/src/chasseAuTresor/Interface.java create mode 100644 ChasseTresor/src/metier/Jeu.java create mode 100644 ChasseTresor/src/metier/Joueur.java create mode 100644 ChasseTresor/src/metier/Position.java create mode 100644 ChasseTresor/src/metier/Recif.java create mode 100644 ChasseTresor/src/metier/Tresor.java create mode 100644 ChasseTresor/test/metier/JoueurTest.java create mode 100644 ChasseTresor/test/metier/PositionTest.java create mode 100644 ChasseTresor/test/metier/RecifTest.java create mode 100644 ChasseTresor/test/metier/sqdd.java diff --git a/ChasseTresor/build.xml b/ChasseTresor/build.xml new file mode 100644 index 0000000..7b50e2b --- /dev/null +++ b/ChasseTresor/build.xml @@ -0,0 +1,73 @@ + + + + + + + + + + + Builds, tests, and runs the project ChasseTresor. + + + diff --git a/ChasseTresor/manifest.mf b/ChasseTresor/manifest.mf new file mode 100644 index 0000000..328e8e5 --- /dev/null +++ b/ChasseTresor/manifest.mf @@ -0,0 +1,3 @@ +Manifest-Version: 1.0 +X-COMMENT: Main-Class will be added automatically by build + diff --git a/ChasseTresor/nbproject/build-impl.xml b/ChasseTresor/nbproject/build-impl.xml new file mode 100644 index 0000000..6875f44 --- /dev/null +++ b/ChasseTresor/nbproject/build-impl.xml @@ -0,0 +1,1771 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Must set src.dir + Must set test.src.dir + Must set build.dir + Must set dist.dir + Must set build.classes.dir + Must set dist.javadoc.dir + Must set build.test.classes.dir + Must set build.test.results.dir + Must set build.classes.excludes + Must set dist.jar + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Must set javac.includes + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + No tests executed. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Must set JVM to use for profiling in profiler.info.jvm + Must set profiler agent JVM arguments in profiler.info.jvmargs.agent + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Must select some files in the IDE or set javac.includes + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + To run this application from the command line without Ant, try: + + java -jar "${dist.jar.resolved}" + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Must select one file in the IDE or set run.class + + + + Must select one file in the IDE or set run.class + + + + + + + + + + + + + + + + + + + + + + + Must select one file in the IDE or set debug.class + + + + + Must select one file in the IDE or set debug.class + + + + + Must set fix.includes + + + + + + + + + + This target only works when run from inside the NetBeans IDE. + + + + + + + + + Must select one file in the IDE or set profile.class + This target only works when run from inside the NetBeans IDE. + + + + + + + + + This target only works when run from inside the NetBeans IDE. + + + + + + + + + + + + + This target only works when run from inside the NetBeans IDE. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Must select one file in the IDE or set run.class + + + + + + Must select some files in the IDE or set test.includes + + + + + Must select one file in the IDE or set run.class + + + + + Must select one file in the IDE or set applet.url + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Must select some files in the IDE or set javac.includes + + + + + + + + + + + + + + + + + + + + + + + + Some tests failed; see details above. + + + + + + + + + Must select some files in the IDE or set test.includes + + + + Some tests failed; see details above. + + + + Must select some files in the IDE or set test.class + Must select some method in the IDE or set test.method + + + + Some tests failed; see details above. + + + + + Must select one file in the IDE or set test.class + + + + Must select one file in the IDE or set test.class + Must select some method in the IDE or set test.method + + + + + + + + + + + + + + + Must select one file in the IDE or set applet.url + + + + + + + + + Must select one file in the IDE or set applet.url + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/ChasseTresor/nbproject/genfiles.properties b/ChasseTresor/nbproject/genfiles.properties new file mode 100644 index 0000000..1d997b4 --- /dev/null +++ b/ChasseTresor/nbproject/genfiles.properties @@ -0,0 +1,8 @@ +build.xml.data.CRC32=2eac148f +build.xml.script.CRC32=ccffb208 +build.xml.stylesheet.CRC32=f85dc8f2@1.111.0.48 +# This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml. +# Do not edit this file. You may delete it but then the IDE will never regenerate such files for you. +nbproject/build-impl.xml.data.CRC32=2eac148f +nbproject/build-impl.xml.script.CRC32=b42136f3 +nbproject/build-impl.xml.stylesheet.CRC32=12e0a6c2@1.111.0.48 diff --git a/ChasseTresor/nbproject/project.properties b/ChasseTresor/nbproject/project.properties new file mode 100644 index 0000000..b88c689 --- /dev/null +++ b/ChasseTresor/nbproject/project.properties @@ -0,0 +1,102 @@ +annotation.processing.enabled=true +annotation.processing.enabled.in.editor=false +annotation.processing.processors.list= +annotation.processing.run.all.processors=true +annotation.processing.source.output=${build.generated.sources.dir}/ap-source-output +application.title=ChasseTresor +application.vendor=emile.lalorcey +build.classes.dir=${build.dir}/classes +build.classes.excludes=**/*.java,**/*.form +# This directory is removed when the project is cleaned: +build.dir=build +build.generated.dir=${build.dir}/generated +build.generated.sources.dir=${build.dir}/generated-sources +# Only compile against the classpath explicitly listed here: +build.sysclasspath=ignore +build.test.classes.dir=${build.dir}/test/classes +build.test.results.dir=${build.dir}/test/results +# Uncomment to specify the preferred debugger connection transport: +#debug.transport=dt_socket +debug.classpath=\ + ${run.classpath} +debug.modulepath=\ + ${run.modulepath} +debug.test.classpath=\ + ${run.test.classpath} +debug.test.modulepath=\ + ${run.test.modulepath} +# Files in build.classes.dir which should be excluded from distribution jar +dist.archive.excludes= +# This directory is removed when the project is cleaned: +dist.dir=dist +dist.jar=${dist.dir}/ChasseTresor.jar +dist.javadoc.dir=${dist.dir}/javadoc +dist.jlink.dir=${dist.dir}/jlink +dist.jlink.output=${dist.jlink.dir}/ChasseTresor +endorsed.classpath= +excludes= +includes=** +jar.compress=false +javac.classpath=\ + ${libs.junit_4.classpath}:\ + ${libs.junit_5.classpath}:\ + ${libs.hamcrest.classpath}:\ + ${libs.absolutelayout.classpath} +# Space-separated list of extra javac options +javac.compilerargs= +javac.deprecation=false +javac.external.vm=true +javac.modulepath= +javac.processormodulepath= +javac.processorpath=\ + ${javac.classpath} +javac.source=21 +javac.target=21 +javac.test.classpath=\ + ${javac.classpath}:\ + ${build.classes.dir}:\ + ${libs.junit_5.classpath} +javac.test.modulepath=\ + ${javac.modulepath} +javac.test.processorpath=\ + ${javac.test.classpath} +javadoc.additionalparam= +javadoc.author=false +javadoc.encoding=${source.encoding} +javadoc.html5=false +javadoc.noindex=false +javadoc.nonavbar=false +javadoc.notree=false +javadoc.private=false +javadoc.splitindex=true +javadoc.use=true +javadoc.version=false +javadoc.windowtitle= +# The jlink additional root modules to resolve +jlink.additionalmodules= +# The jlink additional command line parameters +jlink.additionalparam= +jlink.launcher=true +jlink.launcher.name=ChasseTresor +main.class=chasseAuTresor.Interface +manifest.file=manifest.mf +meta.inf.dir=${src.dir}/META-INF +mkdist.disabled=false +platform.active=default_platform +run.classpath=\ + ${javac.classpath}:\ + ${build.classes.dir} +# Space-separated list of JVM arguments used when running the project. +# You may also define separate properties like run-sys-prop.name=value instead of -Dname=value. +# To set system properties for unit tests define test-sys-prop.name=value: +run.jvmargs= +run.modulepath=\ + ${javac.modulepath} +run.test.classpath=\ + ${javac.test.classpath}:\ + ${build.test.classes.dir} +run.test.modulepath=\ + ${javac.test.modulepath} +source.encoding=ISO-8859-1 +src.dir=src +test.src.dir=test diff --git a/ChasseTresor/nbproject/project.xml b/ChasseTresor/nbproject/project.xml new file mode 100644 index 0000000..a22ef51 --- /dev/null +++ b/ChasseTresor/nbproject/project.xml @@ -0,0 +1,15 @@ + + + org.netbeans.modules.java.j2seproject + + + ChasseTresor + + + + + + + + + diff --git a/ChasseTresor/src/chasseAuTresor/Interface.form b/ChasseTresor/src/chasseAuTresor/Interface.form new file mode 100644 index 0000000..e9ef53d --- /dev/null +++ b/ChasseTresor/src/chasseAuTresor/Interface.form @@ -0,0 +1,335 @@ + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/ChasseTresor/src/chasseAuTresor/Interface.java b/ChasseTresor/src/chasseAuTresor/Interface.java new file mode 100644 index 0000000..7bc32d3 --- /dev/null +++ b/ChasseTresor/src/chasseAuTresor/Interface.java @@ -0,0 +1,382 @@ +/* + * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license + * Click nbfs://nbhost/SystemFileSystem/Templates/GUIForms/JFrame.java to edit this template + */ +package chasseAuTresor; + +import javax.swing.JOptionPane; +import metier.Jeu; +import metier.Joueur; +import metier.Position; +import metier.Recif; + +/** + * + * @author emile.lalorcey + */ +public class Interface extends javax.swing.JFrame { + private Jeu leJeu; + boolean gagner; + /** + * Creates new form Interface + */ + public Interface() { + leJeu = new Jeu(); + initComponents(); + jLHud.setVisible(false); + jPHud.setVisible(false); + jPZoneJeu.setVisible(false); + jBBas.setVisible(false); + jBHaut.setVisible(false); + jBDroite.setVisible(false); + jBGauche.setVisible(false); + } + + /** + * This method is called from within the constructor to initialize the form. + * WARNING: Do NOT modify this code. The content of this method is always + * regenerated by the Form Editor. + */ + @SuppressWarnings("unchecked") + // //GEN-BEGIN:initComponents + private void initComponents() { + + jPZoneJeu = new javax.swing.JPanel(); + jPJoueur = new javax.swing.JPanel(); + jPTresor = new javax.swing.JPanel(); + jPUtilisateur = new javax.swing.JPanel(); + jLabel1 = new javax.swing.JLabel(); + jTFPseudo = new javax.swing.JTextField(); + jBGo = new javax.swing.JButton(); + jPHud = new javax.swing.JPanel(); + jLADeplacements = new javax.swing.JLabel(); + jLANbVies = new javax.swing.JLabel(); + jLNbDeplacement = new javax.swing.JLabel(); + jLNbVies = new javax.swing.JLabel(); + jLUtilisateur = new javax.swing.JLabel(); + jLHud = new javax.swing.JLabel(); + jBDroite = new javax.swing.JButton(); + jBBas = new javax.swing.JButton(); + jBGauche = new javax.swing.JButton(); + jBHaut = new javax.swing.JButton(); + + setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); + setTitle("Chasse au trésor"); + setPreferredSize(new java.awt.Dimension(500, 700)); + getContentPane().setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout()); + + jPZoneJeu.setBackground(new java.awt.Color(204, 204, 204)); + jPZoneJeu.setPreferredSize(new java.awt.Dimension(400, 400)); + jPZoneJeu.setLayout(null); + + jPJoueur.setBackground(new java.awt.Color(0, 0, 0)); + jPJoueur.setPreferredSize(new java.awt.Dimension(20, 20)); + + javax.swing.GroupLayout jPJoueurLayout = new javax.swing.GroupLayout(jPJoueur); + jPJoueur.setLayout(jPJoueurLayout); + jPJoueurLayout.setHorizontalGroup( + jPJoueurLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGap(0, 20, Short.MAX_VALUE) + ); + jPJoueurLayout.setVerticalGroup( + jPJoueurLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGap(0, 20, Short.MAX_VALUE) + ); + + jPZoneJeu.add(jPJoueur); + jPJoueur.setBounds(0, 0, 20, 20); + + jPTresor.setBackground(new java.awt.Color(255, 255, 0)); + jPTresor.setPreferredSize(new java.awt.Dimension(20, 20)); + + javax.swing.GroupLayout jPTresorLayout = new javax.swing.GroupLayout(jPTresor); + jPTresor.setLayout(jPTresorLayout); + jPTresorLayout.setHorizontalGroup( + jPTresorLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGap(0, 20, Short.MAX_VALUE) + ); + jPTresorLayout.setVerticalGroup( + jPTresorLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGap(0, 20, Short.MAX_VALUE) + ); + + jPZoneJeu.add(jPTresor); + jPTresor.setBounds(160, 80, 20, 20); + + getContentPane().add(jPZoneJeu, new org.netbeans.lib.awtextra.AbsoluteConstraints(40, 160, -1, -1)); + + jPUtilisateur.setBackground(new java.awt.Color(153, 153, 153)); + jPUtilisateur.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.RAISED)); + + jLabel1.setText("Pseudo :"); + + jBGo.setText("Go"); + jBGo.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + jBGoActionPerformed(evt); + } + }); + + javax.swing.GroupLayout jPUtilisateurLayout = new javax.swing.GroupLayout(jPUtilisateur); + jPUtilisateur.setLayout(jPUtilisateurLayout); + jPUtilisateurLayout.setHorizontalGroup( + jPUtilisateurLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(jPUtilisateurLayout.createSequentialGroup() + .addContainerGap() + .addGroup(jPUtilisateurLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(jPUtilisateurLayout.createSequentialGroup() + .addComponent(jLabel1) + .addGap(0, 0, Short.MAX_VALUE)) + .addGroup(jPUtilisateurLayout.createSequentialGroup() + .addComponent(jTFPseudo, javax.swing.GroupLayout.DEFAULT_SIZE, 80, Short.MAX_VALUE) + .addGap(18, 18, 18) + .addComponent(jBGo, javax.swing.GroupLayout.PREFERRED_SIZE, 46, javax.swing.GroupLayout.PREFERRED_SIZE))) + .addContainerGap()) + ); + jPUtilisateurLayout.setVerticalGroup( + jPUtilisateurLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(jPUtilisateurLayout.createSequentialGroup() + .addGap(19, 19, 19) + .addComponent(jLabel1) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) + .addGroup(jPUtilisateurLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(jTFPseudo, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jBGo)) + .addContainerGap(36, Short.MAX_VALUE)) + ); + + getContentPane().add(jPUtilisateur, new org.netbeans.lib.awtextra.AbsoluteConstraints(30, 40, 160, 110)); + + jPHud.setBackground(new java.awt.Color(153, 153, 153)); + jPHud.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.RAISED)); + + jLADeplacements.setText("Nombre Déplacement : "); + + jLANbVies.setText("Nombre Vies :"); + + jLNbDeplacement.setFont(new java.awt.Font("Segoe UI Black", 0, 12)); // NOI18N + + jLNbVies.setFont(new java.awt.Font("Segoe UI Black", 0, 12)); // NOI18N + + javax.swing.GroupLayout jPHudLayout = new javax.swing.GroupLayout(jPHud); + jPHud.setLayout(jPHudLayout); + jPHudLayout.setHorizontalGroup( + jPHudLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(jPHudLayout.createSequentialGroup() + .addContainerGap() + .addGroup(jPHudLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(jPHudLayout.createSequentialGroup() + .addComponent(jLANbVies) + .addGap(58, 58, 58) + .addComponent(jLNbVies, javax.swing.GroupLayout.DEFAULT_SIZE, 42, Short.MAX_VALUE)) + .addGroup(jPHudLayout.createSequentialGroup() + .addComponent(jLADeplacements) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(jLNbDeplacement, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))) + .addContainerGap()) + ); + jPHudLayout.setVerticalGroup( + jPHudLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(jPHudLayout.createSequentialGroup() + .addGap(18, 18, 18) + .addGroup(jPHudLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(jLADeplacements) + .addComponent(jLNbDeplacement, javax.swing.GroupLayout.PREFERRED_SIZE, 16, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addGap(27, 27, 27) + .addGroup(jPHudLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) + .addComponent(jLANbVies) + .addComponent(jLNbVies, javax.swing.GroupLayout.PREFERRED_SIZE, 16, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addContainerGap(33, Short.MAX_VALUE)) + ); + + getContentPane().add(jPHud, new org.netbeans.lib.awtextra.AbsoluteConstraints(270, 40, 190, -1)); + + jLUtilisateur.setText("Utilisateur :"); + getContentPane().add(jLUtilisateur, new org.netbeans.lib.awtextra.AbsoluteConstraints(30, 20, -1, -1)); + + jLHud.setText("HUD :"); + getContentPane().add(jLHud, new org.netbeans.lib.awtextra.AbsoluteConstraints(300, 20, -1, -1)); + + jBDroite.setText("Droite"); + jBDroite.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + jBDroiteActionPerformed(evt); + } + }); + getContentPane().add(jBDroite, new org.netbeans.lib.awtextra.AbsoluteConstraints(250, 600, -1, -1)); + + jBBas.setText("Bas"); + jBBas.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + jBBasActionPerformed(evt); + } + }); + getContentPane().add(jBBas, new org.netbeans.lib.awtextra.AbsoluteConstraints(200, 630, -1, -1)); + + jBGauche.setText("Gauche"); + jBGauche.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + jBGaucheActionPerformed(evt); + } + }); + getContentPane().add(jBGauche, new org.netbeans.lib.awtextra.AbsoluteConstraints(150, 600, -1, -1)); + + jBHaut.setText("Haut"); + jBHaut.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + jBHautActionPerformed(evt); + } + }); + getContentPane().add(jBHaut, new org.netbeans.lib.awtextra.AbsoluteConstraints(200, 570, -1, -1)); + + pack(); + }// //GEN-END:initComponents + + private void jBHautActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jBHautActionPerformed + Joueur personne = leJeu.getLeJoueur(); + leJeu.getLeJoueur().setNbDeplacement(personne.getNbDeplacement()+1); + jLNbDeplacement.setText(toString().valueOf(personne.getNbDeplacement())); + + personne.setPosition(personne.deplacer('n', leJeu.getNB_COL(), leJeu.getNB_LIGNES())); + jPJoueur.setLocation(personne.getLaPosition().getPosX() * leJeu.getTAILLE_CELLULE(), + personne.getLaPosition().getPosY() * leJeu.getTAILLE_CELLULE()); + + gagner = leJeu.gagner(leJeu.getLeTresor(), personne); + if(gagner){ + String message = "Bravo !!!! \nTu as gagner cette chasse"; + JOptionPane.showMessageDialog(null, message, "Fin de partie", JOptionPane.INFORMATION_MESSAGE); + System.exit(0); + } + }//GEN-LAST:event_jBHautActionPerformed + + private void jBDroiteActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jBDroiteActionPerformed + Joueur personne = leJeu.getLeJoueur(); + leJeu.getLeJoueur().setNbDeplacement(personne.getNbDeplacement()+1); + jLNbDeplacement.setText(toString().valueOf(personne.getNbDeplacement())); + + personne.setPosition(personne.deplacer('e', leJeu.getNB_COL(), leJeu.getNB_LIGNES())); + jPJoueur.setLocation(personne.getLaPosition().getPosX() * leJeu.getTAILLE_CELLULE(), + personne.getLaPosition().getPosY() * leJeu.getTAILLE_CELLULE()); + + gagner = leJeu.gagner(leJeu.getLeTresor(), personne); + if(gagner){ + String message = "Bravo !!!! \nTu as gagner cette chasse"; + JOptionPane.showMessageDialog(null, message, "Fin de partie", JOptionPane.INFORMATION_MESSAGE); + System.exit(0); + } + }//GEN-LAST:event_jBDroiteActionPerformed + + private void jBGaucheActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jBGaucheActionPerformed + Joueur personne = leJeu.getLeJoueur(); + leJeu.getLeJoueur().setNbDeplacement(personne.getNbDeplacement()+1); + jLNbDeplacement.setText(toString().valueOf(personne.getNbDeplacement())); + + personne.setPosition(personne.deplacer('o', leJeu.getNB_COL(), leJeu.getNB_LIGNES())); + jPJoueur.setLocation(personne.getLaPosition().getPosX() * leJeu.getTAILLE_CELLULE(), + personne.getLaPosition().getPosY() * leJeu.getTAILLE_CELLULE()); + + gagner = leJeu.gagner(leJeu.getLeTresor(), personne); + if(gagner){ + String message = "Bravo !!!! \nTu as gagner cette chasse"; + JOptionPane.showMessageDialog(null, message, "Fin de partie", JOptionPane.INFORMATION_MESSAGE); + System.exit(0); + } + }//GEN-LAST:event_jBGaucheActionPerformed + + private void jBBasActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jBBasActionPerformed + Joueur personne = leJeu.getLeJoueur(); + leJeu.getLeJoueur().setNbDeplacement(personne.getNbDeplacement()+1); + jLNbDeplacement.setText(toString().valueOf(personne.getNbDeplacement())); + + personne.setPosition(personne.deplacer('s', leJeu.getNB_COL(), leJeu.getNB_LIGNES())); + jPJoueur.setLocation(personne.getLaPosition().getPosX() * leJeu.getTAILLE_CELLULE(), + personne.getLaPosition().getPosY() * leJeu.getTAILLE_CELLULE()); + + gagner = leJeu.gagner(leJeu.getLeTresor(), personne); + if(gagner){ + String message = "Bravo !!!! \nTu as gagner cette chasse"; + JOptionPane.showMessageDialog(null, message, "Fin de partie", JOptionPane.INFORMATION_MESSAGE); + System.exit(0); + } + }//GEN-LAST:event_jBBasActionPerformed + + private void jBGoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jBGoActionPerformed + //Initialistaion du Joueur + Position pos = new Position(0, 0); + Joueur jean = new Joueur(jTFPseudo.getText(), 15, pos); + leJeu.setLeJoueur(jean); + System.out.println(jTFPseudo.getText()); + jLHud.setVisible(true); + jPHud.setVisible(true); + jPZoneJeu.setVisible(true); + jBBas.setVisible(true); + jBHaut.setVisible(true); + jBDroite.setVisible(true); + jBGauche.setVisible(true); + + jLNbDeplacement.setText(toString().valueOf(leJeu.getLeJoueur().getNbDeplacement())); + jLNbVies.setText(toString().valueOf(leJeu.getLeJoueur().getNbVie())); + + jPJoueur.setLocation(leJeu.getLeJoueur().getLaPosition().getPosX() * leJeu.getTAILLE_CELLULE(), + leJeu.getLeJoueur().getLaPosition().getPosY() * leJeu.getTAILLE_CELLULE()); + + jPTresor.setLocation(leJeu.getLeTresor().getLaPosition().getPosX() * leJeu.getTAILLE_CELLULE(), + leJeu.getLeTresor().getLaPosition().getPosY() * leJeu.getTAILLE_CELLULE()); + }//GEN-LAST:event_jBGoActionPerformed + + /** + * @param args the command line arguments + */ + public static void main(String args[]) { + /* Set the Nimbus look and feel */ + // + /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel. + * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html + */ + try { + for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) { + if ("Nimbus".equals(info.getName())) { + javax.swing.UIManager.setLookAndFeel(info.getClassName()); + break; + } + } + } catch (ClassNotFoundException ex) { + java.util.logging.Logger.getLogger(Interface.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); + } catch (InstantiationException ex) { + java.util.logging.Logger.getLogger(Interface.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); + } catch (IllegalAccessException ex) { + java.util.logging.Logger.getLogger(Interface.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); + } catch (javax.swing.UnsupportedLookAndFeelException ex) { + java.util.logging.Logger.getLogger(Interface.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); + } + // + + /* Create and display the form */ + java.awt.EventQueue.invokeLater(new Runnable() { + public void run() { + new Interface().setVisible(true); + } + }); + } + + // Variables declaration - do not modify//GEN-BEGIN:variables + private javax.swing.JButton jBBas; + private javax.swing.JButton jBDroite; + private javax.swing.JButton jBGauche; + private javax.swing.JButton jBGo; + private javax.swing.JButton jBHaut; + private javax.swing.JLabel jLADeplacements; + private javax.swing.JLabel jLANbVies; + private javax.swing.JLabel jLHud; + private javax.swing.JLabel jLNbDeplacement; + private javax.swing.JLabel jLNbVies; + private javax.swing.JLabel jLUtilisateur; + private javax.swing.JLabel jLabel1; + private javax.swing.JPanel jPHud; + private javax.swing.JPanel jPJoueur; + private javax.swing.JPanel jPTresor; + private javax.swing.JPanel jPUtilisateur; + private javax.swing.JPanel jPZoneJeu; + private javax.swing.JTextField jTFPseudo; + // End of variables declaration//GEN-END:variables +} diff --git a/ChasseTresor/src/metier/Jeu.java b/ChasseTresor/src/metier/Jeu.java new file mode 100644 index 0000000..d89d467 --- /dev/null +++ b/ChasseTresor/src/metier/Jeu.java @@ -0,0 +1,140 @@ +/* + * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license + * Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template + */ +package metier; + +import java.util.ArrayList; +import metier.Joueur; +import metier.Position; +import metier.Recif; +import metier.Tresor; + +/** + * + * @author emile.lalorcey + */ +public class Jeu { + private static final int TAILLE_CELLULE = 20; + private static final int X_MAX = 400 - TAILLE_CELLULE; + private static final int X_MIN = 0; + private static final int Y_MAX = 400 - TAILLE_CELLULE; + private static final int Y_MIN = 0; + private final int NB_LIGNES = (X_MAX+TAILLE_CELLULE)/TAILLE_CELLULE; + private final int NB_COL = (Y_MAX+TAILLE_CELLULE)/TAILLE_CELLULE; + private final int NB_RECIF = 10; + private Joueur leJoueur; + private Tresor leTresor; + private ArrayList lesRecif; + + // Constructeur + public Jeu() { + this.initJeu(); + } + + // Guetteur + public Joueur getLeJoueur() { + return leJoueur; + } + + public Tresor getLeTresor() { + return leTresor; + } + + public ArrayList getLesRecif() { + return lesRecif; + } + + public int getTAILLE_CELLULE() { + return TAILLE_CELLULE; + } + + public static int getX_MAX() { + return X_MAX; + } + + public static int getX_MIN() { + return X_MIN; + } + + public static int getY_MAX() { + return Y_MAX; + } + + public static int getY_MIN() { + return Y_MIN; + } + + public int getNB_LIGNES() { + return NB_LIGNES; + } + + public int getNB_COL() { + return NB_COL; + } + + public int getNB_RECIF() { + return NB_RECIF; + } + + + + // Setteur + public void setLesRecif(ArrayList lesRecif) { + this.lesRecif = lesRecif; + } + + public void setLeJoueur(Joueur leJoueur){ + + this.leJoueur = leJoueur; + } + + public void setLeTresor(Tresor leTresor) { + this.leTresor = leTresor; + } + + // Methodes + private void initJeu() { + //Initialisation du Trésor + int y = this.genererNbAlea(0, NB_LIGNES); + int x = this.genererNbAlea(0, NB_COL); + Tresor chest = new Tresor("Coffre",y ,x); + this.leTresor = chest; + + //Initialisation des Récifs + ArrayList recifs = new ArrayList(); + for(int i =0; i0){ + this.nbVie += varier; + }else{ + this.nbVie = 0; + this.mourir(); + } + } + + public Position deplacer(char direction, int nbCol, int nbLignes){ + int y = this.getLaPosition().getPosY(); + int x = this.getLaPosition().getPosX(); + switch(direction){ + case 'n': + if((y-1)>=0){ + y--; + }else{ + System.out.println("Limite de map atteinte!! Demi-tour"); + } + break; + case 's': + if((y+1)<= nbLignes-1){ + y++; + + }else{ + System.out.println("Limite de map atteinte!! Demi-tour"); + } + break; + case 'o': + if((x-1)>=0){ + x--; + }else{ + System.out.println("Limite de map atteinte!! Demi-tour"); + } + break; + case 'e': + if((x+1)<= nbCol-1){ + x++; + }else{ + System.out.println("Limite de map atteinte!! Demi-tour"); + } + break; + } + return new Position(x, y); + } + + @Override + public String toString(){ + String infos = "La classe est " + this.getClass()+"\nSon nom est "+this.getNom()+"\n" + + "Son nombre de vie vaut "+this.getNbVie()+"\nSa position est à "+this.getLaPosition()+"\n" + + "Il s'est déjà deplacer "+this.getNbDeplacement()+"Il est mort :"+ this.isMort(); + return infos; + } + + + + + + + + + +} diff --git a/ChasseTresor/src/metier/Position.java b/ChasseTresor/src/metier/Position.java new file mode 100644 index 0000000..feeedc6 --- /dev/null +++ b/ChasseTresor/src/metier/Position.java @@ -0,0 +1,52 @@ +/* + * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license + * Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template + */ +package metier; + +/** + * + * @author emile.lalorcey + */ +public class Position { + private int posX; + private int posY; + + // Constructeur + public Position(){ + } + + public Position(int x, int y){ + this.posX = x; + this.posY = y; + } + + //Guetteur + + public int getPosX(){ + return this.posX; + } + + public int getPosY(){ + return this.posY; + } + + // Setteur + public void setX(int x){ + this.posX = x; + } + + public void setY(int y){ + this.posY = y; + } + + // MEthodes + + @Override + public String toString(){ + return "La position vaut "+this.getPosX()+" et "+this.getPosY(); + } + + + +} diff --git a/ChasseTresor/src/metier/Recif.java b/ChasseTresor/src/metier/Recif.java new file mode 100644 index 0000000..8454350 --- /dev/null +++ b/ChasseTresor/src/metier/Recif.java @@ -0,0 +1,95 @@ +/* + * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license + * Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template + */ +package metier; + +import java.util.Objects; +import java.util.logging.Logger; + +/** + * + * @author emile.lalorcey + */ +public class Recif { + private int dangerosite; + private Position laPosition; + + // COnstructeur + + public Recif() { + } + + public Recif(int dangerosite, Position laPosition) { + this.dangerosite = dangerosite; + this.laPosition = laPosition; + } + + // Guetteur + + public int getDangerosite() { + return dangerosite; + } + + public Position getLaPosition() { + return laPosition; + } + + // Setteur + + public void setDangerosite(int dangerosite) { + this.dangerosite = dangerosite; + } + + public void setLaPosition(Position laPosition) { + this.laPosition = laPosition; + } + + // Methodes + + @Override + public String toString() { + return "Recif{" + "dangerosite=" + dangerosite + ", laPosition=" + laPosition + '}'; + } + + @Override + public int hashCode() { + int hash = 3; + hash = 19 * hash + this.dangerosite; + hash = 19 * hash + Objects.hashCode(this.laPosition); + return hash; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) { + return true; + } + if (obj == null) { + return false; + } + if (getClass() != obj.getClass()) { + return false; + } + final Recif other = (Recif) obj; + if (this.dangerosite != other.dangerosite) { + return false; + } + return Objects.equals(this.laPosition, other.laPosition); + } + + + + + + + + + + + + + + + +} diff --git a/ChasseTresor/src/metier/Tresor.java b/ChasseTresor/src/metier/Tresor.java new file mode 100644 index 0000000..a5cb0ad --- /dev/null +++ b/ChasseTresor/src/metier/Tresor.java @@ -0,0 +1,64 @@ +/* + * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license + * Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template + */ +package metier; + +/** + * + * @author emile.lalorcey + */ +public class Tresor { + String type; + Position laPosition = new Position(); + boolean decouvert; + + // Constructeur + public Tresor(){ + } + + public Tresor(String type, int y, int x){ + this.type = type; + this.laPosition.setX(x); + this.laPosition.setY(y); + } + + // Guetteur + + public String getType() { + return type; + } + + public Position getLaPosition() { + return laPosition; + } + + public boolean isDecouvert() { + return decouvert; + } + + + // Setteur + + public void setLaPosition(Position laPosition) { + this.laPosition = laPosition; + } + + public void setDecouvert(boolean decouvert) { + this.decouvert = decouvert; + } + + + // Methodes + + @Override + public String toString() { + return "Tresor{" + "type=" + type + ", laPosition=" + laPosition + ", decouvert=" + decouvert + '}'; + } + + + + + + +} diff --git a/ChasseTresor/test/metier/JoueurTest.java b/ChasseTresor/test/metier/JoueurTest.java new file mode 100644 index 0000000..7a290a0 --- /dev/null +++ b/ChasseTresor/test/metier/JoueurTest.java @@ -0,0 +1,125 @@ +/* + * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license + * Click nbfs://nbhost/SystemFileSystem/Templates/UnitTests/JUnit5TestClass.java to edit this template + */ +package metier; + +import org.junit.Before; +import org.junit.Test; +import static org.junit.Assert.*; + +/** + * + * @author emile.lalorcey + */ +public class JoueurTest { + + public JoueurTest() { + } + + @Before + public void setUp() { + } + + + /** + * Test of faireVarierVie method, of class Joueur. + */ + @Test + public void testFaireVarierVie() { + System.out.println("--------------------------------faireVarierVie--------------------"); + Position pos = new Position(); + Joueur instance = new Joueur("Didier", 5, pos); // À compléter, joueur créé avec 5 vies + System.out.println ("\t 1er cas : moins 1 vie/5 au départ"); + int nb = -1; + instance.faireVarierVie(nb); + int expResult = 4; // Résultat attendu + int result = instance.getNbVie(); // Résultat réel + assertEquals("Pb maj Vie",expResult, result ); + boolean expResultB = false; + boolean resultB = instance.isMort(); + assertEquals("Pb maj isMort",expResultB, resultB ); + System.out.println ("\t 2nd cas : moins 6 vies/ 4"); + Joueur instan = new Joueur("Did", 4, pos); + nb = -6; + instan.faireVarierVie(nb); + expResult = 0; + result = instan.getNbVie(); + assertEquals("Pb maj Vie",expResult, result ); + expResultB = false; + resultB = instance.isMort(); + assertEquals("Pb maj isMort",expResultB, resultB ); + } + + /** + * Test of deplacer method, of class Joueur. + */ + @Test + public void testDeplacer() { + System.out.println("--------------------deplacer----------------------"); + Joueur instance = new Joueur(); + Position pos1 = new Position(2, 2); + instance.setPosition(pos1); + + System.out.println ("\t 1er cas : monter de 1"); + //Test d'un déplacement neutre vers le nord + Position a = instance.deplacer('n', 3, 3); + int expResult = 1; + int result = a.getPosY(); + assertEquals("Pb déplacement",expResult, result ); + instance.setPosition(a); + System.out.println ("\t 2er cas : hors limite vers le nord"); + a = instance.deplacer('n', 3, 3); + instance.setPosition(a); + a = instance.deplacer('n', 3, 3); + expResult = 0; + result = a.getPosY(); + assertEquals("Pb déplacement",expResult, result ); + + System.out.println ("\t 3er cas : Est de 1"); + a = instance.deplacer('e', 3, 3); + expResult = 2; + result = a.getPosX(); + assertEquals("Pb déplacement",expResult, result ); + instance.setPosition(a); + System.out.println ("\t 4er cas : hors limite vers l'Est"); + a = instance.deplacer('e', 3, 3); + instance.setPosition(a); + expResult = 2; + result = a.getPosX(); + assertEquals("Pb déplacement",expResult, result ); + + System.out.println ("\t 5er cas : Sud de 1"); + a = instance.deplacer('s', 3, 3); + expResult = 1; + result = a.getPosY(); + assertEquals("Pb déplacement",expResult, result ); + instance.setPosition(a); + System.out.println ("\t 6er cas : hors limite vers le Sud"); + a = instance.deplacer('s', 3, 3); + instance.setPosition(a); + a = instance.deplacer('s', 3, 3); + instance.setPosition(a); + expResult = 2; + result = a.getPosY(); + assertEquals("Pb déplacement",expResult, result ); + + System.out.println ("\t 7eme cas : Ouest de 1"); + a = instance.deplacer('o', 3, 3); + expResult = 1; + result = a.getPosX(); + assertEquals("Pb déplacement",expResult, result ); + instance.setPosition(a); + System.out.println ("\t 8eme cas : hors limite vers le Sud"); + a = instance.deplacer('o', 3, 3); + instance.setPosition(a); + a = instance.deplacer('o', 3, 3); + instance.setPosition(a); + expResult = 0; + result = a.getPosX(); + assertEquals("Pb déplacement",expResult, result ); + //instance.deplacer(direction, nbCol, nbLignes); + // TODO review the generated test code and remove the default call to fail. + } + +} diff --git a/ChasseTresor/test/metier/PositionTest.java b/ChasseTresor/test/metier/PositionTest.java new file mode 100644 index 0000000..cc67698 --- /dev/null +++ b/ChasseTresor/test/metier/PositionTest.java @@ -0,0 +1,92 @@ +/* + * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license + * Click nbfs://nbhost/SystemFileSystem/Templates/UnitTests/JUnit5TestClass.java to edit this template + */ +package metier; + +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import static org.junit.jupiter.api.Assertions.*; + +/** + * + * @author emile.lalorcey + */ +public class PositionTest { + + public PositionTest() { + } + + @BeforeEach + public void setUp() { + } + + /** + * Test of getPosX method, of class Position. + */ + @Test + public void testGetPosX() { + System.out.println("getPosX"); + Position instance = new Position(); + int expResult = 0; + int result = instance.getPosX(); + assertEquals(expResult, result); + // TODO review the generated test code and remove the default call to fail. + fail("The test case is a prototype."); + } + + /** + * Test of getPosY method, of class Position. + */ + @Test + public void testGetPosY() { + System.out.println("getPosY"); + Position instance = new Position(); + int expResult = 0; + int result = instance.getPosY(); + assertEquals(expResult, result); + // TODO review the generated test code and remove the default call to fail. + fail("The test case is a prototype."); + } + + /** + * Test of setX method, of class Position. + */ + @Test + public void testSetX() { + System.out.println("setX"); + int x = 0; + Position instance = new Position(); + instance.setX(x); + // TODO review the generated test code and remove the default call to fail. + fail("The test case is a prototype."); + } + + /** + * Test of setY method, of class Position. + */ + @Test + public void testSetY() { + System.out.println("setY"); + int y = 0; + Position instance = new Position(); + instance.setY(y); + // TODO review the generated test code and remove the default call to fail. + fail("The test case is a prototype."); + } + + /** + * Test of toString method, of class Position. + */ + @Test + public void testToString() { + System.out.println("toString"); + Position instance = new Position(); + String expResult = ""; + String result = instance.toString(); + assertEquals(expResult, result); + // TODO review the generated test code and remove the default call to fail. + fail("The test case is a prototype."); + } + +} diff --git a/ChasseTresor/test/metier/RecifTest.java b/ChasseTresor/test/metier/RecifTest.java new file mode 100644 index 0000000..c356b6f --- /dev/null +++ b/ChasseTresor/test/metier/RecifTest.java @@ -0,0 +1,121 @@ +/* + * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license + * Click nbfs://nbhost/SystemFileSystem/Templates/UnitTests/JUnit4TestClass.java to edit this template + */ +package metier; + +import org.junit.Before; +import org.junit.Test; +import static org.junit.Assert.*; + +/** + * + * @author emile.lalorcey + */ +public class RecifTest { + + public RecifTest() { + } + + @Before + public void setUp() { + } + + /** + * Test of getDangerosite method, of class Recif. + */ + @Test + public void testGetDangerosite() { + System.out.println("getDangerosite"); + Recif instance = new Recif(); + int expResult = 0; + int result = instance.getDangerosite(); + assertEquals(expResult, result); + // TODO review the generated test code and remove the default call to fail. + fail("The test case is a prototype."); + } + + /** + * Test of getLaPosition method, of class Recif. + */ + @Test + public void testGetLaPosition() { + System.out.println("getLaPosition"); + Recif instance = new Recif(); + Position expResult = null; + Position result = instance.getLaPosition(); + assertEquals(expResult, result); + // TODO review the generated test code and remove the default call to fail. + fail("The test case is a prototype."); + } + + /** + * Test of setDangerosite method, of class Recif. + */ + @Test + public void testSetDangerosite() { + System.out.println("setDangerosite"); + int dangerosite = 0; + Recif instance = new Recif(); + instance.setDangerosite(dangerosite); + // TODO review the generated test code and remove the default call to fail. + fail("The test case is a prototype."); + } + + /** + * Test of setLaPosition method, of class Recif. + */ + @Test + public void testSetLaPosition() { + System.out.println("setLaPosition"); + Position laPosition = null; + Recif instance = new Recif(); + instance.setLaPosition(laPosition); + // TODO review the generated test code and remove the default call to fail. + fail("The test case is a prototype."); + } + + /** + * Test of toString method, of class Recif. + */ + @Test + public void testToString() { + System.out.println("toString"); + Recif instance = new Recif(); + String expResult = ""; + String result = instance.toString(); + assertEquals(expResult, result); + // TODO review the generated test code and remove the default call to fail. + fail("The test case is a prototype."); + } + + /** + * Test of hashCode method, of class Recif. + */ + @Test + public void testHashCode() { + System.out.println("hashCode"); + Recif instance = new Recif(); + int expResult = 0; + int result = instance.hashCode(); + assertEquals(expResult, result); + // TODO review the generated test code and remove the default call to fail. + fail("The test case is a prototype."); + } + + /** + * Test of equals method, of class Recif. + */ + @Test + public void testEquals() { + System.out.println("equals"); + Object obj = null; + Recif instance = new Recif(); + boolean expResult = false; + boolean result = instance.equals(obj); + assertEquals(expResult, result); + // TODO review the generated test code and remove the default call to fail. + fail("The test case is a prototype."); + } + +} diff --git a/ChasseTresor/test/metier/sqdd.java b/ChasseTresor/test/metier/sqdd.java new file mode 100644 index 0000000..b9010b5 --- /dev/null +++ b/ChasseTresor/test/metier/sqdd.java @@ -0,0 +1,22 @@ + +package metier; + +/** + * @author emile malcuit + * @version 1 + */ +public class sqdd { + + /** + * @param args the command line arguments + */ + public static void main(String[] args) { + // TODO code application logic here + Jeu ju = new Jeu(); + Position pos = new Position(10, 10); + Joueur j = new Joueur("j", 12, pos); + Tresor t = new Tresor("coffre", 11, 10); + System.out.println(ju.gagner(t, j)); + } + +}