Final Code

#include “FEHLCD.h”
#include “cstdlib”
/**
 * Entry point to the application.
 *
 * @returns status code of program exit
 */
//function prototypes
using namespace std;
/*
  Create A class for the game to house all of the functions
*/
/*Class: RockPokemonScissors
This class holds all of the public member functions, and provate member variables
that run the operation of the game ‘Rock Pokemon Scissors!’
Author: Nate Broelmann*/
class RockPokemonScissors {
public:                     //Public holds the functions that will do everything
    /*draws the menu*/
    void DrawMenu();
      void Instructions();  //draws the instructions
      void Credits();       //draws the credits
    /*draws the first screen*/
    void DrawScreen1();
      void SetCharPos1();   //sets the character to the start on screen 1
      void MoveCharacter(); //moves the character after every click
    /*we will have three screens*/
      void DrawScreen2();   //Draws the 2nd screen with TAs, character, wins and losses
        void SetCharPos2(); //set the character’s postion to the left side of the screen
      void DrawScreen3();   //Draws the character’s standoff with the final boss
        void SetCharPos3();
      void LossScreen();    //Draws the Loss Screen
      void WinScreen();     //Draws the win screen
    /*integral for communication between intmain and provate variabes*/
    int Segway1();  //used for screen 1 to see if battle should happen or screen swap should happen
    int Segway2();  //used for screen 2 to check for battles and the screen’s edge
    int Segway3();  //used for screen 3 to check for final battle
    /*Battle Functions*/
    void DrawBatSeq();    //Draws the base battle scene for everybattle
    void BattleYiyang();  //battle operation for a duel against Yiyang
    void BattleMaddy();   //battle operation for a duel against Maddy
    void BattleTJ();      //battle operation for a duel against TJ
    void BattleC();       //battle operation for a duel against the final boss
private:
    int xTouch, yTouch;     //varibles we can use for screen touches in all functions
    int healthY;            //player’s health bar, if below 0 or below, add one to losses
    int FinalHealth = 100;  //player’s health after the final battle
    int wins = 0;           //Variables that keep track of the wins
    int losses = 0;         //and losses of the player
    int xPosition = 39;     //postion of the Player’s character
    int yPosition = 129;
    /*coordinates of the TAs*/
    int TAyPosition = 105;  //y position of all of the TAs
    int Yiyang = 179;       //x position of Yiyang (first challenger)
    int Maddy = 99;         //x position of Maddy
    int TJ = 239;           //x position of TJ
    int FinalBoss = 170;    //x position of the final boss
}; /*end the game class*/
/*
  Start Int Main
*/
int main() {
int play = 1;
while (play == 1) {        //This while loop will let the game run indefinitely
    /*declarations*/
    RockPokemonScissors RPS;
    int xTouch, yTouch, menu = 1, screen = 1, battle = 0, LOSER = 1;
  /*
    MENU WHILE LOOP
  */
  while(menu == 1) {        //Menu While loop
                                             //Draws the Menu and Controls its operations
      RPS.DrawMenu();       //draw menu command
      /*while loop that waits until a touch is made,
      This repeats throughout the code anytime this is needed*/
      while (!LCD.Touch(&xTouch, &yTouch)){}
        if (yTouch <= 60)   //if touch is in the title box
        {
            menu = 1;
        }
        else if (yTouch > 60 && yTouch <= 120) //user selects instructions
        {
            RPS.Instructions();                //command draws the instruction page
        }
        else if (yTouch > 120 && yTouch <=180) //user selects play game
        {
            //go to the game play portion of the code
            //exit while loop to start game code
            menu = 0;
        }
        else // (yTouch > 180) – user selects Credits
        {
            //display the credits
            RPS.Credits();
        } /*END IF STATEMENT*/
    } /*END MENU LOOP*/
while (LOSER == 1) {                         //When the player looses the final battle,
                                             //They are sent back to the beginning.
  /*
    Start Screen One Loop
  */
  RPS.SetCharPos1();
  LCD.Clear();
  /*Draw The First Screen*/
  RPS.DrawScreen1();
  while (screen == 1) {                       //Dictates the logic and operation behind screen 1
        while (!LCD.Touch(&xTouch, &yTouch)){}
        if (xTouch > 160) {                    //If the touch is on the right half
            RPS.MoveCharacter();               //update character position
            RPS.DrawScreen1();                 //redraws the screen and character
            battle = RPS.Segway1();            //Check if a battle or switch screen should occur
        }
        else {
            //nothing
        }
        if (battle == 1) {                     //If character lines up with Yiyang
            /*put in all of the functions for a battle against yiyang*/
            RPS.DrawBatSeq();
            RPS.BattleYiyang();
            while (!LCD.Touch(&xTouch, &yTouch)){}
            LCD.Clear();
            RPS.DrawScreen1();
        }
        else if (battle == 2) {                //character is at the edge of the screen
            /*transisiton to screen 2*/
            screen = 2;
        }
        else {
            //nothing
        }
    } /*END SCREEN ONE LOOP*/
  /*
    Start the loop for screen 2
  */
  RPS.SetCharPos2();                          //sets character back to the left of the screen
  LCD.Clear();
  /*Draw The Second Screen*/
   RPS.DrawScreen2();
  while (screen == 2) {                       //Dictates the logic and operation behind screen 2
        while (!LCD.Touch(&xTouch, &yTouch)){}
        if (xTouch > 160) {                    //If the touch is on the right half
            RPS.MoveCharacter();               //update character postion
            RPS.DrawScreen2();                 //redraws the screen and charcter
            battle = RPS.Segway2();            //Check if a battle or switch screen should occur
        }
        else {
            //nothing
        }
        if (battle == 1) {                     //If character lines up with Maddy
            /*put in all of the funcions for a battle against Maddy*/
            RPS.DrawBatSeq();
            RPS.BattleMaddy();
            while (!LCD.Touch(&xTouch, &yTouch)){}
            LCD.Clear();
            RPS.DrawScreen2();
        }
        else if (battle == 2) {                //If character lines up with TJ
            /*put in all of the stuff for a battle against TJ*/
            RPS.DrawBatSeq();
            RPS.BattleTJ();
            while (!LCD.Touch(&xTouch, &yTouch)){}
            LCD.Clear();
            RPS.DrawScreen2();
        }
        else if (battle == 3) {                //user is at the edge of the scrren
            /*Transition to screen 3*/
            screen = 3;
        }
        else {
          //nothing
        }
    } /*END SCREEN TWO LOOP*/
  /*
    Start the loop for screen 3
  */
  RPS.SetCharPos3();                          //set the character back to the left
  LCD.Clear();
  /*Draw The Third Screen*/
  RPS.DrawScreen3();
  while (screen == 3) {                       //Dictates the logic and operation behind screen 3
        while (!LCD.Touch(&xTouch, &yTouch)){}
        if (xTouch > 160) {                    //If the touch is on the right half
            RPS.MoveCharacter();               //update character postion
            RPS.DrawScreen3();                 //redraws the screen and charcter
            battle = RPS.Segway3();            //Check if a battle or switch screen should occur
        }
        else {
            //nothing
        }
        if (battle == 1) {                     //If character lines up with the final boss
            /*put in all of the funcions for a battle against the boss*/
            RPS.DrawBatSeq();
            RPS.BattleC();
            while (!LCD.Touch(&xTouch, &yTouch)){}
            LCD.Clear();
            RPS.DrawScreen3();
        }
        else if (battle == 2) {
            screen = 4;                        //exit to loss screen
        }
        else if (battle == 3) {
            screen = 5;                        //exit to win screen
        }
        else {
          //nothing
        }
    } /*END SCREEN THREE LOOP*/
    /*
      Loop for Loss or win Screen
    */
  while (screen == 4) {
      RPS.LossScreen();                        //Draws to the Loss Screen
      screen = 1;
  }
  while (screen == 5) {
      RPS.WinScreen();                         //Draws The Win screen
      screen = 1;
      LOSER = 0;                               //Sends the player back to the menu
  }
} /*CLOSE BRACKET FOR “LOSER” LOOP*/
} /*END BRACKET FOR “PLAY” LOOP*/
  return 0;
} /*END INT MAIN*/
/*
  Put all of the Functions Here
*/
/*Function: DrawMenu
This function is a public member of the class RockPokemonScissors and it does not
use any member variables. This function does not have any input or return arguments.
The purpose of this function is to draw the main menu when the user launches the game.
This is the first part of the game that the user will see. Author: Nate Broelmann*/
void RockPokemonScissors::DrawMenu() {
    LCD.Clear();
    LCD.SetFontColor(LCD.Black);
    LCD.SetDrawColor(LCD.White);
    //draw a background rectangle for the title box
    LCD.FillRectangle(0,0,320,60);
    //Draw the words on the Screen “title” “play button” “instructions” “credits”
    LCD.WriteAt(“Rock Pokemon Scissors!”,10,20);
    LCD.SetFontColor(LCD.White);
    LCD.WriteAt(“Instructions”,10,80);
    LCD.WriteAt(“Play Game”,10,140);
    LCD.WriteAt(“Credits”,10,200);
    //Draw the Lines to seperate the Menu Options
    LCD.DrawHorizontalLine(60,0,319);
    LCD.DrawHorizontalLine(120,0,319);
    LCD.DrawHorizontalLine(180,0,319);
}
/*Function: instructions
This function is a public member of the class RockPokemonScissors and it does not
use any member variables. This function does not have any input arguments or
return arguments. This functions is used clear the LCD display, and then
write out the instructions for the game. This instruction page is accessed via
the menu. Author: Jackson Goodall*/
void RockPokemonScissors::Instructions() {
//display instructions
            LCD.Clear();
            LCD.SetFontColor(LCD.White);
            LCD.WriteAt(“INSTRUCTIONS:”, 5, 20);
            LCD.WriteAt(“In this game, you will challenge the TA’s”, 5, 40);
            LCD.WriteAt(“To legendary duels of the ancient game:”, 5, 60);
            LCD.WriteAt(“Rock, paper, and scissors”, 5, 80);
            LCD.WriteAt(“Click the right side of the screen to move”, 5, 100);
            LCD.WriteAt(“When you line up with a TA, you will fight”, 5, 120);
            LCD.WriteAt(“Select Rock, Paper or Scissors to fight!”, 5, 140);
            LCD.WriteAt(“Good Luck! :)”, 5, 160);
            //Tell user how to return to menu
            LCD.WriteAt(“Click anywhere to return to main menu”, 5, 200);
            //Wait for touch
            while (!LCD.Touch(&xTouch, &yTouch))
            {} //Wait forever until touch is made
}
/*Function: Credits
This function is a public member of the class RockPokemonScissors and it does not
use any member variables. This functions does not have any input arguements or
return arguments. This function is used to clear the LCD screen and write out the
credits. Author: Jackson Goodall */
void RockPokemonScissors::Credits() {
//Display Credits
            LCD.Clear();
            LCD.SetFontColor(LCD.White);
            LCD.WriteAt(“Developer: ALPHA-MEGA TEAM SQUAD”, 5, 20);
            LCD.WriteAt(“Editors Include: “, 5, 60);
            LCD.WriteAt(“V Haupt, “, 5, 80);
            LCD.WriteAt(“Nate Broelmann,”, 5, 100);
            LCD.WriteAt(“Jackson Goodall”, 5, 120);
            LCD.WriteAt(“REFERENCES:”, 5, 160);
            LCD.WriteAt(“Nintendo, Game Freak”, 5, 180);
            //Tell user how to return to menu
            LCD.WriteAt(“Click anywhere to return to Menu”, 5, 220);
            //Wait for touch
            while (!LCD.Touch(&xTouch, &yTouch)){}
}
/*Function: SetCharPos1
This function is a public member of the class RockPokemonScissors and it does not
uses the ‘xPosition’ memeber variable. This function does not have any input or return
arguments. The purpose of this function is to set the position of the player character
back to the left side of the screen before screen 1 is drawn for the first time
of each playthrough. Author: Nate Broelmann*/
void RockPokemonScissors::SetCharPos1() {
  xPosition = 39;
}
/*Function: DrawScreen1
This function doesn’t take any input or return arguments.
The purpose of this function is to Draw the first screen of the game (after the menu)
The player character moves around on this screen and accesses battles from
this screen. This function also draws the player character.
Author: Nate Broelmann*/
void RockPokemonScissors::DrawScreen1() {
    LCD.SetDrawColor(LCD.Red);
    //draw the big rectangle
    LCD.DrawRectangle(4,4,311,231);
    //draw the small red rectangle
    LCD.DrawRectangle(314,89,6,60);
    //draw the black rectangles
    LCD.SetDrawColor(LCD.Black);
    LCD.DrawRectangle(0,0,320,240);
    LCD.DrawRectangle(309,89,6,60);
    //Draw Yiyang
    LCD.SetDrawColor(LCD.Green);
    LCD.SetFontColor(LCD.White);
    LCD.DrawCircle(179,78,10);
    LCD.WriteAt(“Yiyang”, 150, 50);
    //draw a nice house
    LCD.DrawRectangle(24,30,68,48);     //main body
    LCD.DrawRectangle(40,58,15,20);     //door
    LCD.DrawCircle(50,68,3);            //door handle
    LCD.DrawHorizontalLine(28,24,91);   //roof bottom line
    LCD.DrawLine(24,26,58,8);           //left roof slant
    LCD.DrawLine(91,26,58,8);           //right roof slant
    LCD.DrawRectangle(67,35,20,20);     //window outline
    LCD.DrawHorizontalLine(45,67,86);   //horizontal window pane
    LCD.DrawVerticalLine(77,35,54);     //vertical window pane
    //draw grass 1 outside
    LCD.DrawRectangle(222,212,2,2);     //top left of vertical
    LCD.DrawRectangle(222,214,2,2);
    LCD.DrawRectangle(222,216,2,2);
    LCD.DrawRectangle(222,218,2,2);
    LCD.DrawRectangle(224,210,2,2);     //top left of horizontal
    LCD.DrawRectangle(226,210,2,2);
    LCD.DrawRectangle(229,212,2,2);     //top left of vertical
    LCD.DrawRectangle(229,214,2,2);
    LCD.DrawRectangle(229,216,2,2);
    LCD.DrawRectangle(229,218,2,2);
    LCD.DrawRectangle(231,210,2,2);     //top left of horizontal
    LCD.DrawRectangle(233,210,2,2);
    //draw grass 2 outside
    LCD.DrawRectangle(9,70,2,2);     //top left of vertical
    LCD.DrawRectangle(9,72,2,2);
    LCD.DrawRectangle(9,74,2,2);
    LCD.DrawRectangle(9,76,2,2);
    LCD.DrawRectangle(11,68,2,2);     //top left of horizontal
    LCD.DrawRectangle(13,68,2,2);
    LCD.DrawRectangle(16,70,2,2);     //top left of vertical
    LCD.DrawRectangle(16,72,2,2);
    LCD.DrawRectangle(16,74,2,2);
    LCD.DrawRectangle(16,76,2,2);
    LCD.DrawRectangle(18,68,2,2);     //top left of horizontal
    LCD.DrawRectangle(20,68,2,2);
    /* Now screen elements that change */
    LCD.SetDrawColor(LCD.Black);
    LCD.FillRectangle(20,118,299,30);
    LCD.FillRectangle(74,199,10,33);
    //character
    LCD.SetDrawColor(LCD.Red);
    //draw the circle that is the character: GIVE THEM LIFE
    LCD.DrawCircle(xPosition,yPosition,10);
    //put the wins/losses on the screen
    LCD.SetFontColor(LCD.White);
    LCD.WriteAt(“Wins:  “, 5, 200);
    LCD.WriteAt(wins, 75, 200);
    LCD.WriteAt(“Losses:  “, 5, 220);
    LCD.WriteAt(losses, 75, 220);
}
/*Function: SetCharPos2
This function is a public member of the class RockPokemonScissors and it does not
uses the ‘xPosition’ member variable. This function does not have any input or return
arguments. The purpose of this function is to set the position of the player character
back to the left side of the screen before screen 2 is drawn for the first time
of each playthrough. Author: Nate Broelmann*/
void RockPokemonScissors::SetCharPos2() {
  xPosition = 39;
}
/*
FUNCTION: DrawScreen2: (Jackson Goodall)
This function is a public member of the class RockPokemonScissors and it uses
the private member variables, xPosition, yPosition, wins, and losses. This function
displays the second screen of the game, including the two TA’s Maddy and TJ, the
path that is outlined for the character, and a wins/losses counter. This function
also draws the character to the screen with an updated location each time it is called.
*/
void RockPokemonScissors::DrawScreen2() {
    //Set draw color and draw game border
    LCD.SetDrawColor(LCD.Red);
    LCD.DrawHorizontalLine(90, 0, 320);
    LCD.DrawHorizontalLine(150, 0, 320);
    /*
        Draw TA’s
    */
    //Set write color for name tags
    LCD.SetFontColor(LCD.White);
    //Draw Maddy
    LCD.SetDrawColor(LCD.Gray);
    LCD.DrawCircle(99, 78, 10);
    LCD.WriteAt(“Maddy”, 75, 50);
    //Draw TJ
    LCD.SetDrawColor(LCD.Blue);
    LCD.DrawCircle(239, 78, 10);
    LCD.WriteAt(“TJ”, 230, 50);
    //draw the character
    LCD.SetDrawColor(LCD.Black);
    LCD.FillRectangle(20,118,299,30);
    LCD.FillRectangle(74,199,10,33);
    LCD.SetDrawColor(LCD.Red);
    LCD.DrawCircle(xPosition,yPosition,10);
    //display wins and losses counter
    LCD.SetFontColor(LCD.White);
    LCD.WriteAt(“Wins:  “, 5, 200);
    LCD.WriteAt(wins, 75, 200);
    LCD.WriteAt(“Losses:  “, 5, 220);
    LCD.WriteAt(losses, 75, 220);
}
/*Function: SetCharPos3
This function is a public member of the class RockPokemonScissors and it does not
uses the ‘xPosition’ member variable. This function does not have any input or return
arguments. The purpose of this function is to set the position of the player character
back to the left side of the screen before screen 3 is drawn for the first time
of each playthrough. Author: Nate Broelmann*/
void RockPokemonScissors::SetCharPos3() {
  xPosition = 90;
}
/*
FUNCTION: DrawScreen3: (Jackson Goodall)
This function is a public member of the class RockPokemonScissors and it uses
the private member variables, xPosition, yPosition, wins, and losses. This function
displays the third screen of the game, including the final boss (Dr. Parke’s Cat), the
path screen outline, and a wins/losses counter. This function also draws the character
to the screen with an updated location each time it is called.
*/
void RockPokemonScissors::DrawScreen3() {
    //Set Draw color and draw game border
    LCD.SetDrawColor(LCD.Red);
    LCD.DrawRectangle(0, 10, 315, 220);
    LCD.SetDrawColor(LCD.Black);
    LCD.DrawRectangle(0, 0, 320, 240);
    //Draw Final Boss
    LCD.SetDrawColor(LCD.White);
    LCD.DrawCircle(250, 130, 40);
    //right ear
    LCD.DrawLine(255, 100, 295, 100);
    LCD.DrawLine(255, 100, 275, 65);
    LCD.DrawLine(275, 65, 295, 100);
    //left ear
    LCD.DrawLine(245, 100, 205, 100);
    LCD.DrawLine(245, 100, 225, 65);
    LCD.DrawLine(225, 65, 205, 100);
    //Eyes
    LCD.DrawCircle(265, 115, 6);
    LCD.DrawCircle(235, 115, 6);
    //Nose
    LCD.DrawLine(245, 135, 255, 135);
    LCD.DrawLine(255, 135, 250, 126);
    LCD.DrawLine(250, 126, 245, 135);
    //Mouth
    LCD.DrawCircle(250, 150, 7);
    //Right whiskers
    LCD.DrawLine(265, 140, 285, 130);
    LCD.DrawLine(270, 145, 295, 142);
    LCD.DrawLine(263, 152, 287, 158);
    //Left whiskers
    LCD.DrawLine(235, 140, 217, 130);
    LCD.DrawLine(230, 145, 210, 140);
    LCD.DrawLine(237, 152, 214, 162);
    //Give the beast a name!
    LCD.SetFontColor(LCD.White);
    LCD.WriteAt(“Dr Parke’s Cat?!”, 185, 190);
    //Draw the Player
    LCD.SetDrawColor(LCD.Black);
    LCD.FillRectangle(50,85,158,90);
    LCD.FillRectangle(74,199,10,25);
    LCD.SetDrawColor(LCD.Red);
    LCD.DrawCircle(xPosition,130,40);
    //display wins and losses counter
    LCD.SetFontColor(LCD.White);
    LCD.WriteAt(“Wins:  “, 5, 180);
    LCD.WriteAt(wins, 75, 180);
    LCD.WriteAt(“Losses:  “, 5, 200);
    LCD.WriteAt(losses, 75, 200);
}
/*
FUNCTION: LoseScreen: (Jackson Goodall)
This function is a public member of the class RockPokemonScissors and it does not
use any member variables. This function clears the screen and writes information for
the user to the screen. This function tells the user that they have lost the game and
that they can press anywhere on the screen to start back at the beginning.
*/
void RockPokemonScissors::LossScreen() {
LCD.Clear();
    //tell the user they have lost, but they can play until they win!
    LCD.WriteAt(“You have lost :(“, 10, 10);
    LCD.WriteAt(“However, you can play again!”, 10, 30);
    LCD.WriteAt(“You will restart the game…”, 10, 50);
    LCD.WriteAt(“But your wins/losses stay with you!”, 10, 70);
    LCD.WriteAt(“The more wins, the easier the game!”, 10, 90);
    LCD.WriteAt(“Good luck!”, 10, 110);
    LCD.WriteAt(“Press anywhere to return to start”, 10, 200);
    //Wait for touch
    while (!LCD.Touch(&xTouch, &yTouch))
    {}  //Wait forever until touch is made
}
/*
FUNCTION: WinScreen: (Jackson Goodall)
This function is a public member of the class RockPokemonScissors and it does not
use any member variables. This function clears the screen and writes information for
the user to the screen. This function tells the user that they have won the game and have
defeated the evil FEH Department. It also tells them that they can click anywhere to return
to the main menu.
*/
void RockPokemonScissors::WinScreen() {
LCD.Clear();
    //tell the user they won!
    LCD.WriteAt(“CONGRATULATIONS, you win!”, 10, 10);
    LCD.WriteAt(“You have defeated Dr. Parke’s”, 10, 30);
    LCD.WriteAt(“Evil Cat, and the Tosu region”, 10, 50);
    LCD.WriteAt(“Is now free from the totalitarian”, 10, 70);
    LCD.WriteAt(“rule of the FEH Department”, 10, 90);
    LCD.WriteAt(“Press anywhere to return to main menu”, 5, 200);
    //Wait for touch
    while (!LCD.Touch(&xTouch, &yTouch))
    {}  //Wait forever until touch is made
}
/*Function: MoveCharacter
This function does not take any input or return arguments.
This function uses the private class member ‘xPosition’
The purpose of this function is update the position of the
player character whenever to screen is clicked on the right half
Author: Nate Broelmann*/
void RockPokemonScissors::MoveCharacter() {
    //move the position of the character over by one character length
    xPosition = xPosition + 20;
}
/*Battle Segway functions*/
/*checks if the position lines up with any of the TAs and returns either 1 or 0*/
/*Function: Segway1
This function does not take any input arguments and returns the value of ‘xReturn’
This function uses the private class members ‘xPosition’ and ‘Yiyang’
The purpose of this function is to check if the player character
lines up with the challenger Yiyang, or the right edge of the screen for screen 1.
If they position is the same as any of those conditions, the function returns an
integer that is used to determine the next action that the game takes.
Author: Nate Broelmann */
int RockPokemonScissors::Segway1() {
  int xReturn = 0; //set the return variable to 0 everytime this is called
  if (xPosition == Yiyang) {  //If the character lines up with Yiyang
      xReturn = 1;
  }
  else if (xPosition > 299) { //If the character is at the edge of the screen
      xReturn = 2;
  }
  else { //charater doesn’t line up with anyone
      xReturn = 0;
  }
return xReturn;
}
/*Function: Segway2
This function does not take any input arguments and returns the value of ‘xReturn’
This function uses the private class members ‘xPosition’, ‘Maddy’ and ‘TJ’
The purpose of this function is to check if the player character
lines up with the challenger Maddy, TJ, or the right edge of the screen for screen 2.
If they position is the same as any of those conditions, the function returns an
integer that is used to determine the next action that the game takes.
Author: Nate Broelmann */
int RockPokemonScissors::Segway2() {
  int xReturn = 0;
  if (xPosition == Maddy) {
      xReturn = 1;
  }
  else if (xPosition == TJ) {
      xReturn = 2;
  }
  else if (xPosition > 299) {
      xReturn = 3;
  }
  else {
      xReturn = 0;
  }
return xReturn;
}
/*Function: Segway3
This function does not take any input arguments and returns the value of ‘xReturn’
This function uses the private class members ‘xPosition’, ‘FinalBoss’ and ‘FinalHealth’
The purpose of this function is to check if the player character
lines up with the final boss of the game on screen 3. Additionally, this
function checks the health of the user at the end of the final battle
to decide player win or loss. The function returns an appropriate integer based on
the checked conditions of position and health.
Author: Nate Broelmann */
int RockPokemonScissors::Segway3() {
    int xReturn = 0;
    xReturn = 0;
    if (xPosition == FinalBoss) {
        xReturn = 1;
    }
    else if (FinalHealth <= 0) {
        xReturn = 2;
    }
    else if (FinalHealth > 1 && FinalHealth <= 46) {
        xReturn = 3;
    }
    else {
        xReturn = 0;
    }
return xReturn;
}
/*
  Battle functions
*/
/*This function does not take any input arguments or output values.
The function draws the basic background and common elements that
are the same throughout each battle. i.e.: user character, border,
user name, and outline of health bars.
author: V Haupt */
void RockPokemonScissors::DrawBatSeq()
{
    LCD.Clear(); // clear screen
    //draw char
    LCD.SetDrawColor(LCD.Red);
    LCD.FillCircle(50,140,30);
    //draw dialouge/battle options base rectangle
    LCD.SetDrawColor(LCD.White);
    LCD.FillRectangle(9,149,299,80);
    //draw boarder
    LCD.DrawRectangle(4,4,309,229);
    //draw health bar outline
    LCD.DrawRectangle (90,30,50,18);
    LCD.DrawRectangle(200,126,50,18);
    //set char name
    LCD.SetFontColor(LCD.White);
    LCD.WriteAt(“You”,260,130);
}
/*This function does not take any input arguments or output values.
The function contains the battle sequence the user has with UTA
Yiyang. This is the introductory battle, so the user will always
win.
author: V Haupt */
void RockPokemonScissors::BattleYiyang ()
{
    //initialise variables
    int healthYY = 46 , x, y, k;
    //write opponent’s name
    LCD.SetFontColor(LCD.White);
    LCD.WriteAt(“Yiyang”,25,30);
    //draw opponent’s char
    LCD.SetDrawColor(LCD.Green);
    LCD.FillCircle(248,59,25);
    //draw user’s health bar, will be unchanged throughout battle
    LCD.FillRectangle(202,128,46,14);
    //forces 2 games ony because it’s best 2/3 and yiyang always loses:)
    for ( k=0; k < 2; k++ ){
        //clears dialouge box
        LCD.SetDrawColor(LCD.White);
        LCD.FillRectangle(9,149,299,80);
        //yiyang’s health bar
        LCD.SetDrawColor(LCD.Green);
        LCD.FillRectangle(92,32,healthYY,14);
        //dialouge
        LCD.SetFontColor(LCD.Black);
        LCD.WriteAt(“UTA Yiyang wants to fight! “,15,155);
        //add text options for rock paper scissors and baxes around them
        LCD.SetDrawColor(LCD.Black);
        LCD.DrawRectangle(29,185,60,25);
        LCD.DrawRectangle(109,185,65,25);
        LCD.DrawRectangle(198,185,90,25);
        LCD.WriteAt(“ROCK”,35,190);
        LCD.WriteAt(“PAPER”,116,190);
        LCD.WriteAt(“SCISSORS”,204,190);
        //waits for touch
        while(!LCD.Touch( &x, &y))
         {}
        //clear dialouge box
        LCD.SetDrawColor(LCD.White);
        LCD.FillRectangle(9,149,299,80);
        //determines user’s move and yiyang’s move based on it
        if (x<=99){
            //player chose rock, yiyang will choose scissors
            LCD.WriteAt(“You chose ROCK. “,15,155);
            LCD.WriteAt(“Yiyang chose SCISSORS, you won!”,15,175);
        }
        else if ((x>99) && (x<=186)){
            //player chose paper, yiyang will choose rock
            LCD.WriteAt(“You chose PAPER. “,15,155);
            LCD.WriteAt(“Yiyang chose ROCK, you won!”,15,175);
        }
        else if (x>186){
            //player chose scissors, yiyang will choose paper
            LCD.WriteAt(“You chose SCISSORS. “,15,155);
            LCD.WriteAt(“Yiyang chose PAPER, you won!”,15,175);
        }
        else {}
        //wait for touch before next round starts
        while(!LCD.Touch(&x, &y))
        {}
        //decrement health bar
        healthYY-=23;
        LCD.SetDrawColor(LCD.Black);
        LCD.FillRectangle(92,32,46,14);
    } //end of for loop
  wins++;
}
/*This function does not take any input arguments or output values,
but the wins/losses variable that it shares a class with will be
changed. The function contains the battle sequence for UTA Maddy.
Maddy has pre programmed moves; if the user picks the same move
as her, Maddy will chose the move that beats theirs making her
one of the hardest opponents, second only to the boss.
author: V Haupt */
void RockPokemonScissors::BattleMaddy()
{
    //initialize variables
    int healthY=46, healthM=46, x, y; //take wins/loss initlization out once in class, needed her for initiliat testing
    //draw opponent and write thier name
    LCD.SetDrawColor(LCD.Gray);
    LCD.FillCircle(248,59,25);
    LCD.SetFontColor(LCD.White);
    LCD.WriteAt(“Maddy”,25,30);
    //starting health bars
    LCD.SetDrawColor(LCD.Green);
    LCD.FillRectangle(92,32,46,14);
    LCD.FillRectangle(202,128,46,14);
    //write dialouge
    LCD.SetFontColor(LCD.Black);
    LCD.WriteAt(“UTA Maddy wants to fight! “,15,155);
    //add text options for rock paper scissors and baxes around them
    LCD.SetDrawColor(LCD.Black);
    LCD.DrawRectangle(29,185,60,25);
    LCD.DrawRectangle(109,185,65,25);
    LCD.DrawRectangle(198,185,90,25);
    LCD.WriteAt(“ROCK”,35,190);
    LCD.WriteAt(“PAPER”,116,190);
   LCD.WriteAt(“SCISSORS”,204,190);
    //waits for touch
    while(!LCD.Touch( &x, &y)){}
    //clear dialouge box
    LCD.SetDrawColor(LCD.White);
    LCD.FillRectangle(9,149,299,80);
    //round 1 maddy will chose papper unless player also chose
    //paper in which case she will choose scissors
    if (x<=99){
        LCD.WriteAt(“You chose ROCK, “,15,155);
        LCD.WriteAt(“Maddy chose PAPER, you lost!”,15,175);
        //decrement health bar
        healthY-=23;
        LCD.SetDrawColor(LCD.Black);
        LCD.FillRectangle(202,128,46,14);
        LCD.SetDrawColor(LCD.Green);
        LCD.FillRectangle(202,128,healthY,14);
    }
    else if ((x>99) && (x<=186)){
        LCD.WriteAt(“You chose PAPER, “,15,155);
        LCD.WriteAt(“Maddy chose SCISSORS, you lost!”,15,175);
        healthY-=23;
        LCD.SetDrawColor(LCD.Black);
        LCD.FillRectangle(202,128,46,14);
        LCD.SetDrawColor(LCD.Green);
        LCD.FillRectangle(202,128,healthY,14);
    }
    else if (x>186){
        LCD.WriteAt(“You chose SCISSORS, “,15,155);
        LCD.WriteAt(“Maddy chose PAPER, you won!”,15,175);
        healthM-=23;
        LCD.SetDrawColor(LCD.Black);
        LCD.FillRectangle(92,32,46,14);
        LCD.SetDrawColor(LCD.Green);
        LCD.FillRectangle(92,32,healthM,14);
    }
    else {
        LCD.SetFontColor(LCD.White);
        LCD.Write(“Round 1 messed up :/”);
    }
    //wait for touch
    while(!LCD.Touch(&x, &y)){}
    //round 2
    //Back to choice selection
    LCD.SetDrawColor(LCD.White);
    LCD.FillRectangle(9,149,299,80);
    //add text options for rock paper scissors and baxes around them
    LCD.SetDrawColor(LCD.Black);
    LCD.DrawRectangle(29,185,60,25);
    LCD.DrawRectangle(109,185,65,25);
    LCD.DrawRectangle(198,185,90,25);
    LCD.SetFontColor(LCD.Black);
    LCD.WriteAt(“ROCK”,35,190);
    LCD.WriteAt(“PAPER”,116,190);
    LCD.WriteAt(“SCISSORS”,204,190);
    //waits for touch
    while(!LCD.Touch( &x, &y)){}
    //clear dialouge box
    LCD.SetDrawColor(LCD.White);
    LCD.FillRectangle(9,149,299,80);
    if (x<=99){
        LCD.WriteAt(“You chose ROCK, “,15,155);
        LCD.WriteAt(“Maddy chose PAPER, you lost!”,15,175);
        healthY-=23;
        LCD.SetDrawColor(LCD.Black);
        LCD.FillRectangle(202,128,46,14);
        LCD.SetDrawColor(LCD.Green);
        LCD.FillRectangle(202,128,healthY,14);
    }
    else if ((x>99) && (x<=186)){
        LCD.WriteAt(“You chose PAPER, “,15,155);
        LCD.WriteAt(“Maddy chose ROCK, you won!”,15,175);
        healthM-=23;
        LCD.SetDrawColor(LCD.Black);
        LCD.FillRectangle(92,32,46,14);
        LCD.SetDrawColor(LCD.Green);
        LCD.FillRectangle(92,32,healthM,14);
    }
    else if (x>186){
        LCD.WriteAt(“You chose SCISSORS, “,15,155);
        LCD.WriteAt(“Maddy chose ROCK, you lost!”,15,175);
        healthY-=23;
        LCD.SetDrawColor(LCD.Black);
        LCD.FillRectangle(202,128,46,14);
        LCD.SetDrawColor(LCD.Green);
        LCD.FillRectangle(202,128,healthY,14);
    }
    else {
        LCD.SetFontColor(LCD.White);
        LCD.Write(“Round 1 messed up :/”);
    }
    //wait for touch
    while(!LCD.Touch(&x, &y)){}
    //round 3, only do if you or maddy havent lost all health yet
    //Back to coice selection
    if ((healthY > 0) && (healthM > 0)){
        LCD.SetDrawColor(LCD.White);
        LCD.FillRectangle(9,149,299,80);
        //add text options for rock paper scissors and baxes around them
        LCD.SetDrawColor(LCD.Black);
        LCD.DrawRectangle(29,185,60,25);
        LCD.DrawRectangle(109,185,65,25);
        LCD.DrawRectangle(198,185,90,25);
        LCD.SetFontColor(LCD.Black);
        LCD.WriteAt(“ROCK”,35,190);
        LCD.WriteAt(“PAPER”,116,190);
        LCD.WriteAt(“SCISSORS”,204,190);
        //waits for touch
        while(!LCD.Touch( &x, &y)){}
        //clear dialouge box
        LCD.SetDrawColor(LCD.White);
        LCD.FillRectangle(9,149,299,80);
        if (x<=99){
            LCD.WriteAt(“You chose ROCK, “,15,155);
            LCD.WriteAt(“Maddy chose PAPER, you lost!”,15,175);
            healthY-=23;
            LCD.SetDrawColor(LCD.Black);
            LCD.FillRectangle(202,128,46,14);
            LCD.SetDrawColor(LCD.Green);
            LCD.FillRectangle(202,128,healthY,14);
        }
        else if ((x>99) && (x<=186)){
            LCD.WriteAt(“You chose PAPER, “,15,155);
            LCD.WriteAt(“Maddy chose ROCK, you won!”,15,175);
            healthM-=23;
            LCD.SetDrawColor(LCD.Black);
            LCD.FillRectangle(92,32,46,14);
            LCD.SetDrawColor(LCD.Green);
            LCD.FillRectangle(92,32,healthM,14);
        }
        else if (x>186){
            LCD.WriteAt(“You chose SCISSORS, “,15,155);
            LCD.WriteAt(“Maddy chose ROCK, you lost!”,15,175);
            healthY-=23;
            LCD.SetDrawColor(LCD.Black);
            LCD.FillRectangle(202,128,46,14);
            LCD.SetDrawColor(LCD.Green);
            LCD.FillRectangle(202,128,healthY,14);
        }
        else { //for solving errors
            LCD.SetFontColor(LCD.White);
            LCD.Write(“Round 3 messed up :/”);
        }
    }
    else {}
    //increment win/loss counter depending on outcome of battle
    if (healthY > 0)
    {
        wins+=1;
    }
    else if (healthY <= 0)
    {
        losses+=1;
    }
    else
    {
        LCD.SetFontColor(LCD.White);
        LCD.Write(“wins losses messed up :/”);
    }
}
/*This function does not take any input arguments or output values,
but the wins/losses variable that it shares a class with will be
changed. The function contains the battle sequence for GTA TJ.
TJ has pre programmed moves; if the user picks the same move
as him, TJ will chose the move that loses to theirs making.
author: V Haupt */
void RockPokemonScissors::BattleTJ()
{
    //initlize variables
    int healthY=46, healthTJ=46, x, y; //take wins/loss initlization out once in class, needed her for initiliat testing
    //draw opponent and write thier name
    LCD.SetDrawColor(LCD.Blue);
    LCD.FillCircle(248,59,25);
    LCD.SetFontColor(LCD.White);
    LCD.WriteAt(“TJ”,25,30);
    //dialouge
    LCD.SetFontColor(LCD.Black);
    LCD.WriteAt(“GTA TJ wants to fight! “,15,155);
    //health bars
    LCD.SetDrawColor(LCD.Green);
    LCD.FillRectangle(92,32,46,14);
    LCD.FillRectangle(202,128,46,14);
    //add text options for rock paper scissors and bOxes around them
    LCD.SetDrawColor(LCD.Black);
    LCD.DrawRectangle(29,185,60,25);
    LCD.DrawRectangle(109,185,65,25);
    LCD.DrawRectangle(198,185,90,25);
    LCD.WriteAt(“ROCK”,35,190);
    LCD.WriteAt(“PAPER”,116,190);
    LCD.WriteAt(“SCISSORS”,204,190);
    //waits for touch
    while(!LCD.Touch( &x, &y)){}
    //clear dialouge box
    LCD.SetDrawColor(LCD.White);
    LCD.FillRectangle(9,149,299,80);
    //round 1 TJ will chose scissors unless player also chose scissors
    //in which case she will choose paper
    if (x<=99){
        LCD.WriteAt(“You chose ROCK, “,15,155);
        LCD.WriteAt(“TJ chose SCISSORS, you won!”,15,175);
        healthTJ-=23;
        LCD.SetDrawColor(LCD.Black);
        LCD.FillRectangle(92,32,46,14);
        LCD.SetDrawColor(LCD.Green);
        LCD.FillRectangle(92,32,healthTJ,14);
    }
    else if ((x>99) && (x<=186)){
        LCD.WriteAt(“You chose PAPER, “,15,155);
        LCD.WriteAt(“TJ chose SCISSORS, you lost!”,15,175);
        healthY-=23;
        LCD.SetDrawColor(LCD.Black);
        LCD.FillRectangle(202,128,46,14);
        LCD.SetDrawColor(LCD.Green);
        LCD.FillRectangle(202,128,healthY,14);
    }
    else if (x>186){
        LCD.WriteAt(“You chose SCISSORS, “,15,155);
        LCD.WriteAt(“TJ chose PAPER, you won!”,15,175);
        healthTJ-=23;
        LCD.SetDrawColor(LCD.Black);
        LCD.FillRectangle(92,32,46,14);
        LCD.SetDrawColor(LCD.Green);
        LCD.FillRectangle(92,32,healthTJ,14);
    }
    else {
        LCD.SetFontColor(LCD.White);
        LCD.Write(“Round 1 messed up :/”);
    }
    //wait for touch
    while(!LCD.Touch(&x, &y))    {}
    //round 2
    //Back to choice selection
    LCD.SetDrawColor(LCD.White);
    LCD.FillRectangle(9,149,299,80);
    //add text options for rock paper scissors and baxes around them
    LCD.SetDrawColor(LCD.Black);
    LCD.DrawRectangle(29,185,60,25);
    LCD.DrawRectangle(109,185,65,25);
    LCD.DrawRectangle(198,185,90,25);
    LCD.SetFontColor(LCD.Black);
    LCD.WriteAt(“ROCK”,35,190);
    LCD.WriteAt(“PAPER”,116,190);
    LCD.WriteAt(“SCISSORS”,204,190);
    //waits for touch
    while(!LCD.Touch( &x, &y)){}
    //clear dialouge box
    LCD.SetDrawColor(LCD.White);
    LCD.FillRectangle(9,149,299,80);
    if (x<=99){
        LCD.WriteAt(“You chose ROCK, “,15,155);
        LCD.WriteAt(“TJ chose SCISSORS, you won!”,15,175);
        healthTJ-=23;
        LCD.SetDrawColor(LCD.Black);
        LCD.FillRectangle(92,32,46,14);
        LCD.SetDrawColor(LCD.Green);
        LCD.FillRectangle(92,32,healthTJ,14);
    }
    else if ((x>99) && (x<=186)){
        LCD.WriteAt(“You chose PAPER, “,15,155);
        LCD.WriteAt(“TJ chose ROCK, you won!”,15,175);
        healthTJ-=23;
        LCD.SetDrawColor(LCD.Black);
        LCD.FillRectangle(92,32,46,14);
        LCD.SetDrawColor(LCD.Green);
        LCD.FillRectangle(92,32,healthTJ,14);
    }
    else if (x>186){
        LCD.WriteAt(“You chose SCISSORS, “,15,155);
        LCD.WriteAt(“TJ chose ROCK, you lost!”,15,175);
        healthY-=23;
        LCD.SetDrawColor(LCD.Black);
        LCD.FillRectangle(202,128,46,14);
        LCD.SetDrawColor(LCD.Green);
        LCD.FillRectangle(202,128,healthY,14);
    }
    else {
        LCD.SetFontColor(LCD.White);
        LCD.Write(“Round 2 messed up :/”);
    }
    //wait for touch
    while(!LCD.Touch(&x, &y)){}
    //round 3, only do if you or TJ havent lost all health yet
    if ((healthY > 0) && (healthTJ > 0))
    {
        //Back to coice selection
        LCD.SetDrawColor(LCD.White);
        LCD.FillRectangle(9,149,299,80);
        //add text options for rock paper scissors and boxes around them
        LCD.SetDrawColor(LCD.Black);
        LCD.DrawRectangle(29,185,60,25);
        LCD.DrawRectangle(109,185,65,25);
        LCD.DrawRectangle(198,185,90,25);
        LCD.SetFontColor(LCD.Black);
        LCD.WriteAt(“ROCK”,35,190);
        LCD.WriteAt(“PAPER”,116,190);
        LCD.WriteAt(“SCISSORS”,204,190);
        //waits for touch
        while(!LCD.Touch( &x, &y)){}
        //clear dialouge box
        LCD.SetDrawColor(LCD.White);
        LCD.FillRectangle(9,149,299,80);
        if (x<=99){
            LCD.WriteAt(“You chose ROCK, “,15,155);
            LCD.WriteAt(“TJ chose SCISSORS, you won!”,15,175);
            healthTJ-=23;
            LCD.SetDrawColor(LCD.Black);
            LCD.FillRectangle(92,32,46,14);
            LCD.SetDrawColor(LCD.Green);
            LCD.FillRectangle(92,32,healthTJ,14);
        }
        else if ((x>99) && (x<=186)){
            LCD.WriteAt(“You chose PAPER, “,15,155);
            LCD.WriteAt(“TJ chose ROCK, you won!”,15,175);
            healthTJ-=23;
            LCD.SetDrawColor(LCD.Black);
            LCD.FillRectangle(92,32,46,14);
            LCD.SetDrawColor(LCD.Green);
            LCD.FillRectangle(92,32,healthTJ,14);
        }
        else if (x>186){
            LCD.WriteAt(“You chose SCISSORS, “,15,155);
            LCD.WriteAt(“TJ chose ROCK, you lost!”,15,175);
            healthY-=23;
            LCD.SetDrawColor(LCD.Black);
            LCD.FillRectangle(202,128,46,14);
            LCD.SetDrawColor(LCD.Green);
            LCD.FillRectangle(202,128,healthY,14);
        }
        else {
            LCD.SetFontColor(LCD.White);
            LCD.Write(“Round 3 messed up :/”);
        }
    }
    else {}//function ends w/o 3rd round if you or tj has lost two rounds
    //increment win/loss counter depending on outcome of battle
    if (healthY > 0)
    {
        wins+=1;
    }
    else if (healthY <= 0)
    {
        losses+=1;
    }
    else
    {
        LCD.SetFontColor(LCD.White);
        LCD.Write(“wins losses messed up :/”);
    }
    FinalHealth = 100;
}
/*This function takes the input argument wins, but has no output value.
Depending on the number of wins the user was gained throughout the
course of the game, the difficulty of the final boss will change. The
more wins the easier it is to beat. There are 3 levels of difficulty.
Difficulty 0 the boss always wins, 1 there is a chance you or the boss
will win and the boss’s moves are generated randomly, 2 the user always
wins.
author: V Haupt */
void RockPokemonScissors::BattleC ()
{
    int healthY = 46, healthC= 46, x, y, k, choice, response, difficulty, ROCK = 1, PAPER = 2, SCISSORS = 3;
    //draw cat and write name
    LCD.SetDrawColor(LCD.White);
    LCD.FillCircle(248,59,25);
    LCD.SetFontColor(LCD.White);
    LCD.WriteAt(“Cat”,25,30);
    //health bars
    LCD.SetDrawColor(LCD.Green);
    LCD.FillRectangle(92,32,46,14);
    LCD.FillRectangle(202,128,46,14);
    //clear dialouge box
    LCD.SetDrawColor(LCD.White);
    LCD.FillRectangle(9,149,299,80);
    //determine difficulty based on number of battles the user won
    if (wins < 3) //The user will lose every time
    {
        //set difficulty = 0 so user always loses
        difficulty = 0;
    }
    else if (wins < 6) // 50% impossible, 50% regular
    {
        //randomly generate difficulty options based off win counter
        difficulty = rand() % 2; //generates difficulty 0 or 1
    }
    else if (wins < 10) // 50% regular, 50% always win
    {
        //randomly generate difficulty options based off win counter
        difficulty = rand() % 2 + 1; //generates difficulty 1 or 2
    }
    else // 100% win
    {
        //set difficulty to 2 so user always wins
        difficulty = 2;
    }
    if (difficulty == 0 ) //user always loses
    {
        //health bar for cat, which will not change throughout battle
        LCD.SetDrawColor(LCD.Green);
        LCD.FillRectangle(92,32,46,14);
        for ( k=0; k < 2; k++ ){
            //clears dialouge box
            LCD.SetDrawColor(LCD.White);
            LCD.FillRectangle(9,149,299,80);
            //dialouge
            LCD.SetFontColor(LCD.Black);
            LCD.WriteAt(“Dr Parke’s Cat wants to fight! “,15,155);
            //health bars
            LCD.SetDrawColor(LCD.Green);
            LCD.FillRectangle(202,128,healthY,14);
            //add text options for rock paper scissors and baxes around them
            LCD.SetDrawColor(LCD.Black);
            LCD.DrawRectangle(29,185,60,25);
            LCD.DrawRectangle(109,185,65,25);
            LCD.DrawRectangle(198,185,90,25);
            LCD.WriteAt(“ROCK”,35,190);
            LCD.WriteAt(“PAPER”,116,190);
            LCD.WriteAt(“SCISSORS”,204,190);
            //waits for touch
            while(!LCD.Touch( &x, &y)){}
            //clear dialouge box
            LCD.SetDrawColor(LCD.White);
            LCD.FillRectangle(9,149,299,80);
            if (x<=99){
                LCD.WriteAt(“You chose ROCK, “,15,155);
                LCD.WriteAt(“Cat chose PAPER, you lost!”,15,175);
            }
            else if ((x>99) && (x<=186)){
                LCD.WriteAt(“You chose PAPER, “,15,155);
                LCD.WriteAt(“Cat chose SCISSORS, you lost!”,15,175);
            }
            else if (x>186){
                LCD.WriteAt(“You chose SCISSORS, “,15,155);
                LCD.WriteAt(“CAT chose ROCK, you lost!”,15,175);
            }
            else {}
            while(!LCD.Touch(&x, &y))
            {}
            //decrement health bar
            healthY-=23;
            LCD.SetDrawColor(LCD.Black);
            LCD.FillRectangle(202,128,46,14);
        }//end of for loop
    }
    else if (difficulty == 1) //cat’s moves are random, possible for either cat or user to win
    {
        while ((healthY > 0) && (healthC > 0)) //continue until cat or user have no health left
        {
            //clear text box
            LCD.SetDrawColor(LCD.White);
            LCD.FillRectangle(9,149,299,80);
            //dialouge
            LCD.SetFontColor(LCD.Black);
            LCD.WriteAt(“Dr Parke’s Cat wants to fight! “,15,155);
            //health bars
            LCD.SetDrawColor(LCD.Green);
            LCD.FillRectangle(92,32,healthC,14);
            LCD.FillRectangle(202,128,healthY,14);
            //add text options for rock paper scissors and boxes around them
            LCD.SetDrawColor(LCD.Black);
            LCD.DrawRectangle(29,185,60,25);
            LCD.DrawRectangle(109,185,65,25);
            LCD.DrawRectangle(198,185,90,25);
            LCD.WriteAt(“ROCK”,35,190);
            LCD.WriteAt(“PAPER”,116,190);
            LCD.WriteAt(“SCISSORS”,204,190);
            while(!LCD.Touch(&x, &y)){} //wait for touch
            response = rand() %3 + 1; //random number 1-3 determines cat’s move
            //determine’s user’s choice
            if (x<=99){
                choice = ROCK;
            }
            else if ((x>99) && (x<=186)){
                choice = PAPER;
            }
            else if (x>186){
                choice = SCISSORS;
            }
            else {}
            //clear dialouge box
            LCD.SetDrawColor(LCD.White);
            LCD.FillRectangle(9,149,299,80);
            //determine outcome of battle based on user’s choice and randomly generated cat’s move
            if (choice == ROCK){
                LCD.WriteAt(“You chose ROCK, “,15,155);
                switch (response)
                {
                case 1:
                    LCD.WriteAt(“Cat chose ROCK, it’s a tie!”,15,175);
                    break;
                case 2:
                    LCD.WriteAt(“Cat chose PAPER, you lost!”,15,175);
                    healthY-=23;
                    break;
                case 3:
                    LCD.WriteAt(“Cat chose SCISSORS, you won!”,15,175);
                    healthC-=23;
                    break;
                default:
                    break;
                }
            }
            else if (choice == PAPER)
            {
                LCD.WriteAt(“You chose PAPER, “,15,155);
                switch (response)
                {
                case 1:
                    LCD.WriteAt(“Cat chose ROCK, you won!”,15,175);
                    healthC-=23;
                    break;
                case 2:
                    LCD.WriteAt(“Cat chose PAPER, it’s a tie!”,15,175);
                    break;
                case 3:
                    LCD.WriteAt(“Cat chose SCISSORS, you lost!”,15,175);
                    healthY-=23;
                    break;
                default:
                    break;
                }
            }
            else if (choice == SCISSORS)
            {
                LCD.WriteAt(“You chose SCISSORS, “,15,155);
                switch (response)
                {
                case 1:
                    LCD.WriteAt(“Cat chose ROCK, you lost!”,15,175);
                    healthY-=23;
                    break;
                case 2:
                    LCD.WriteAt(“Cat chose PAPER, you won!”,15,175);
                    healthC-=23;
                    break;
                case 3:
                    LCD.WriteAt(“Cat chose SCISSORS, it’s a tie!”,15,175);
                    break;
                default:
                    break;
                }
            }
            else
            {}
            //update health bars
            LCD.SetDrawColor(LCD.Black);
            LCD.FillRectangle(202,128,46,14);
            LCD.FillRectangle(92,32,46,14);
            LCD.SetDrawColor(LCD.Green);
            LCD.FillRectangle(202,128,healthY,14);
            LCD.FillRectangle(92,32,healthC,14);
            while(!LCD.Touch(&x, &y)){} //wait for touch
        } //end of while loop
    }
    else if (difficulty == 2) //user always wins
    {
        //health bar for user, which is unchanged throughout battle
        LCD.SetDrawColor(LCD.Green);
        LCD.FillRectangle(202,128,46,14);
        for ( k=0; k < 2; k++ ){
            //clear dialouge box
            LCD.SetDrawColor(LCD.White);
            LCD.FillRectangle(9,149,299,80);
            //dialouge
            LCD.SetFontColor(LCD.Black);
            LCD.WriteAt(“Dr Parke’s Cat wants to fight! “,15,155);
            //cat’s health bar
            LCD.SetDrawColor(LCD.Green);
            LCD.FillRectangle(92,32,healthC,14);
            //add text options for rock paper scissors and baxes around them
            LCD.SetDrawColor(LCD.Black);
            LCD.DrawRectangle(29,185,60,25);
            LCD.DrawRectangle(109,185,65,25);
            LCD.DrawRectangle(198,185,90,25);
            LCD.WriteAt(“ROCK”,35,190);
            LCD.WriteAt(“PAPER”,116,190);
            LCD.WriteAt(“SCISSORS”,204,190);
            while(!LCD.Touch( &x, &y)){} //wait for touch
            //clear dialouge box
            LCD.SetDrawColor(LCD.White);
            LCD.FillRectangle(9,149,299,80);
            if (x<=99){
                //player chose rock, cat will chose scissors
                LCD.WriteAt(“You chose ROCK, “,15,155);
                LCD.WriteAt(“Cat chose SCISSORS, you won!”,15,175);
            }
            else if ((x>99) && (x<=186)){
                LCD.WriteAt(“You chose PAPER, “,15,155);
                LCD.WriteAt(“Cat chose ROCK, you won!”,15,175);
            }
            else if (x>186){
                LCD.WriteAt(“You chose SCISSORS, “,15,155);
                LCD.WriteAt(“Cat chose PAPER, you won!”,15,175);
            }
            else {}
            while(!LCD.Touch(&x, &y)){} //wait for touch
            //decremen health bar
            healthC-=23;
            LCD.SetDrawColor(LCD.Black);
            LCD.FillRectangle(92,32,46,14);
        } //end of for loop
    }
    else
    {
        LCD.SetFontColor(LCD.White);
        LCD.Write(“battle selection messed up”);
    }
    FinalHealth = healthY;
}