# left right crnter game

i’m trying to create a left, center, right game using a lcd keypad shield, i’ve tried or, xor, and, every bite-wise operator that would make sense in the game, it’s ether the rolling code or the if statments

``````#include <LiquidCrystal.h>
LiquidCrystal lcd(8, 9, 4, 5, 6, 7);
int randNumber = 0;
// define some values used by the panel and buttons
int lcd_key     = 0;
#define btnRIGHT  0
#define btnUP     1
#define btnDOWN   2
#define btnLEFT   3
#define btnSELECT 4
#define btnNONE   5
// my buttons when read are centered at these valies: 0, 144, 329, 504, 741
// we add approx 50 to those values and check to see if we are close
//if (adc_key_in > 1000) return btnNONE; // We make this the 1st option for speed reasons since it will be the most likely result
// For V1.1 us this threshold

if (adc_key_in > 1000) { return btnNONE; }

// For V1.0 comment the other threshold and use the one below:

if (adc_key_in < 50)   { return btnRIGHT; }

if (adc_key_in < 195)  { return btnUP; }

if (adc_key_in < 380)  { return btnDOWN; }

if (adc_key_in < 555)  { return btnLEFT; }

if (adc_key_in < 790)  { return btnSELECT; }

return btnNONE;  // when all others fail, return this...
}
void setup() {
lcd.begin(16, 2);              // start the library
lcd.setCursor(0, 0);
lcd.print("press select to dice"); // print a simple message
}
void loop(){
int diceOne = random (1,4);
int diceTwo = random (1,4);
int diceThree = random (1,4);
int R;
int L;
int C;

if(lcd_key == btnSELECT) {
lcd.clear();
lcd.setCursor(2, 0);
lcd.print(diceOne);
lcd.setCursor(8, 0);
lcd.print(diceTwo);
lcd.setCursor(14,0);
lcd.print(diceThree);

delay(100);
delay(100);
}
if (diceOne == 3 || diceTwo == 3 || diceThree == 3) {
// if diceOne is 3 or diceTwo is 3 or diceTree is 3
// if diceOne or diceTwo or diceTree is 3

lcd.setCursor (2,0);
lcd.print("R");
}

if (diceOne == 2 || diceTwo == 2 || diceThree == 2) {
// if diceOne is 2 or diceTwo is 2 or diceTree is 2
// if diceOne or diceTwo or diceTree is 2

lcd.setCursor(8,0);
lcd.print ("C");
}

if (diceOne == 1 || diceTwo == 1 || diceThree == 1) {
// if diceOne is 1 or diceTwo is 1 or diceTree is 1