import java.util.Scanner;
public class Game
{
private String startYorN;
private int generateTestValues;
private int rows;
private int cols;
private int minCanisters;
private int maxCanisters;
private int numOfDarkies;
private int minimumLifePoints;
private String name;
private String type1;
private int sPosition1, sPosition2;
private int tPosition1, tPosition2;
private int iLifePoints;
Scanner scan = new Scanner(System.in);
public void gameSetting()
{
System.out.print ("Would you like to play? (y/n):");
startYorN = scan.nextLine();
//if (startYorN =="n" || startYorN =="N")
//quit the game(?)
System.out.print ("Would you want to generate test values for world? 1- yes: ");
generateTestValues =scan.nextInt();
System.out.println ("");
System.out.print ("Enter a number of rows for world: ");
rows = scan.nextInt ();
System.out.println ("");
System.out.print ("Enter a number of cols for world: ");
cols = scan.nextInt ();
System.out.println ("");
System.out.print ("Enter minimum energy canisters in each planet: ");
minCanisters = scan.nextInt ();
System.out.println ("");
System.out.print ("Enter maximum energy canisters in each planet: ");
maxCanisters = scan.nextInt ();
System.out.println ("");
System.out.print ("Enter number of planets with darkies: ");
numOfDarkies = scan.nextInt ();
System.out.println ("");
System.out.print ("Enter minimum life points for players to replenish: ");
minimumLifePoints = scan.nextInt ();
System.out.print ("\n");
World w = new World(rows,cols,minCanisters, maxCanisters, numOfDarkies);
w.display();
Alien[] alien = new Alien [2];
for (int i = 0; i<=1;i++)
{
name = scan.nextLine ();
System.out.print ("\n");
System.out.print ("Enter name for player #" + i + ": ");
name = scan.nextLine ();
System.out.print ("Enter kind Player #" + i + ", (n- naive, g- greedy, a- aggressive, u- naive user, w-aggressive user): ");
type = scan.nextLine ();
System.out.print ("Enter: row (space) column for start position for player #" + i + ": ");
sPosition1 = scan.nextInt ();
sPosition2 = scan.nextInt ();
System.out.print ("Enter: row (space) column for target position for player #" + i + ": ");
tPosition1 = scan.nextInt ();
tPosition2 = scan.nextInt ();
System.out.print ("Enter initial life points for player #" + i + ": ");
iLifePoints = scan.nextInt ();
}
}
public void setInfo(Alien alien[i], String name, String type, int sPosition1, int sPosition2,
int tPosition1, int tPosition2, int iLifePoints)
{
this.name = name;
this.type = type;
this.sPosition1 = sPosition1;
this.sPosition2 = sPosition2;
this.tPosition1 = tPosition1;
this.tPosition2 = tPosition2;
this.iLifePoints = iLifePoints;
}
}
Я знаю, что что-то не так в методе setInfo и, вероятно, в методе gameSetting. Я хочу получить информацию от каждого из двух игроков (инопланетян). Может кто-нибудь сказать мне, что я должен делать?