/** The weight and values of treasures. To be used in the GA assignment. */

class Values {

  private int[] weight = {
      21, 14, 21, 8, 4, 20, 22, 27, 1, 18, 21, 1, 18, 9, 1, 8, 22, 9, 2, 1, 10,
      13, 28, 30, 30, 18, 23, 2, 10, 4, 26, 30, 16, 21, 18, 15, 11, 23, 1, 25,
      9, 30, 11, 29, 28, 15, 15, 8, 20, 6};

  private int[] values = {
      8, 5, 29, 20, 11, 7, 21, 16, 8, 48, 2, 49, 43, 28, 27, 22, 30, 39, 10, 16,
      39, 47, 17, 37, 9, 24, 11, 27, 40, 48, 24, 13, 30, 38, 30, 1, 13, 12, 19,
      19, 16, 33, 25, 3, 24, 29, 38, 16, 9,
      30};

  /** Returns the value of item i. i must be in the interval 0..49 */

  public int getValue(int i) {
    int v = 0;
    try {
      v = values[i];
    }
    catch (Exception e) {
      System.out.println("Values:getValue(int): Invalid index " + i + ".");
      System.exit(0);
    }
    return v;
  }

  /** Returns the weight of item i. i must be in the interval 0..49 */

  public int getWeight(int i) {
    int w = 0;
    try {
      w = weight[i];
    }
    catch (Exception e) {
      System.out.println("Values:getWeight(int): Invalid index "
                         + i + ".");
      System.exit(0);
    }
    return w;
  }
}
