fin journée vendredi

This commit is contained in:
JunkJumper 2020-04-10 18:06:38 +02:00
parent 557cd970e8
commit 1f35815c75
7 changed files with 50 additions and 1 deletions

View File

@ -1 +0,0 @@
theme: jekyll-theme-cayman

0
src/ihm/.gitkeep Normal file
View File

View File

0
src/jeu/utils/.gitkeep Normal file
View File

View File

@ -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;
}
}

24
src/tmpmeth/Dice.java Normal file
View File

@ -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;
}
}

13
src/tmpmeth/start.java Normal file
View File

@ -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));
}
}