Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.*;
- public class Input{
- ArrayList<String> startupVars;
- public Input(){
- }
- public int startVal(){
- Scanner scan = new Scanner(System.in);
- System.out.println("Starting Value?");
- return Integer.parseInt(scan.next());
- }
- public boolean startPlayer(){
- String temp;
- Scanner scan = new Scanner(System.in);
- System.out.println("Who's first? Type: 'human' or 'computer'");
- temp = scan.next();
- scan.close();
- if(temp.equalsIgnoreCase("human")){
- return true;
- }
- else{
- return false;
- }
- }
- public ArrayList<Integer> startNumbers(){
- Scanner scan = new Scanner(System.in);
- System.out.println("What numbers can be subtracted? \n Please separate digits by a single space");
- return parseNumbers(scan.nextLine());
- }
- public int startDepth(){
- int temp;
- Scanner scan = new Scanner(System.in);
- System.out.println("How deep can the computer search for a move?");
- temp = Integer.parseInt(scan.next());
- scan.close();
- return temp;
- }
- public ArrayList<Object> parseData(int index){
- ArrayList<Object> temp = new ArrayList<Object>();
- int tempInt = index;
- switch(tempInt){
- case 0:
- temp.add(Integer.parseInt(startupVars.get(tempInt)));
- case 1:
- if(startupVars.get(tempInt).equalsIgnoreCase("human")){
- temp.add(true);
- }
- case 2:
- temp.add(parseNumbers(startupVars.get(tempInt)));
- case 3:
- temp.add(Integer.parseInt(startupVars.get(tempInt)));
- }
- return temp;
- }
- public ArrayList<Integer> parseNumbers(String values){
- ArrayList<Integer> choices = new ArrayList<Integer>();
- List<String> val = Arrays.asList(values.split(" "));
- int temp;
- for(int i = 0; i < val.size(); i++){
- temp = Integer.parseInt(val.get(i));
- System.out.println(temp);
- choices.add(temp);
- }
- return choices;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment