Advertisement
Guest User

Untitled

a guest
Jun 23rd, 2017
51
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.07 KB | None | 0 0
  1. package mathgame;
  2. /*
  3. * To change this template, choose Tools | Templates
  4. * and open the template in the editor.
  5. */
  6.  
  7. import java.util.Scanner;
  8. /**
  9. * HERRO!!!
  10. * @author jared.dubose
  11. */
  12. public class Main1 {
  13.  
  14. /**
  15. * @param args the command line arguments
  16. */
  17. public static void main(String[] args) throws InterruptedException {
  18. Scanner input = new Scanner(System.in);
  19. System.out.print("Name: ");
  20. String playerName = input.nextLine();
  21. String[] profanity = {"penis","fuck","bitch","dick","ass","whore","cunt","slut","tak","lance"," " };
  22. for ( String curse : profanity ) {
  23. if (playerName.contains(curse)) {
  24. System.out.println("invalid symbols/words(no spaces please)");
  25. System.exit(0);
  26. }
  27. }
  28. System.out.print("Welcome, "+playerName+"! \r");
  29. Thread.sleep(2 * 1000); //sleep 4 seconds
  30. System.out.print("You are an awesome explorer, and you just found a \r");
  31. Thread.sleep(2 * 1000); //sleep 4 seconds
  32. System.out.print("hidden cave in the mountains of Narnia \r"); //maintain equal spacing or it will come out odd. each line overwrites the previous.
  33. Thread.sleep(2 * 1000); //sleep 4 seconds
  34. System.out.print("While walking through the cave an evil ogre jumps around the corner,\r");
  35. Thread.sleep(2 * 1000); //sleep 4 seconds
  36. System.out.print("to live you must solve 2 + 1 \r");
  37. Thread.sleep(2 * 1000); //sleep 4 seconds
  38. System.out.print("your answer is: ");
  39. int live1 = input.nextInt();
  40. if (live1 == 3){
  41. System.out.println("good job! You survived! Your answer was " + live1);
  42.  
  43. } else {
  44. System.out.println("Sorry you're dead");
  45. Thread.sleep(3 * 1000);
  46. System.exit(0);
  47. }
  48. System.out.println("Congratulations You've won :)");
  49. }
  50.  
  51. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement