clc
clear
%initialize checkpoint variables
n = 0;
m = 0;
%introduce player to game
fprintf(‘Welcome to Buckeye Trail!\n’)
%player enters name
player=input(‘Please enter your name ‘,’s’);
%task 1: go to class?
%insert goal objective
fprintf(‘%s, you are a new student at Ohio State and have the chance to win a contest for submitting \n a selfie with Brutus. The problem is, you have still have your normal school day activities to go through. \n Make decisions on how you will spend your day. Choose correctly and you will find Brutus and can take a photo for the contest. \n Good luck! \n’,player)
fprintf(‘Your alarm rings for your 8 am. ‘)
input_class=input(‘Do you choose go to class? If yes enter (0), if no enter (1)\n’);
if input_class==0
%player chooses to go to class
%displays class visual
class_image = imread(‘Hitchcock_Hall.jpg’);
imshow(class_image);
%task 2: where should player go study?
input_library=input(‘Good choice. Your proffessor presents a slide showing that \n Brutus is taking pictures at some of the libraries today to celebrate 150 years since OSU was founded. \n Which library do you go to? Enter (0) for 18th Ave Library or (1) for Thompson Library \n’);
if input_library==1
%player chooses to study at Thompson Library
%displays Thompson Library visual
Thompson_Library_image = imread(‘Thompson_Library.png’);
imshow(Thompson_Library_image);
%task 3: where should the user go to eat?
input_lunch=input(‘You picked the correct library but just missed Brutus! You decide to study while you are there. While studying, you check your phone. \n You see your friend is eating lunch and took a picture of Brutus. \n You want to go meet them and see if Brutus is still there. \n Do you think they are at Scott or the Union?\n Enter (0) for Union or (1) for Scott. \n’);
if input_lunch == 0
%Player chooses to go to Union Market
%displays Union Market Visual
Union_Market_Image = imread(‘Union_Market.jpg’);
imshow(Union_Market_Image);
%task 4: where should the user sit at the football game?
input_game = input(‘You were right! You see your friend and run over to them. \n You ask them where Brutus is and they say you just missed him \n but they tell you he will be at the football game tonight in a student section. \n You decide to go to the game but you are unsure where to sit.\nDo you think Brutus is in Block O North or Block O South? \n Enter (0) for Block O North or (1) for Block O South.\n’);
%BEGINNING OF CHECKPOINT
while (n==0) || (m==1) %while one of the set variables is true (n is the only true initialized value)
if input_game ==1
%user chooses to go sit in Block O South
%shows visual for Block O South
Block_O_South_image = imread(‘Block_O_South.jpeg’);
imshow(Block_O_South_image);
fprintf(“Congratulations! You have reached a checkpoint in the game. Now, if you make any wrong decisions, you will automatically start back here.\n.\n.\n”)
fprintf (‘You make it to Block O South and look around for Brutus. \n You keep looking and looking till you finally look behind you and find Brutus \n crowd surfing twenty rows behind you.\n After a long day, you are too tired to go up to Brutus.\n’)
%task 5: should the user take a nap?
fprintf(‘That was a great game! It has been a long day. Do you want to go take a nap?\n’)
nap = input(‘Take a nap? Enter (0) for yes or (1) for no \n’);
if nap == 0
%Player chooses to take a nap
%Displays dorm visual
dorm = imread(‘nap.jpg’);
imshow(dorm);
%task 6: asks user how long the user wants to sleep
time = input(‘How many hours would you like to take a nap?\n’);
fprintf(‘Set alarm for %d hours’, time)
%sets alarm clock
t = 0;
while t <= time + 1
fprintf(‘.\n’)
t = t+1;
end
fprintf(‘BEEP BEEP BEEP\n’)
%task 7: where does the user want to go work out?
input_workout=input(‘That was a good nap! You wake up and see a picture of Brutus working out on instagram.\n Which gym do you want to look for him at? Enter (0) for the North Rec or (1) for the RPAC \n’);
if input_workout==0
%Player chooses to go to the North Rec
fprintf(‘Brutus is at the RPAC. You are now too far to catch him.\nReturn to the checkpoint.\n.\n.\n’);
%displays North Rec visual
n = 1;%stays in the loop
m = 1;
elseif input_workout==1
%player chooses to go to the RPAC
RPAC_image = imread(‘RPAC.jpg’);
imshow(RPAC_image);
doginput=input(“You get to the RPAC and a staff member tells you that Brutus was there but just left. \n You decide to stay for a workout class while you are there. \n After your intense Power Yoga class at the RPAC, you decide to take a scenic walk through the oval.\nAcross the path, you see a dog. Do you stop to pet the dog, yes(0), or no(1)?\n”);
%task 7: should the user pet the dog?
if doginput == 0
%task 8: you’re late, take a bus, scooter, or walk?
Walk_image = imread(‘Dog.jpg’);
imshow(Walk_image);
fprintf(“Good choice.\n”)
transpinput = input(“After you’re done giving the dog love, you decide to head home.\nYou walk through the oval and you’re right by the bus stop. Across the street, you also see a Lime scooter.\nDo you decide to take the bus(0), ride the scooter(1), or keep walking home(2)?\n”);
if transpinput == 0
%player chooses to take the bus
Take_the_bus = imread(‘Bus.jpg’);
imshow(Take_the_bus);
[y, Fs] = audioread(‘Hang-on-Sloopy.mp3’);
player = audioplayer(y, Fs);
play(player);
fprintf(“You wait for the bus. As the doors open, you see that the bus driver is none other than Brutus Buckeye.\nCongratulations! You take your selfie and win the contest!!\n”)
pause(10)
n = 1;%kicks out of the loop for the end of the story
m = 0;
elseif transpinput == 1
%player chooses to ride the lime scooter
fprintf(“You board the Lime and begin riding until you realize you only have $2 in your bank account and now you have to walk the rest of the way home. You were unsuccessful in finding Brutus.\nReturn to the checkpoint.\n.\n.\n”)
n = 1;%stays in the loop and restarts the checkpoint
m = 1;
elseif transpinput == 2
%player chooses to walk back
fprintf(“You have a long walk home. You were unsuccessful in finding Brutus.\nReturn to the checkpoint.\n.\n.\n”)
n = 1;%stays in the loop and restarts the checkpoint
m = 1;
else
fprintf(“Invalid input.”)
end
elseif doginput == 1
%player chooses to not pet the dog
fprintf(“Wrong choice. Instead of being distracted by your love, the dog finds a squirrel and manages to get its leash wrapped around your legs.\nYou fall and are seriously injured. You are taken to the Wexner Medical Center.\nReturn to the checkpoint.\n.\n.\n”)
n = 1;%stays in the loop and restarts the checkpoint
m = 1;
else
fprintf(“Invalid input.”)
end
else
fprintf(‘Invalid input \n’)
end
elseif nap==1
%player chooses to not take a nap
fprintf(“You don’t take a nap but look for Brutus for a while without any hints.\n You get tired and decide to give up on the contest.\nReturn to the checkpoint.\n.\n.\n”);
n = 1;%stays in the loop and restarts the checkpoint
m = 1;
else
fprintf(‘Invalid input \n’)
end
elseif input_game == 0
%Player chooses to sit in Block O North
fprintf ( ‘ You go to Block O North and see Brutus on the big screen crowd surfing across the field.\nReturn to the checkpoint.\n.\n.\n’)
n = 1;%stays in the loop and restarts the checkpoint
m = 1;
else
%Displays invalid input
fprintf (‘Invalid Input \n’)
end
end
elseif input_lunch == 1
%player chooses to go to Traditions at Scott
fprintf(‘ You go to Scott and look all around and cannot find your friend or Brutus. \n’)
else
%displays invalid input
fprintf (‘Invalid Input \n’)
end
elseif input_library==0
%player chooses to go to 18th Avenue Library
restart=input(‘Brutus was not at 18th Ave. You missed your opportunity to take your selfie for the contest. \n’);
else
%displays invalid input
fprintf(‘Invalid input \n’);
end
elseif input_class==1
%player chooses to not go to class
fprintf(‘Wrong choice 🙁 You missed information about where Brutus will be! \n’);
else
fprintf(‘Invalid input \n’);
end
fprintf(‘To start again run the code again \n’)