@GeorgeGibby/

T & F Grids

Java

No description

fork
loading
Files
  • Main.java
Main.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
import java.util.Scanner;

import javax.net.ssl.TrustManager;

import java.util.ArrayList;

class Main {
  public static void main(String[] args) {
    Scanner reader = new Scanner(System.in);
    System.out.print("Number of components: ");
    int n = reader.nextInt();
    System.out.println();
    int[][] grid = new int[(int)Math.pow(2,n)][n];
    int alternateEvery = ((int)Math.pow(2,n))/2;
    for(int i = 0; i < n; i++)
    {
      System.out.print("Var " + (i+1)+ "\t");
    }
    System.out.println();
    for(int col = 0; col < grid[0].length; col++)
    {
      int counter = 0;
      for(int row = 0; row < grid.length; row++)
      {
        if(counter < alternateEvery)
          grid[row][col] = 1;
        else
          grid[row][col] = 0;
        counter++;
        if(counter == alternateEvery *2)
          counter = 0;
      }
      alternateEvery /= 2;
    }
    for(int row = 0; row < grid.length; row++)
    {
      for(int col = 0; col < grid[0].length; col++)
      {
        if(grid[row][col] == 1)
          System.out.print("True\t");
        else
          System.out.print("False\t");
      }
      System.out.println();
    }

    while(true)
    {
      System.out.println("\nCommand: ");
      String command = reader.nextLine();
      


    }
  }

  private static ArrayList<String> breakdown(String input)
  /*Need to have it loop through parenthesis and save each into the ArrayList<String> in the order the operations need to be completed. At any given time, position zero will be the remaining string to be tested.
  */

  {
    ArrayList<String> list = new ArrayList<String>();
    list.add(input);

    while(true)
    {
      if(list.get(0) == null)
      {
        list.remove(0);
        return list;
      }
      if(list.get(0).indexOf("(") == -1)
      {
        list.add(list.get(0));
        list.set(0,null);
      }
      else
      {
        list.add(list.get(0).substring(list.get(0).indexOf("(") + 1, list.get(0).indexOf(")")));
      }
    }
  }
}