Thank you phi.lho for your suggestion. I'm not sure we were able to do exactly as you suggested here, but my project partner figured out how to make the food come up randomly:

  1. class Location {
      int row; // row id
      int column; // column id
      Location(int row, int column) {
        this.row = row;
        this.column = column;
      }
    }
    Location food;



    ArrayList<Location> snake;
    final int COLS = 20;
    final int ROWS = 20;

    // ArrayList<Location> food;
    // final int FOODROWS = (int) random(ROWS);
    // final int FOODCOLS = (int) random(COLS);


    void setup() {
      size(500, 500);
      reset();
    }

    void reset() {
      snake = new ArrayList<Location>();
      snake.add(new Location(1,3));
      snake.add(new Location(1,2));
      snake.add(new Location(1,1));
      // add food:
      food = new Location( (int) random(COLS), (int) random(ROWS));
    }

    void drawFood() {
     drawRect(food);
     
      }

    void drawSnake(){
      for(Location l : snake){
        drawRect(l);
      }
    }

    void drawRect(Location value) {
      int w = width / COLS;
      int h = height / ROWS;
      fill(0);
      stroke(255);
      rect(value.column * w, value.row * h, w, h);
    }

    void draw() {
      background(100);   
       // updateSnake();
        drawSnake();
        drawFood();
       
    }

    // Simple test of moving snake to the right
    void keyPressed() {
      int direction = RIGHT;
      if (key == CODED) {
        direction = keyCode;
      }
      // if(!gotFood){
      snake.remove(snake.size() - 1); // remove old tail
      Location head = snake.get(0); // current head
      Location newHead = null;
     
      switch(direction) {
        case RIGHT:
          newHead = new Location(head.row, head.column + 1);
          break;
        case LEFT:
          newHead = new Location(head.row, head.column - 1);
          break;
        case UP:
          newHead = new Location(head.row - 1, head.column);
          break;
        case DOWN:
          newHead = new Location(head.row + 1, head.column);
          break;
      }
      snake.add(0, newHead); // add new head to right of old
    }

So now we are stuck again on how to make to the snake grow (add another block to the snake) as soon as it touches the food location and then make the food disappear, while also making it reappear in another random location.

Do you have any tips/advice on how to go about this? We have asked our professor and we did get a lot of help from him, but we just need a different perspective on how to go about making this game work before next Tuesday.

Thank you for your help.