Matlab Help needed

• Sep 1st 2009, 03:47 PM
bamby
Matlab Help needed
I have to white a code which simulates a game.

The game is:
We have 2 oponents whith whom you alternate play. Whenever you play with A you win with probability pa; whenever you play with B you win with probability pb, where pb>pa.
Your objective is to minimize the number of games you need to play to win 2 games in a row. Should you start with A or B?

I can use some random numbers for pa and pb.
My question is how to simulate a game.
What should I sum or derive in Matlab code?

Thank you!
• Sep 1st 2009, 08:33 PM
CaptainBlack
Quote:

Originally Posted by bamby
I have to white a code which simulates a game.

The game is:
We have 2 oponents whith whom you alternate play. Whenever you play with A you win with probability pa; whenever you play with B you win with probability pb, where pb>pa.
Your objective is to minimize the number of games you need to play to win 2 games in a row. Should you start with A or B?

I can use some random numbers for pa and pb.
My question is how to simulate a game.
What should I sum or derive in Matlab code?

Thank you!

The core of the program is a loop that loops over games using a random number to determine the result and stopping when you win two in a row and returning the number of games simulated.

CB