Skip to content

Instantly share code, notes, and snippets.

@stevehenderson
Created August 15, 2014 00:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save stevehenderson/31b2c77310fe1521ec17 to your computer and use it in GitHub Desktop.
Save stevehenderson/31b2c77310fe1521ec17 to your computer and use it in GitHub Desktop.
import st.Prompt;
public class Lift
{
public static void printShaft(String [] a){
for (int i=0; i < 10; i++){
System.out.println(a[i]+(10 - i));
}
System.out.println();
}
public static void doStuffInMyRoom(int rand){
String todo3=Prompt.getString ("What Would you like to do?\nA Go to My Room\nB Ride the Elevator");
if (todo3.equals("A")){
Prompt.getString ("You Are Standing in Front of Your Room Now (" + rand + "). Type to Insert Your Room Key");
String inroom3 = Prompt.getString ("You are inside your room.\nYou have a bed, a TV, a clock radio, a bottle of water and welcome cookie, and hotel stationary.\nOutside you have an amazing view.");
if (inroom3.equals("Eat Cookie")||inroom3.equals("Eat My Cookie")){
Prompt.getString ("You Eat Your Cookie. It tastes amazing! What an awesome welcome!");
}
if (inroom3.equals("Watch TV")){
Prompt.getString ("You turn on the TV. You watch Spongebob. There are only twenty channels but they all look pretty intresting.\nYou waste some time watching good shows.");
}
if (inroom3.equals("Sleep")){
Prompt.getString ("You crawl into the covers. The bed is incredibly comfortable and the sheets and blankets are soft and warm. You fall asleep and take a nap.");
}
}
}
public static void sayHelloToLinda(int rand){
String hellolinda1=Prompt.getString("Receptioist (Linda): Yes? Can I help you?");
if (hellolinda1.equals("I Need Tokens For The Arcade")){
Prompt.getString("Receptionist/Linda: Sure Thing! I'll add it to your hotel bill to pay when you leave.");
}
if (hellolinda1.equals("Let's Dance Linda!")){
Prompt.getString("Receptionist/Linda: (Sways a Little) Okay, I don't see what good it will do me. Oh, I'm at work!\n Maybe I'll meet you on the dance floor later and we can dance there.");
}
if (hellolinda1.equals("Your Hair Looks Beautiful!")){
Prompt.getString ("(Blushes) Oh! Thank you!");
}
if (hellolinda1.equals("Where Can I get Something to Eat?")){
Prompt.getString("I know the cafe has a lot of great things, along with an amazing view. I'd check there.\nIn town there's a great chinese place called 'The Great Wall'. That's one of my favorites!");
}
if (hellolinda1.equals("No.")){
Prompt.getString("Oh. If you need anything you know where I am!");
}
if (hellolinda1.equals("You Don't Suppose Have Six Fingers On Your Left Hand Do You?")){
Prompt.getString("Do You Always Start Conversations This Way (winks)");
}
if (hellolinda1.equals("Can I have Another Welcome Cookie?")){
Prompt.getString("Linda: Why, sure! (Hands Cookie) They're complementary! I helped bake today's batch, by the way. I'm glad you liked it! Tell me if you'd like another one, or another" + rand + ("!"));
}
}
public static void playGuessingGame(int rand){
int random = (int)(Math.random()*100+1);
System.out.println("Welcome to Guessing Game!\n");
System.out.print("I'm thinking of a number from one to one hundred! I bet you can't guess it!\n");
double number1= Prompt.getDouble ("What is Your Guess?");
int counter = 0;
while (number1 != rand){
counter ++;
if (number1 > rand){
System.out.println("Too High!\n");
}
else {
System.out.println("Too Low!\n");
}
number1= Prompt.getDouble ("Guess Again!");
if (counter == 10){
System.out.println("You ran out of guesses! You lose :(");
return;
}
}
System.out.println("Congrats! You guessed the number! You win! :D");
}
public static void main(String[] args) throws InterruptedException
{
// TODO Auto-generated method stub
String [] lift = new String [10];
for (int i=0; i < 10; i++){
lift [i]="[ ]";
}
int currentlocation= 9;
lift [currentlocation]="[*]";
printShaft (lift);
int random = (int)(Math.random()*100+1);
String name =Prompt.getString("Receptionist: Welcome to the SummerTech Hotel! I'm Linda, your hotel receptionist!\nWhat name did you place your reservaton under?");
Prompt.getString(name + "........Ah ha! Yes, your room is number " + random + ".\n The Elevator is to your left. If you have problems you can visit the main desk. Enjoy your stay!");
boolean elevator = true;
while (elevator){
int floor= Prompt.getInt("What floor would you like to go to?\n1 Lobby\n2 Rooms (1-25)\n3 Rooms (26-50)\n4 Rooms (51-75)\n5 Rooms (76-100)\n6 Indoor Pool and Fitness\n7 Gaming, arcade and Dance\n8 Meeting and Buisness\n9 Spa and Sauna\n10 Sky lounge, Cafe, and Botanical Gardens");
//10 - i -> Floor Number based on the index of the Array
int index = 10 - floor;
if (index > currentlocation){
for (;currentlocation<index;currentlocation++){
lift[currentlocation]= "[*]";
printShaft(lift);
lift[currentlocation]="[ ]";
Thread.sleep(1000);
}
lift[currentlocation]= "[*]";
printShaft(lift);
}
else {
for (;currentlocation>index;currentlocation--){
lift[currentlocation]= "[*]";
printShaft(lift);
lift[currentlocation]="[ ]";
Thread.sleep(1000);
}
lift[currentlocation]= "[*]";
printShaft(lift);
}
if (floor==1&&currentlocation==9){
System.out.println("This is the First Floor- Lobby");
String lobby1=Prompt.getString("What would you like to Do?\nA Use the Elevator\nB Visit Front Desk\nC Exit Hotel (Leave Game)");
if (lobby1=="B"){
sayHelloToLinda(random);
}
}
if (floor==2&&currentlocation==8){
System.out.println("This is the Second Floor- Hotel Rooms Floor A (1-25)");
if (random > 25){
System.out.println("But this is not your floor. Your room numer is " + random);
}
else{
System.out.println("Your room is on this floor! (" + random + ")");
doStuffInMyRoom(random);
String exitroom3 = Prompt.getString ("Type 'Exit' to leave when you're ready");
if (exitroom3.equals("Exit")||(exitroom3.equals("exit"))){
continue;
}
}
}
if (floor==3&&currentlocation==7){
System.out.println("This is the Third Floor- Hotel Rooms Floor B (26-50)");
if (random < 26|| random > 50){
System.out.println("But this is not your floor. Your room numer is " + random);
}
else{
System.out.println("Your room is on this floor! (" + random + ")");
doStuffInMyRoom(random);
String exitroom3 = Prompt.getString ("Type 'Exit' to leave when you're ready");
if (exitroom3.equals("Exit")||(exitroom3.equals("exit"))){
continue;
}
}
}
if (floor==4&&currentlocation==6){
System.out.println("This is the Fourth Floor- Hotel Rooms Floor C (51-75)");
if (random < 51|| random >75){
System.out.println("But this is not your floor. Your room numer is " + random);
}
else{
System.out.println("Your room is on this floor! (" + random + ")");
doStuffInMyRoom(random);
String exitroom3 = Prompt.getString ("Type 'Exit' to leave when you're ready");
if (exitroom3.equals("Exit")||(exitroom3.equals("exit"))){
continue;
}
}
}
if (floor==5&&currentlocation==5){
System.out.println("This is the Fifth floor- Hotel Rooms Floor D (76-100)");
if (random < 76|| random >100){
System.out.println("But this is not your floor. Your room numer is " + random);
}
else{
System.out.println("Your room is on this floor! (" + random + ")");
doStuffInMyRoom(random);
String exitroom3 = Prompt.getString ("Type 'Exit' to leave when you're ready");
if (exitroom3.equals("Exit")||(exitroom3.equals("exit"))){
continue;
}
}
}
if (floor==6&&currentlocation==4){
System.out.println("This is the Sixth Floor- Indoor Pool and Fitness Floor");
String todo6=Prompt.getString ("What Would You Like to do?\nASwim in the Pool\nB Go to Work Out in the Fitness Room\nC Ride the Elevator");
if (todo6.equals("A")){
String pool1=Prompt.getString ("You enter the pool area\n You buy a swimsuit at the swim store and put it on\nYou go into the pool and swim\n The water is not cold. It's perfect. You have the whole thing to yourself. Type 'Exit' to leave when you're done swimming.");
if (pool1.equals("Exit")){
continue;
}
}
if (todo6.equals("B")){
Prompt.getString ("You enter the fitness room.\nThere are Tredmills here. Set Your speed here:");
String fitness2=Prompt.getString ("Great! Now you're running! Doesn't it feel good? It's nice to get some excersise!\nType 'Exit' when you're ready to go back to the elevator.");
if (fitness2.equals("Exit")){
continue;
}
}
if (todo6.equals("C")){
continue;
}
}
if (floor==7&&currentlocation==3){
System.out.println("This is the Seventh Floor- Arcade,Gaming and Dance Floor");
String todo7=Prompt.getString ("What Would You Like to do?\nA Play Some Games!\nB Dance!\nC Ride the Elevator.");
if (todo7.equals("A")){
String game1=Prompt.getString("You Walk Into the Arcade. There's soft electronic playing in the backround.\nThere are Arcade Games and Computer Games,\nbut since you don't have tokens from the front desk, you can only play the guessing game. Would You Like to Play?");
if (game1.equals("Yes")){
playGuessingGame(random);
String game2=Prompt.getString("Type 'Exit' to leave the arcade");
if (game2.equals("Exit")){
continue;
}
}
}
if (floor==8&&currentlocation==2){
System.out.println("This is the Eighth Floor- Meeting and Buisness Floor");
}
if (floor==9&&currentlocation==1){
System.out.println("This is the Nineth Floor- Spa and Sauna Floor");
Prompt.getString("Spa Lady: Hello. Welcome to Lotus Spa. I'm Tanni. Do you Have your Room Key? (Type to Hand Room Key)");
String spa1 =Prompt.getString("Tanni: A Yes!" + name + ", room" + random + ".\nWould You be intrested in a free complete complementary treatment today?");
if (spa1.equals("Yes")){
Prompt.getString("You Start with a foot bath, followed by a massage and facial. It feels so relaxing. Ah......");
}
else{
Prompt.getString("Okay, Come Back when You're Ready for a Relaxing Time!");
}
String quitfromspa1=Prompt.getString("Type 'Exit' to leave the Spa");
if (quitfromspa1.equals("Exit")){
continue;
}
}
}
if (floor==10&&currentlocation==0){
System.out.println("This is the Tenth Floor- Sky Lounge, Cafe and Botanical Gardens Floor");
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment