Spicyninja09

Untitled

Apr 15th, 2018
164
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 11.18 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class StarWars {
  4. public static void main (String []args) {
  5.  
  6. String a,b,c,d;
  7. String choice;
  8. String help;
  9.  
  10. int count = 0;
  11.  
  12. int user;
  13. int [] aud=new int[4];
  14. int exit;
  15. int name;
  16. String ans;
  17. int Ll1,Ll2;
  18. int totalwage;
  19. int friend = 1;
  20. int audience = 1;
  21. int Raud;
  22. int fiftyfifty = 1;
  23. int Ffty1,Ffty2;
  24. String yesno;
  25. String Fyesno;
  26. String Ayesno;
  27. String in1,in2;
  28. String [] words=new String[4];
  29.  
  30.  
  31. //intializing my varibles
  32.  
  33. Scanner in = new Scanner (System.in);
  34.  
  35.  
  36.  
  37. int [] wageArray = {100, 200, 500, 1000, 2000, 5000, 10000, 20000, 50000, 100000,
  38. 200000, 500000, 1000000, 2000000, 5000000};
  39. //storing points for the given questions
  40. String [] quesArray = new String [16];
  41. quesArray [1] = "Who is small, green and uses a cane to move around? ";
  42. quesArray [2] = "When was the first star wars movie made?";
  43. quesArray [3] = "What was order 66? ";
  44. quesArray [4] = "Who is R2 – D2s best friend? ";
  45. quesArray [5] = "What planet did the rebel base originally hide on in Empire strikes back? ";
  46. quesArray [6] = " Which Army did the Rebellion struggle to fight in the movie The last Jedi?";
  47. quesArray [7] = " What is the force?";
  48. quesArray [8] = " How many times did the Reblion achieve in destroying the dark sides heavy weaponary?";
  49. quesArray [9] = "What is the reason for the fall of the Jedi order ";
  50. quesArray [10] = "What was the reason behind Luke Skywalker being in Exile? ";
  51. quesArray [11] = "Which company owns Star Wars? ";
  52. quesArray [12] = "Which major actor died in the making of star wars the Last Jedi? ";
  53. quesArray [13] = "Who was the bounty hunter that was hunted down Han solo, captured him and gave him to Jabba the hutt ? ";
  54. quesArray [14] = "Who is the creator of Star wars or Lucasfilms?";
  55. quesArray [15] = "In sequential order, how is the Star Wars movies supposed to be Showcased?(refers to only the first 6 movies) ";
  56.  
  57. String [] choArray = new String [59];
  58.  
  59. choArray[1] = " a. Yoda b. R2-D2 c. Papa Smurf d. The Grinch // ";
  60. choArray[2] =" a. 1977 b. 1983 c. 2005 d. 1999 ";
  61. choArray[3] =" a. New Beginning of Jedi order b. Jedi slaughter c. Ending of the War d. Ending the Jedi order // ";
  62. choArray[4] =" a. BB8 b. C3PO c. Han Solo d. Obi-Wan-Kenobi // ";
  63. choArray[5] =" a. Yavin 4 b. Corusaunt c. Hoth d. Dagobah //";
  64. choArray[6] =" a. The Galactic Empire b. The Clone Army c. The Droid Federation d. The First Order //";
  65. choArray[7] =" a. Energy that flows and balances light and dark b. Moving rocks and pushing people //";
  66. choArray[8] =" a. 4 b. 3 c. 6 d. 2 //";
  67. choArray[9] =" a. Democracy B. Betrayal //";
  68. choArray[10] =" a. Took blame for training a new era of Jedi b. took blame for not training the new era of Jedi\n"
  69. + " c. Running away from the war d. Getting old // ";
  70. choArray[11] =" a. Warner Bros b. Marvel c. Dc Comics d. Lucasfilm // ";
  71. choArray[12] =" a. Carrie Fisher b. Harrison Ford c. Mark Hamill d. Peter Mayhew //";
  72. choArray[13] =" a. Jango Fett b. Boba Fett c. Ig 88 d. Jabba The Hutt // ";
  73. choArray[14] =" a. J.R.R Tolkien d. George Lucas c. Goerge Lucas d. J.J Abrams // ";
  74. choArray[15] =" a. A new hope, Empire Strikes back, The Return of the Jedi, Phantom Menance, Attack of the clones\n"
  75. + "Revenge of the sith"
  76. + "b. New hope, Revenge of the sith, Attack of the clones, Phantom menace, Return of the Jedi, Empire strikes back\n "
  77. + "c. New hope, Revenge of the sith, Empire strikes back, Return of the Jedi, Phantom menace, Attack of the clones ";
  78.  
  79. String [] ansArray = new String [16];
  80.  
  81. ansArray[1] = "a";
  82. ansArray[2] = "a";
  83. ansArray[3] = "d";
  84. ansArray[4] = "b";
  85. ansArray[5] = "c";
  86. ansArray[6] = "d";
  87. ansArray[7] = "a";
  88. ansArray[8] = "a";
  89. ansArray[9] = "b";
  90. ansArray[10] = "a";
  91. ansArray[11] = "d";
  92. ansArray[12] = "a";
  93. ansArray[13] = "b";
  94. ansArray[14] = "b";
  95. ansArray[15] = "a" ;
  96. //storing the correct answers to the given questions
  97. String [] helpArray = new String [1];
  98. System.out.print("Rules are Ez, answer the question and win the game\n"
  99. + "All you need to do is answer the question and hope you win\n");
  100. System.out.print("==============================================================");
  101.  
  102. //using for loop so it repeats my code
  103.  
  104. /*for ( int i = 0; i < quesArray.length; i++){
  105. System.out.println("\n" +quesArray[i+1]);
  106. System.out.println(choArray[i+1]);
  107. choice = in.nextLine();
  108.  
  109. if (choice.equals (ansArray[i+1])){
  110. // as the user prints out the answer, the wage thats stored in the array will print out
  111. System.out.print(" ");
  112. System.out.print(wageArray[i+1]);
  113. } else {
  114. System.out.println("Game Over, plz try again next time");
  115. break;
  116. }
  117. }*/
  118.  
  119. /* while ( fiftyfifty == true && friend == true && audience == true){
  120. while (!help.equalsIgnoreCase ("50:50")) && (!help.equalsIgnoreCase ("Friend")) && (!help.equalsIgnoreCase ("Ask the Audience")) && (!help.equalsIgnoreCase ("2"))){
  121.  
  122. System.out.print("Try again");
  123. help = in.nextLine();
  124. }
  125. if (help.equals ("1. 50/50")){
  126. if (fiftyfifty == false){
  127. System.out.print("You have "+ (quesArray));
  128. fiftyfifty = true;
  129. System.out.print("Want another lifeline ? (If not type no to continue)");
  130. help=in.nextLine();
  131. }else {
  132. System.out.print("This lifeline has been used already, you can continue without help or use help");
  133. help = in.nextLine();
  134. }
  135. }else if (help ==("Friend")){
  136. if (friend == false){
  137. System.out.print("Friends name : ");
  138. name = in.nextInt();
  139. System.out.print(name + "thinks that this is the right answer");
  140. friend = true;
  141. System.out.print("another lifeline or would you like to continue? ( type no to proceed)");
  142. help = in.nextLine();
  143. }
  144. }else if (help ==("Audience helps")){
  145. int audArray;
  146. if (audience == false ){
  147. System.out.print("They believe that is is " + audArray + " . ");
  148. help = in.nextLine();
  149. System.out.print("this one has been used already, please pick another one or continue the game ( type yes\n"
  150. + "to procced ");
  151. help = in.nextLine();
  152. }else if (help.equals("2")){
  153. break;
  154. }
  155. }
  156. */
  157. while (true){
  158. in1 = in.nextLine();
  159. if (in1.equalsIgnoreCase ("a") || in1.equalsIgnoreCase( "b") || in1.equalsIgnoreCase ("c") || in1.equalsIgnoreCase ("d")) {//if they want a,b,c, or d
  160. if (in1.equalsIgnoreCase(ans)){//if the answer is correct
  161.  
  162. System.out.println ("Correct!");
  163. }else {//the 3 wrong options
  164.  
  165. System.out.println ("Incorrect");
  166. }
  167. break;
  168. } else if (in1.equals("1")) {//this lifeline has 80% chance of being correct, if it picks a wrong one it is incorrect
  169. if (Ll1==1){//
  170. Ll2 = (int)(Math.random() * 5) +1;
  171. System.out.println ("Guest:");
  172. if (Ll2 >=2) {
  173. System.out.println ("I think the answer is "+ans);
  174. }else {
  175. if (ans.equals("A")){
  176. Ll2 = (int)(Math.random() * 3) +1;
  177. if (Ll2==1){
  178. System.out.println ("answer is b");
  179. }else if (Ll2==2){
  180. System.out.println ("It's c");
  181. }else if (Ll2==3){
  182. System.out.println ("It'sd");
  183. }
  184. } else if (ans.equals("b")){
  185. Ll2 = (int)(Math.random() * 3) +1;
  186. System.out.print("It's a");
  187. }
  188. } else if (ans.equals("c")){
  189. Ll2 = (int)(Math.random() * 3) +1;
  190. if (Ll2==1){
  191. }
  192. }
  193.  
  194. } else if (ans.equals("D")){
  195. Ll2 = (int)(Math.random() * 3) +1;
  196. if (Ll2==1){
  197. System.out.println ("I think the answer is A");
  198. }else if (Ll2==2){
  199. System.out.println ("I think the answer is B");
  200. }else if (Ll2==3){
  201. System.out.println ("I think the answer is C");
  202. }
  203. }
  204. }
  205. Ll1=0;
  206.  
  207. System.out.println ("You have already used this lifeline");
  208.  
  209.  
  210. if (in1.equals("2")) {//This lifeline outputs 2 final options, the correct one and one incorrect answer
  211. if (fiftyfifty==1) {
  212. if (ans.equalsIgnoreCase("A")){
  213. Ffty2=0;
  214. Ffty1 = (int)(Math.random() * 3) +1;
  215. } else if (ans.equalsIgnoreCase("B")){
  216. Ffty2=1;
  217. Ffty1 = (int)(Math.random() * 4);
  218. if (Ffty1==Ffty2){
  219. while (Ffty1==Ffty2){
  220. Ffty1 = (int)(Math.random() * 4);
  221. }
  222. }
  223. } else if (ans.equalsIgnoreCase("C")){
  224. Ffty2=2;
  225. Ffty1 = (int)(Math.random() * 4);
  226. if (Ffty1==Ffty2){
  227. while (Ffty1==Ffty2){
  228. Ffty1 = (int)(Math.random() * 4);
  229. }
  230. }
  231. } else if (ans.equalsIgnoreCase("D")){
  232. Ffty2=3;
  233. Ffty1 = (int)(Math.random() * 3);
  234. }
  235. if (Ffty2>Ffty1){
  236. System.out.println(quesArray);
  237. System.out.println(words[Ffty1]);
  238. System.out.println(words[Ffty2]);
  239. } else if (Ffty1>Ffty2){
  240. System.out.println(quesArray);
  241. System.out.println(words[Ffty2]);
  242. System.out.println(words[Ffty1]);
  243. }
  244. fiftyfifty=0;
  245. }else {
  246. System.out.println("You have already used this lifeline");
  247. }
  248. } else if (in1.equals("3")){//this lifeline is completely random and has no positive effect on the user's choices
  249. if (audience==1){
  250. while (aud[0]+aud[1]+aud[2]+aud[3]<100){
  251. Raud = (int)(Math.random() * 4);
  252. aud[Raud]+=1;
  253. }
  254. for (int i=0;i<=3;i+=1){
  255. System.out.print(aud[i] +"% of the audience voted for ");
  256. if (i==0){
  257. System.out.println ("A");
  258. }else if (i==1){
  259. System.out.println ("B");
  260. }else if (i==2){
  261. System.out.println ("C");
  262. }else if (i==3){
  263. System.out.println ("D");
  264. }
  265. audience=0;
  266. }
  267. } else {
  268. System.out.println("You have already used this lifeline");
  269. }
  270. }else{ //if the user inputs anything other than a,b,c,d,1,2,or 3
  271. System.out.println ("Invalid");
  272. }
  273. break;
  274. while (true) {
  275. in2=in.nextLine();
  276. if (in1.equalsIgnoreCase("yes")){
  277. break;
  278. }else if (in1.equalsIgnoreCase("no")){
  279. break;
  280. }else{
  281. System.out.println("Invalid");
  282. }
  283. }
  284. }
  285. }
  286. }
Advertisement
Add Comment
Please, Sign In to add comment