public class board {
// board with 6 slots

  private boolean slots[] = new boolean[7];
  private int i = 0;
  private int xCol1 = 0;
  private int yRow1 = 0;
  private int xCol2 = 101;
  private int yRow2 = 101;
  private int yRow3 = 202;
  private int yEnd = 303;
  private int xEnd = 202;
  private int slotNums[] = new int[7];
  private boolean picUsed[] = new boolean[7];

  board() {
    for (i = 0; i <= 6; i++) {
      slots[i] = false;
      slotNums[i] = i;
      picUsed[i] = false;
//      System.out.println("Slot" + i + " created.");
    }
    slots[0] = true;
  }

  void takeSlot(int slotNum) {
    slots[slotNum] = true;
//    System.out.println("Slot" + slotNum + " was just taken.");
  }

  void openSlot(int slotNum) {
    slotNums[slotNum] = 0;
//    System.out.println("Slot" + slotNum + " was just opened.");
  }

  // true means slot taken
  boolean checkSlot(int slotNum) {
    if (slotNums[slotNum] != 0) {
//      System.out.println("Slot" + slotNum + " is taken.");
      return true;
    }
    else {
//      System.out.println("Slot" + slotNum + " is open.");
      return false; }
  }

  int whichEmpty() {
    for (i = 1; i < 6; i++) {
      if (slotNums[i] == 0) { break; }
    }
    System.out.println("Slot" + i + " is open.");
    return i;
  }

  // only works for 6 slot board ordered left to right
  // then top to bottom
  public boolean isAdjacent(int startPlace, int endPlace) {
    if (startPlace == 1) {
      if (endPlace == 2 || endPlace == 3) { return true; }
    }
    if (startPlace == 2) {
      if (endPlace == 1 || endPlace == 4) { return true; }
    }
    if (startPlace == 3) {
      if (endPlace == 1 || endPlace == 4 || endPlace == 5) { return true; }
    }
    if (startPlace == 4) {
      if (endPlace == 2 || endPlace == 3 || endPlace == 6) { return true; }
    }
    if (startPlace == 5) {
      if (endPlace == 3 || endPlace == 6) { return true; }
    }
    if (startPlace == 6) {
      if (endPlace == 4 || endPlace == 5) { return true; }
    }
    return false;
  }

  public int getXCol1() { return xCol1; }
  public int getXCol2() { return xCol2; }
  public int getYRow1() { return yRow1; }
  public int getYRow2() { return yRow2; }
  public int getYRow3() { return yRow3; }
  public int getYEnd() { return yEnd; }
  public int getXEnd() { return xEnd; }

  public void putInSlot(int inSlot, int inPic) {
    slotNums[inSlot] = inPic;
  }

  public int whichInSlot(int slotNum) {
    System.out.println("Number" + slotNums[slotNum] + " is in Slot" + slotNum);
    return slotNums[slotNum];
  }

  public void usePic(int inPic) {
    picUsed[inPic] = true;
  }

  public boolean isPicUsed(int inPic) {
    return picUsed[inPic];
  }
}//end board

