Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.awt.*;
- import hsa_ufa.Console;
- public class DavisChypyhaICS3UFinalProject {
- static Console c; // The output console
- static int stage = 0;
- static String [] levels =
- {"1. $ 100",
- "2. $ 200",
- "3. $ 300",
- "4. $ 500",
- "5. $ 1 000",
- "6. $ 2 000",
- "7. $ 4 000",
- "8. $ 8 000",
- "9. $ 16 000",
- "10. $ 32 000",
- "11. $ 64 000",
- "12. $ 125 000",
- "13. $ 250 000",
- "14. $ 500 000",
- "15. $ 1 000 000"
- };
- static String[] choices = new String[4];
- static String rtAns[][]={{
- "25",
- "Wayne Gretzky",
- "1917",
- "3",
- "QMJHL, OHL and WHL",
- "Jonathon Toews",
- "Evgeni Nabokov",
- "2003-04",
- "215",
- "4",
- "Carolina Hurricanes",
- "Mike Green",
- "McJesus",
- "Colorado Avalanche",
- "Tiger Williams"},{
- "New York Knicks",
- "Wilt Chamberlain",
- "Stephen Curry",
- "Jumpshot",
- "Chris Ford",
- "LeBron James",
- "Los Angelos Lakers",
- "Meadowlark Lemon",
- "'Pistol' Pete Maravich",
- "Britney Griner",
- "0",
- "Shaquil O'Neil",
- "Earvin 'Magic' Johnson",
- "Los Angelos Lakers",
- "Michael Jordan"},{
- "Jack Nicklaus and Arnold Palmer",
- "0",
- "The Honor",
- "Leslie Nielsen",
- "The Masters",
- "Jack Nicklaus",
- "The Masters",
- "Tom Watson",
- "Chi Chi Rodriguez",
- "Arnold Palmer",
- "Jack Nicklaus",
- "Jack Nicklaus",
- "The Masters",
- "Annika Sorenstam",
- "Nick Price"}};
- static String wgAns1[][]= {{
- "22",
- "Gordie Howe",
- "1923",
- "8",
- "OHl, GTHL, AHL",
- "Ari Davis",
- "Aviel Moran",
- "2008-09",
- "200",
- "6",
- "Winnipeg Jets",
- "Chase Chyphya",
- "Sid the kid",
- "New York Islanders",
- "Zack Mindel"},{
- "Toronto Raptors",
- "Kyle Lowry",
- "Draymond Green",
- "Hookshot",
- "Larry Bird",
- "Danny Green",
- "Golden State Warriors",
- "Vince Carter",
- "Mike Russel",
- "Larry Tanenbaum",
- "3",
- "Mo Bomba",
- "Kobe Bryant",
- "San Antonio Spurs",
- "Scottie Pippen",
- "Tiger Woods and Phil Mickelson"},{
- "15",
- "The Tribute",
- "Liam Nieson",
- "The Open",
- "Arnold Palmer",
- "The Open",
- "Emma Watson",
- "Aaron Rodriguez",
- "Jackie Chan",
- "Chance the Rapper",
- "Big Sean",
- "The Championship",
- "Anika Boron",
- "Jack Price"}};
- static String wgAns2[][]= {{
- "20",
- "Bobby Hull",
- "1904",
- "2",
- "QMJHL, CHL, WHL",
- "Patrick Kane",
- "Bryan Little",
- "1999-2000",
- "196",
- "7",
- "Tampa Bay Lightning",
- "Josh Green",
- "Ovechkin",
- "Atlanta Thrashers",
- "Nail Yakopov"},{
- "Milwaukie Bucks",
- "Meta World Peace",
- "Dwayne Wade",
- "Granny Shot",
- "Doug Ford",
- "Lonzo Ball",
- "Ans2",
- "Ans2",
- "Ans2",
- "Ans2",
- "Ans2",
- "Ans2",
- "Ans2",
- "Ans2",
- "Ans2"},{
- "Ans2",
- "Ans2",
- "Ans2",
- "Ans2",
- "Ans2",
- "Ans2",
- "Ans2",
- "Ans2",
- "Ans2",
- "Ans2",
- "Ans2",
- "Ans2",
- "Ans2",
- "Ans2",
- "Ans2"}};
- static String wgAns3[][] = {{
- "Ans3",
- "Ans3",
- "Ans3",
- "Ans3",
- "Ans3",
- "Ans3",
- "Ans3",
- "Ans3",
- "Ans3",
- "Ans3",
- "Ans3",
- "Ans3",
- "Ans3",
- "Ans3",
- "Ans3"},{
- "Ans3",
- "Ans3",
- "Ans3",
- "Ans3",
- "Ans3",
- "Ans3",
- "Ans3",
- "Ans3",
- "Ans3",
- "Ans3",
- "Ans3",
- "Ans3",
- "Ans3",
- "Ans3",
- "Ans3"},{
- "Ans3",
- "Ans3",
- "Ans3",
- "Ans3",
- "Ans3",
- "Ans3",
- "Ans3",
- "Ans3",
- "Ans3",
- "Ans3",
- "Ans3",
- "Ans3",
- "Ans3",
- "Ans3",
- "Ans3"}};
- static int tempN[] = new int[4];
- public static int category () {
- int choice1 = c.readInt();
- c.setCursor(11, 10);
- return (c.readInt() - 1);
- }
- public static void lvl (){
- for (int i=0; i<15; i++) {
- int x = 713;
- if (i >= 9) {
- x = 702;
- }
- if(i==stage)c.setColor(Color.green);
- else c.setColor(new Color(210,102,4));
- c.drawString (levels [i], x, 403-i*25);
- }
- }
- public static String[] randomizeChoices (int ct, int qst){
- String[] tempC = new String[4];
- tempN = new int[4];
- tempN[0] = (int)(Math.random()*4);
- tempN[1] = (int)(Math.random()*4);
- while(tempN[1]==tempN[0])tempN[1] = (int)(Math.random()*4);;
- tempN[2] = (int)(Math.random()*4);
- while(tempN[2]==tempN[0]||tempN[2]==tempN[1])tempN[2] = (int)(Math.random()*4);;
- tempN[3] = (int)(Math.random()*4);
- while(tempN[3]==tempN[0]||tempN[3]==tempN[1]||tempN[3]==tempN[2])tempN[3] = (int)(Math.random()*4);;
- tempC[tempN[0]]=rtAns[ct][qst];
- tempC[tempN[1]]=wgAns1[ct][qst];
- tempC[tempN[2]]=wgAns2[ct][qst];
- tempC[tempN[3]]=wgAns3[ct][qst];
- return tempC;}
- public static void main (String[] args) throws InterruptedException
- {
- c = new Console (850, 680);
- //variables
- int hockey = 0;
- int ball = 0;
- int golf = 0;
- int cat = 0;
- int quest = 0;
- int o=2;
- Image logo = Toolkit.getDefaultToolkit().getImage("logo.png");
- String [][] board = new String[3][15];
- board [0][0] = "How old was Wayne Gretzky when he scored his 500th career goal?";//25
- board [0][1] = "Which former player was known as “The Great One”?";
- board [0][2] = "In what year did the NHL begin?";//1917
- board [0][3] = "How many NHL teams have their full names on their logos (no abbreviations)?";//3
- board [0][4] = "Which three sub-leagues make up the Canadian Hockey League?";//QM,OH,WH
- board [0][5] = "Who holds the record for youngest player to join the “Triple Gold Club”?";//tOEWS
- board [0][6] = "Who was the first European-born goaltender to score a goal?";//Evgeni Nabokov
- board [0][7] = "What was the last season the NHL did not have a salary cap?";//2003-04
- board [0][8] = "What’s the record for most points in a single NHL season?";//215
- board [0][9] = "In a preliminary-round game of the 2014 Winter Olympics between the United States and Russia, how many shootout goals did T.J. Oshie score, leading his team to a 3-2 victory?"; //4
- board [0][10] = "Who is the most recent Stanley Cup winner that missed the playoffs in the season before and after their championship?";//hurricanes
- board [0][11] = "Who holds the record for longest NHL goal-scoring streak as a defenseman?";//Mike Green
- board [0][12] = "Which player holds the record for youngest captain in NHL history?";//Mcd
- board [0][13] = "Paul Kariya and Teemu Selanne were teammates with the Anaheim Mighty Ducks for several seasons. But, which other team did they once play together on for one season?";//Avalanche
- board [0][14] = "Which player is the all-time career penalty minute’s leader with a total of 3,966?";//tiger williams
- board [1][0] = "What team won the very first NBA game?";//knicks
- board [1][1] = "What NBA player scored 100 points on March 2, 1962?";//chamberlain
- board [1][2] = "Who was the first player in NBA history to be elected league MVP by a unanimous vote?";//curry
- board [1][3] = "What new kind of shot did Joe Fulks score a record 63 points with in one game in 1949?";//jumpshot
- board [1][4] = "Who scored the first three-point basket in NBA history?";//chris ford
- board [1][5] = "Who was the youngest player to score 10,000 points in the NBA?";//lebron
- board [1][6] = "What team owns the longest winning streak in NBA history?";//lakers
- board [1][7] = "What player was known as the 'Clown Prince' of the Harlem Globetrotters?";//Meadowlark Lemon
- board [1][8] = "Who is the all-time leading scorer in men's college basketball?";//"Pistol" Pete Maravich
- board [1][9] = "Who was the first WNBA player to dunk in a playoff game?";//Britney Griner
- board [1][10] = "How many games did Wilt Chamberlain foul out of during his 14 year NBA career?";//0
- board [1][11] = "What player won All-Star Game MVP, NBA MVP, and NBA Finals MVP awards in 2000?";//shaq
- board [1][12] = "What NBA player retired unexpectedly on November 7, 1991?";//Earvin "Magic" Johnson
- board [1][13] = "What team did Wilt Chamberlain finish his NBA career with?";//lakers
- board [1][14] = "Who won the Nestle Crunch Slam Dunk Contest on February 6, 1988?";//jordan
- board [2][0] = "What two golfers led the PGA in earnings three seasons each in the 1960s?";//Jack Nicklaus and Arnold Palmer.
- board [2][1] = "What's a scratch golfer's handicap?";//zero
- board [2][2] = "What's a golfer said to have if he is entitled to tee off first?";//The Honor
- board [2][3] = "What comic actor scored huge sales with his Bad Golf Made Easy instructional videos?";//Leslie Nielsen
- board [2][4] = "What Grand Slam golf tournament has the most club housers sipping mint juleps?";// The Masters
- board [2][5] = "Who's second to Sam Snead in PGA Tour wins?";//Jack Nicklaus
- board [2][6] = "What tournament did Arnold Palmer say he would play in as long as he could walk?";//The Masters
- board [2][7] = "Who won a record six PGA Player of the Year Awards-Jack Nicklaus, Arnold Palmer or Tom Watson?";//Tom Watson
- board [2][8] = "Who summed up a playoff loss to Jack Nicklaus at the 1991 U. S. Senior Open with 'the Bear crushed the Mouse'?";//Chi Chi Rodriguez
- board [2][9] = "What golfer bid a tearful farewell to fans after playing his last U.S. Open, in 1994?";//Arnold Palmer
- board [2][10] = "Who became the youngest and oldest player to win the Masters, in 1963 and 1986?";//Jack Nicklaus
- board [2][11] = "What golfer's worst finish at the British Open from 1966 to 1980 was sixth?";//Jack Nicklaus
- board [2][12] = "What's the only Grand Slam event Lee Trevino never won?";//The Masters
- board [2][13] = "Who was the first Swedish golfer to win the U.S. Womens's Open two straight times?";//Annika Sorenstam
- board [2][14] = "Who's the most successful Zimbabwean golfer of all time?";//Nick Price
- boolean used [][]=new boolean [3][15];
- //intro
- c.setBackgroundColor (new Color (4,31,155));
- c.clear ();
- //menu
- c.setFont (new Font ("Serif", Font.BOLD, 40));
- c.drawString("Here are the rules: ", 190, 480);
- c.drawString("Press any key to begin", 190, 560);
- c.drawImage(logo, 280, 105, 310, 310);
- c.getChar();
- c.clear();
- //second page
- c.setFont (new Font ("Serif", Font.BOLD, 16));
- c.drawString("Choose a category, Press 0 for hockey, 1 for ball, 2 for golf", 60, 100);
- c.setColor(new Color (210,102,4));
- c.setFont (new Font ("Serif", Font.PLAIN, 21));
- c.drawImage(logo, 280, 105, 310, 310);
- cat = c.readInt();
- c.clear();
- // for(int h=0; h<q; h++) {
- // quest= (int) (Math.random()*15+1);
- //
- // if(used[cat][quest]==true)
- // {
- // q++;
- // }
- // c.readInt ();
- // }
- //the game
- while(stage<15){
- quest= (int) (Math.random()*board[cat].length);
- while(used[cat][quest]==true)quest= (int) (Math.random()*board[cat].length);
- used[cat][quest] = true;
- c.setColor(new Color (4,31,155));
- c.fillRect(0,0,1000,1000);
- c.setColor(Color.white);
- c.setFont (new Font ("Serif", Font.PLAIN, 18));
- c.drawString(board[cat][quest],20,200);
- String choices[] = randomizeChoices(cat, quest);
- System.out.println(tempN[0]+1);
- c.setColor(Color.yellow);
- /*c.drawString(choices[0],50,400);
- c.drawString(choices[1],50,440);
- c.drawString(choices[2],50,480);
- c.drawString(choices[3],50,520);*/
- c.setCursor(20,0);
- c.println("1."+choices[0]);
- c.println("2."+choices[1]);
- c.println("3."+choices[2]);
- c.println("4."+choices[3]);
- c.println("\n");
- lvl();
- int choice = c.readInt();
- if (choice == tempN[0]+1){
- if(stage==14){
- c.println("\n");
- c.println("You won!");
- c.getChar();
- System.exit(0);} else{
- c.println("\n");
- c.println("Correct!");
- c.getChar();
- stage++;}
- }
- else {
- c.println("\n");
- c.println("Inorrect!");
- c.getChar();
- System.exit(0);
- }}
- /*if ()
- for (int i =0; i<15; i++) {
- c.drawString (""+i+1, 200, 100);
- }*/
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement