fistersanonymous

Untitled

Nov 1st, 2014
130
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 2.17 KB | None | 0 0
  1. import java.util.*;
  2. public class Input{
  3.     ArrayList<String> startupVars;
  4.     public Input(){
  5.     }
  6.     public int startVal(){
  7.         Scanner scan = new Scanner(System.in);
  8.         System.out.println("Starting Value?");
  9.         return Integer.parseInt(scan.next());
  10.     }
  11.     public boolean startPlayer(){
  12.         String temp;
  13.         Scanner scan = new Scanner(System.in);
  14.         System.out.println("Who's first? Type: 'human' or 'computer'");
  15.         temp = scan.next();
  16.         scan.close();
  17.         if(temp.equalsIgnoreCase("human")){
  18.             return true;
  19.         }
  20.         else{
  21.             return false;
  22.         }
  23.     }
  24.     public ArrayList<Integer> startNumbers(){
  25.         Scanner scan = new Scanner(System.in);
  26.         System.out.println("What numbers can be subtracted? \n Please separate digits by a single space");
  27.         return parseNumbers(scan.nextLine());
  28.     }
  29.     public int startDepth(){
  30.         int temp;
  31.         Scanner scan = new Scanner(System.in);
  32.         System.out.println("How deep can the computer search for a move?");
  33.         temp = Integer.parseInt(scan.next());
  34.         scan.close();
  35.         return temp;
  36.     }
  37.     public ArrayList<Object> parseData(int index){
  38.         ArrayList<Object> temp = new ArrayList<Object>();
  39.         int tempInt = index;
  40.         switch(tempInt){
  41.             case 0:
  42.                 temp.add(Integer.parseInt(startupVars.get(tempInt)));
  43.             case 1:
  44.                 if(startupVars.get(tempInt).equalsIgnoreCase("human")){
  45.                 temp.add(true);
  46.             }
  47.             case 2:
  48.                 temp.add(parseNumbers(startupVars.get(tempInt)));
  49.             case 3:
  50.                 temp.add(Integer.parseInt(startupVars.get(tempInt)));
  51.         }
  52.         return temp;
  53.     }
  54.     public ArrayList<Integer> parseNumbers(String values){
  55.         ArrayList<Integer> choices = new ArrayList<Integer>();
  56.         List<String> val = Arrays.asList(values.split(" "));
  57.         int temp;
  58.         for(int i = 0; i < val.size(); i++){
  59.             temp = Integer.parseInt(val.get(i));
  60.             System.out.println(temp);
  61.             choices.add(temp);
  62.         }
  63.         return choices;
  64.     }
  65. }
Advertisement
Add Comment
Please, Sign In to add comment