merge
This commit is contained in:
@@ -3,4 +3,11 @@
|
|||||||
public class Coordinate {
|
public class Coordinate {
|
||||||
public int x;
|
public int x;
|
||||||
public int y;
|
public int y;
|
||||||
|
|
||||||
|
public Coordinate(int x,int y){
|
||||||
|
this.x = x;
|
||||||
|
this.y = y;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
46
src/Human.java
Normal file
46
src/Human.java
Normal file
@@ -0,0 +1,46 @@
|
|||||||
|
|
||||||
|
import java.io.Console;
|
||||||
|
|
||||||
|
public class Human{
|
||||||
|
|
||||||
|
|
||||||
|
public Coordinate chooseMove(){
|
||||||
|
|
||||||
|
Console cons = System.console();
|
||||||
|
|
||||||
|
int x=0,y=0;
|
||||||
|
boolean pass = false;
|
||||||
|
|
||||||
|
do{
|
||||||
|
try {
|
||||||
|
System.out.println("Veuillez saisir le X");
|
||||||
|
x = Integer.parseInt( cons.readLine());
|
||||||
|
pass=true;
|
||||||
|
|
||||||
|
} catch (NumberFormatException e) {
|
||||||
|
System.out.println("Ce n'est pas un nombre !");
|
||||||
|
pass=false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
while(!pass);
|
||||||
|
|
||||||
|
|
||||||
|
do{
|
||||||
|
try {
|
||||||
|
System.out.println("Veuillez saisir le Y");
|
||||||
|
y = Integer.parseInt( cons.readLine());
|
||||||
|
pass=true;
|
||||||
|
|
||||||
|
} catch (NumberFormatException e) {
|
||||||
|
System.out.println("Ce n'est pas un nombre !");
|
||||||
|
pass=false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
while(!pass);
|
||||||
|
|
||||||
|
System.out.println("Vous avez saisi : "+ x+", "+ y);
|
||||||
|
|
||||||
|
|
||||||
|
return new Coordinate(x,y);
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user