Skip to content

Commit

Permalink
safgad
Browse files Browse the repository at this point in the history
  • Loading branch information
Roger Miret committed Jun 3, 2015
1 parent cdc2db8 commit 9f407a5
Showing 1 changed file with 14 additions and 8 deletions.
22 changes: 14 additions & 8 deletions src/battleship/Battleship.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@ public class Battleship extends Outils {
public static final Outils OUTIL = new Outils();
public static final boolean IS_WINDOWS = System.getProperty("os.name").toLowerCase().contains("win");
public static final String USERNAME = System.getProperty("user.name");



/**
* @param args the command line arguments
Expand Down Expand Up @@ -50,7 +48,6 @@ public static void main(String[] args) throws IOException {
}

Outils.Banner();


System.out.println("Bienvenue " + USERNAME);
/**
Expand Down Expand Up @@ -280,7 +277,7 @@ && isNumber(tailleSelected.substring(position + 1))) {
// System.out.println(getAffiche(tireur.getState(), p1.getState()) + "");
HashMap<String, Plateau> clone = new HashMap((Map) tablero.clone());

System.out.println("Tir de " + tireur.getPropietari() + " : ");
System.out.println("Tir de " + tireur.getPropietari() + " : \n");
clone.remove(entry);

/**
Expand Down Expand Up @@ -322,7 +319,7 @@ && isNumber(tailleSelected.substring(position + 1))) {

affiche(tireur, target);

String donde = "Tir de " + tireur.getPropietari() + "\nOù voulez vous tirer? LETTRE ou LETTRE+NUMÉRO : ";
String donde = "Tir de " + bcyan(tireur.getPropietari()) + "\nOù voulez vous tirer? LETTRE ou LETTRE+NUMÉRO : ";
boolean badShot = false, goodShot = false;
while (true) {
int y = -1;
Expand All @@ -332,7 +329,13 @@ && isNumber(tailleSelected.substring(position + 1))) {
* On cherche les coordonnées où on va attacker.
*/
if (!tireur.isComputer) {
System.out.print((badShot) ? red("Ce n'est pas possible de tirer dans cette case.") + donde : donde);
if (badShot){
System.out.print(red("Ce n'est pas possible de tirer dans cette case.") + donde);
} else if (goodShot) {
System.out.print("Où voulez vous tirer? LETTRE ou LETTRE+NUMÉRO");
} else {
System.out.print(donde);
}
badShot = false;
String letra = SCAN.next();

Expand Down Expand Up @@ -368,15 +371,18 @@ && isNumber(tailleSelected.substring(position + 1))) {
goodShot = true;
clear();
affiche(tireur, target);
System.out.println(("TIR DE " + tireur.getPropietari()).toUpperCase());
System.out.println("TIR DE " + bcyan(tireur.getPropietari().toUpperCase()));
System.out.println("Votre tir [" + getLletra(y) + x + "] a touché un bateau, vous avez le droit à un autre. ");
} else {
//The other one's turn
clear();
affiche(tireur, target);
if (!isComputer) {
System.out.println("Tir à l'eau :/\nAppuyez sur [INTRO] pour continuer");
SCAN.next();
try {
System.in.read();
} catch (Exception e) {
}
}
break;
}
Expand Down

0 comments on commit 9f407a5

Please sign in to comment.