diff --git a/_config.yml b/_config.yml deleted file mode 100644 index c419263..0000000 --- a/_config.yml +++ /dev/null @@ -1 +0,0 @@ -theme: jekyll-theme-cayman \ No newline at end of file diff --git a/src/ihm/.gitkeep b/src/ihm/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/src/jeu/components/.gitkeep b/src/jeu/components/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/src/jeu/utils/.gitkeep b/src/jeu/utils/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/src/tmpmeth/DamageCalculator.java b/src/tmpmeth/DamageCalculator.java new file mode 100644 index 0000000..65e71d9 --- /dev/null +++ b/src/tmpmeth/DamageCalculator.java @@ -0,0 +1,13 @@ +package tmpmeth; + +public class DamageCalculator { + + public static int calculDamage(Dice d6, Dice d4) { + int r = d6.roll() - d4.roll(); + if(r < 0) { + r = 0; + } + return r; + } +} + diff --git a/src/tmpmeth/Dice.java b/src/tmpmeth/Dice.java new file mode 100644 index 0000000..54d6040 --- /dev/null +++ b/src/tmpmeth/Dice.java @@ -0,0 +1,24 @@ +package tmpmeth; +import java.lang.Math; + +public class Dice { + + private int max; + + public Dice() { + this(0); + } + + public Dice(int m) { + this.max = m; + } + + public int roll() { + return (int)((max)*Math.random())+1; + } + + public int getMax() { + return this.max; + } + +} diff --git a/src/tmpmeth/start.java b/src/tmpmeth/start.java new file mode 100644 index 0000000..bb2c7d8 --- /dev/null +++ b/src/tmpmeth/start.java @@ -0,0 +1,13 @@ +package tmpmeth; + +public class start { + + public static void main(String[] args) { + // TODO Auto-generated method stub + Dice d4 = new Dice(4); + Dice d6 = new Dice(6); + + System.out.println(DamageCalculator.calculDamage(d6, d4)); + + } +}