Game on nokia display

I am using a nokia 5110 display to make a watch I want to put a game on it in which the user tries to avoid moving pillars(aka lines) by moving his/her line with the up and down buttons. I can get the users line to move but my problem is getting the moving pillars to generate in random heights and moving slowly and also how to do the colliding part. please help.

#include <SPI.h>
#include <Adafruit_GFX.h>
#include <Adafruit_PCD8544.h>
#include <Wire.h>
#include <RTClib.h>

// Software SPI (slower updates, more flexible pin options):
// pin 13 - Serial clock out (SCLK)
// pin 11 - Serial data out (DIN)
// pin 3 - Data/Command select (D/C)
// pin 4 - LCD chip select (CS)
// pin 12 - LCD reset (RST)
Adafruit_PCD8544 display = Adafruit_PCD8544(13, 11, 3, 4, 12);
RTC_DS1307 rtc;

int state1;
int state2;
int state3;
int lastState1;
int lastState2;
int lastState3;
int bY;

void setup(){
  pinMode(7, INPUT); //up
  pinMode(8, INPUT);  //select
  pinMode(9, INPUT); //down

  Wire.begin();
  rtc.begin();
  //year, month, day, hour, minute, second
  //rtc.adjust(DateTime(2017, 12, 2, 17, 5, 0));

  display.begin();
  display.setContrast(50);
  display.display();
  display.clearDisplay();
}

void loop(){
  state1 = digitalRead(7);
  state2 = digitalRead(8);
  state3 = digitalRead(9);

  game();

}

void game(){
  display.clearDisplay();
  moveYup();
  moveYdown();
  int x = 1;
  int speedX = 5;
  int y = random(47);
  x += speedX;
 
 display.drawFastVLine(82, bY, 20, BLACK);

 for(int i = 0; i < 4; i++){
  display.drawFastVLine(x, y, 15, BLACK);
 }

 display.display();
}


void moveYup(){
  if(lastState1 != state1){
    if(state1 == HIGH){
        bY++;
    }
  }
    lastState1 = state1;
}

void moveYdown(){
  if(lastState3 != state3){
    if(state3 == HIGH){
        bY--;
    }
  }
    lastState3 = state3;
}

only part of code since original is too long to post

In each run of the game function, you generate random coordinates and lengths of lines to get random lines. Mathematical constraints would have to be applied to these random values according to the type of lines you want to achieve. Or you could have a predefined set of lines(coordinates and lengths) already defined and stored in an array, and use a random number to "draw out" a particular line.

To move the lines, you have to shift the coordinates of these lines every few frames(one frame = one run of game function). Speed of shifting would be controlled by creating a global counter which counts the number of runs of game function and shift the coordinates only a few runs, say 5 or 10.

Colliding can be determined by mathematically checking if the users line and the random moving lines have a coordinate in common.