LAB12 Monty Hall problem
     Write a Java program to let user play the Monty Hall game.
     Your program should be an Applet, but can also be run as an Java application.
     Besides, at least a Button to play/stop background music should be provided.
    (這題用到的都是以前學過的, 所以其實也不難:-)
Purpose: 
  To master the Java GUI with an interest game of probability.
  
Due: 2011/05/22 & 05/29 Sunday 23:59  
  請注意: 做好習題請到數位學習網站本題討論區依照規定貼文寫心得報告, 
   且標題 Subject: LAB12 from 學號姓名(當然是你學號與姓名!)
   報告內容是心得、然後 Running Script、再接著帶Line numbers程式碼
   方便助教評分, 並把所有資料壓縮成可執行的 .jar 檔案當夾檔附件佐證!
 
Note: 
    You should also write what you have learned from this Lab.
       即使只是屍體也必須在 Due (5/22)之前先貼一版本; 且必須先寫研讀心得!
       之後再補上程式與完整心得!  
    Last version due 2011/05/29; 這題在該日之後再繳都不算分數!!
    注意 5/22之前沒有貼第一版的就不必繳了! 因為繳了也不算!
    還有, 注意沒寫心得或是沒有帶著 Line numbers 程式者也都不算! 會被刪除!  
     (請自己注意備份)  
Description:
    Switch or NOT to switch?
    This is a conditional probility (條件機率) problem. 
    The Monty Hall problem is a probability puzzle based on the American
    television game show Let's Make a Deal. The name comes from the
    show's host, Monty Hall.  (電視節目主持人名字叫做 Monty Hall)
    The problem is also called the Monty Hall paradox.

Requirements and hints:
  (0) More about GUI: http://j2se.myweb.hinet.net/article/java/hw02.htm
  (1)The detail about the Monty Hall problem can be found in wikipedia:
    in English:
     http://en.wikipedia.org/wiki/Monty_Hall_problem
    in Chinese: 
     http://zh.wikipedia.org/w/index.php?title=%E8%92%99%E6%8F%90%E9%9C%8D%E7%88%BE%E5%95%8F%E9%A1%8C&variant=zh-hant  
  (2)Your Java program should be able to be run both as Java
     Application and as Java Applet.
  (3)The number of door should be configurable by user, range between
     3 doors to 7 doors. (Do this feature in first week.)
     A java.awt.List component contains choices is recommended.
  (4)If there are n doors (where n >= 3), then your program should
     open n-2 doors so that two doors left for the user to choose 
     after the user makes his first guess on every game.
  (5)Your voice and your photo should be used in this Lab. 
        (You can Do this feature in your 2nd version.)
  (6)Extra credit: 
     Your program can also give statistics. 
     (統計總共玩幾次, 有換時猜對幾次, 不換猜對幾次...)
  (7)More Extra credits: 
     Can simulate playing n times and give statistics of the simulation.
     Where n and the demo speed are given by the user every time.
  (8)More links regarding the Monty Hall problem:
     http://math.ucsd.edu/~crypto/Monty/monty.html
     http://www.comedia.com/hot/monty.html
     http://www.userpages.de/monty_hall_problem/
     http://chrisc.freeshell.org/random/pages/montyhall.html
     http://www.letsmakeadeal.com/problem.htm
     http://www.cut-the-knot.org/hall.shtml
http://people.hofstra.edu/Steven_R_Costenoble/MontyHall/MontyHallSim.html
     http://www.stat.sc.edu/~west/javahtml/LetsMakeaDeal.html
     http://www.usna.edu/MathDept/.courses/pre97/sm230/MONTYHAL.HTM 
     http://www.nytimes.com/2008/04/08/science/08monty.html  

按這裡以便可較方便"點按"連結到上面各 Links.

按這裡抓這題的 LAB12.jar 檔案

請抓回後先這樣測試再解壓縮:
java -jar LAB12.jar
java -cp LAB12.jar Gui9
java -cp LAB12.jar Gui888
java -cp LAB12.jar testMp3
java -cp LAB12.jar tm2
java -cp LAB12.jar tw

java -cp LAB12.jar -jar g99.zip
java -cp LAB12.jar -jar gn888.jar
java -cp LAB12.jar -jar kt.jar

然後, 把 LAB12.jar 解壓縮後再測:
java -jar g99.zip
java -cp g99.zip Gui9

java -jar gn888.jar
java -cp gn888.jar Gui888

java -jar kt.jar
java -cp kt.jar KeyTest

java tw
java tm2
java testMp3
java Gui9
java Gui888

You are the -th visitors to this page.
      回到作業目錄             回到課程目錄