Commit c6018061 authored by Darth Vernon's avatar Darth Vernon

Computer input comments

parent 85916d50
...@@ -2,11 +2,11 @@ import java.util.ArrayList; ...@@ -2,11 +2,11 @@ import java.util.ArrayList;
import java.util.Random; import java.util.Random;
public class ComputerInput { public class ComputerInput {
static String cmptrWin[] = {"DIE","Yesss","To easy"}; static String cmptrWin[] = {"DIE","Yesss","To easy"}; //Responses to win / loss.
static String cmptrLose[] = {"Noooo","How can this be","Cheat!"}; static String cmptrLose[] = {"Noooo","How can this be","Cheat!"};
Boolean win = false; Boolean win = false;
public static String talk(Boolean win) { public static String talk(Boolean win) { //Picks a random response, based on win boolean.
String speach=""; String speach="";
Random rand = new Random(); Random rand = new Random();
if (win) { if (win) {
...@@ -18,7 +18,7 @@ public class ComputerInput { ...@@ -18,7 +18,7 @@ public class ComputerInput {
return speach; return speach;
} }
public static ArrayList<String> CoOrdRandomiser() { public static ArrayList<String> CoOrdRandomiser() { //Uses random numbers to index an X and a Y coordinate.
ArrayList<String> coOrd = new ArrayList<String>(); ArrayList<String> coOrd = new ArrayList<String>();
Random rand = new Random(); Random rand = new Random();
int indexX = rand.nextInt(10); int indexX = rand.nextInt(10);
...@@ -34,7 +34,7 @@ public class ComputerInput { ...@@ -34,7 +34,7 @@ public class ComputerInput {
public static void cmptrMoveGen() { public static void cmptrMoveGen() { //Uses input from xy randomiser to place ships and validate the moves using moveValid Check from Grid class.
...@@ -46,11 +46,11 @@ public class ComputerInput { ...@@ -46,11 +46,11 @@ public class ComputerInput {
BSMain.computerS.ShipPlacer(BSMain.computerS,BSMain.ships.get(i),x,y); BSMain.computerS.ShipPlacer(BSMain.computerS,BSMain.ships.get(i),x,y); // Places
if (!BSMain.computerG.MoveValidCheck(BSMain.computerG, BSMain.computerS.moves, BSMain.computerS,BSMain.ships.get(i)) ) { if (!BSMain.computerG.MoveValidCheck(BSMain.computerG, BSMain.computerS.moves, BSMain.computerS,BSMain.ships.get(i)) ) {
i--; i--; // if moves rejected , the loop is knocked back and that ship, re generated as a set of different moves.
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment