Jump to content
Macro Express Forums

Search the Community

Showing results for tags 'monty'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • News and Information
    • Guidelines for all Forums
  • Community Forums
    • Macro Express and Macro Express Pro
    • Macro Express 3.x
    • Macro Express 3.x Third Party Tools
  • Private Forums
  • Forum Archives

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


AIM


MSN


Website URL


ICQ


Yahoo


Jabber


Skype


Location


Interests

Found 1 result

  1. I recently learned about the so-called "Monty Hall" problem. Like many people, I found it hard to believe that you have a better chance of winning if you switch doors. So, it occured to me that I could "prove" it to myself by writing a macro. Here it is, and it works! (Woo hoo!) (I'm not a professional macro writer. There might be a more efficient way to write a macro to demonstrate the problem.) (Direct edit text attached) // N1 is your decision to keep your original door or switch doors // N2 is the winning door // N3 is your original door choice // N4 is the number of times you win // N5 is the number of times you lose // T1 is your decision to keep your original door or switch doors // T2 is the winning door // T3 is your original door choice // A=Keep, B=Switch Multiple Choice Menu: Keep or Switch? If Variable %T1% = "A" Variable Set Integer %N1% to 0 Else Variable Set Integer %N1% to 1 End If Repeat Start (Repeat 1000 times) // N2 (also T2) is the *winning* door (set randomly) // Maxium Random Value set to 2. (0=door A, 1=door B, 2=door C) Variable Set Integer %N2% with a Random Number If Variable %N2% = 0 Variable Set String %T2% "Door A" End If If Variable %N2% = 1 Variable Set String %T2% "Door B" End If If Variable %N2% = 2 Variable Set String %T2% "Door C" End If // N3 (also T3) is your original door choice (set randomly). // Maxium Random Value set to 2. (0=door A, 1=door B, 2=door C) Variable Set Integer %N3% with a Random Number If Variable %N3% = 0 Variable Set String %T3% "Door A" End If If Variable %N3% = 1 Variable Set String %T3% "Door B" End If If Variable %N3% = 2 Variable Set String %T3% "Door C" End If // N1 is your decision (0 = Keep the original door), (1 = Switch doors) // If you keep the original door If Variable %N1% = 0 // ...and you had originally picked the winning door If Variable %T2% = variable %T3% // You win :-) Variable Modify Integer: %N4% = %N4% + 1 Else // ...and you had originally picked a losing door // You lose :-( Variable Modify Integer: %N5% = %N5% + 1 End If Else // If you switch doors // ...and you had originally picked the winning door If Variable %T2% = variable %T3% // You lose :-( Variable Modify Integer: %N5% = %N5% + 1 Else // ...and you had originally picked a losing door // You win :-) Variable Modify Integer: %N4% = %N4% + 1 End If End If Repeat End // Wins = %N4%, Losses = %N5% Text Box Display: Wins and losses
×
×
  • Create New...