Thread: For Fun

Results 1 to 4 of 4
  1. #1 For Fun 
    Donator


    Join Date
    Jul 2011
    Posts
    570
    Thanks given
    135
    Thanks received
    142
    Rep Power
    291
    This is just a simple assignment. If you have spare time try and do this

    Instructions:

    There is a game in which a player must roll 'n' number of six-sided dice. He then wins by getting a certain configuration of numbers (all odds, etc.). Develop a program that can accept an integer number of dice from the user, and return the probabilities of getting the different configurations as shown below.

    Boundaries:

    Assume that all dice are rolled in succession.
    Output percentages can be in decimal, percentage, or fractional form.

    Example input and output:

    Input: 3
    Output:
    All the same number: 0.462963%
    All odds: 50%
    All the same number except for one of them: 2.3148148%
    All greater than 3: 12.5%

    Input: 5
    Output:
    All the same number: 0.0128601%
    All odds: 50%
    All the same number except for one of them: 0.0643004%
    All greater than 3: 3.125%

    Answer format:

    This challenge can be completed using any language you wish (JavaScript or PHP is preferred).
    Reply With Quote  
     

  2. #2  
    Donator


    Join Date
    Jul 2011
    Posts
    570
    Thanks given
    135
    Thanks received
    142
    Rep Power
    291
    Here is another one if you like doing these:

    Instructions:

    Dates can be found in innumerable formats around the world, based on region or just personal preference. Develop a program that can accept an 8-digit number as an input from the user, and return all of the possible dates that the number could be referencing.

    Boundaries:

    Assume that all years entered will be year 2000 or later.
    Assume that February always has 28 days.
    Assume that the year will always be 4 digits, the month will always be 2, and the day will always be 2.

    Example input => output:

    02272001 => “February 27, 2001 (MMDDYYYY)”
    09022012 => [“September 2, 2012 (MMDDYYYY)”, “February 9, 2012 (DDMMYYYY)”]
    20052008 => [“May 20, 2008 (DDMMYYYY)", “August 20, 2005 (YYYYDDMM)”]
    28162028 => false

    The program does not need to display the date format (e.g. "MMDDYYYY" in the examples above).

    Answer format:

    This challenge can be completed using any language you wish (JavaScript or PHP are always the most preferred).
    Reply With Quote  
     

  3. #3  


    Major's Avatar
    Join Date
    Jan 2011
    Posts
    2,997
    Thanks given
    1,293
    Thanks received
    3,556
    Rep Power
    5000
    Your "all greater than 3" values are wrong because you did "all greater than or equal to 3". The actual values are:

    n = 3:
    (2/6)^3 = 0.03737...

    n= 5:
    (2/6)^5 = 0.00412 (3 s.f.)
    Reply With Quote  
     

  4. Thankful user:


  5. #4  
    Registered Member
    Join Date
    May 2014
    Posts
    27
    Thanks given
    1
    Thanks received
    1
    Rep Power
    0
    this is in the homework section m8 lel
    Exodus 3:14 God said to Moses, “I am who I am.This is what you are to say to the Israelites: ‘I am has sent me to you.’
    John 8:58 Jesus said to them, “Truly, truly, I say to you, before Abraham was, I am.
    Reply With Quote  
     


Thread Information
Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)


User Tag List

Similar Threads

  1. DoodursPk- Spawn Master Pk Server- Come Just For Fun!
    By every1thing in forum Advertise
    Replies: 6
    Last Post: 11-23-2010, 07:58 AM
  2. Trytohaxme - We Do It For Fun!
    By Scratch. in forum Music
    Replies: 2
    Last Post: 09-26-2010, 12:48 AM
  3. Trytohaxme - We Do It For Fun!
    By Trytohaxme in forum Music
    Replies: 3
    Last Post: 09-21-2010, 07:12 PM
  4. Replies: 46
    Last Post: 04-18-2010, 09:37 PM
  5. iScape - Small project for fun
    By Rabid Butterfly in forum Projects
    Replies: 2
    Last Post: 03-14-2010, 11:51 PM
Posting Permissions
  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •