fin journée vendredi
This commit is contained in:
parent
557cd970e8
commit
1f35815c75
@ -1 +0,0 @@
|
||||
theme: jekyll-theme-cayman
|
0
src/ihm/.gitkeep
Normal file
0
src/ihm/.gitkeep
Normal file
0
src/jeu/components/.gitkeep
Normal file
0
src/jeu/components/.gitkeep
Normal file
0
src/jeu/utils/.gitkeep
Normal file
0
src/jeu/utils/.gitkeep
Normal file
13
src/tmpmeth/DamageCalculator.java
Normal file
13
src/tmpmeth/DamageCalculator.java
Normal 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
24
src/tmpmeth/Dice.java
Normal 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
13
src/tmpmeth/start.java
Normal 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));
|
||||
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user