Cat and mouse 'time until eaten' problem

484 Views Asked by At

I'll start by saying that this is for a homework, so any hints will be more appreciated than straight up answers, as I would like to obtain the answers through my own working.

Anyway, I'll just copy and paste the text from the handout:

Expected Time to Survive. Suppose you are a mouse and you live in a house with 5 rooms arranged in a floor plan as shown in Figure 1. You start in room 1 and every minute (starting at t = 1) you move to a new room by choosing a door at random. In room 5 there is a sleeping but hungry cat who will instantly wake up and eat you should you enter. How much longer can you be expected to survive?

Figure 1. House plan without an exit

The computer part Tasks. • Write a function that will create a random value of X — the time until eaten given you start in room 1. • Create 10,000 random values of X. • Estimate µ, the mean time until death.

Trouble is I can't get anywhere with it, so far all I've established is that the smallest value X can take is 3, seeing as one make at least 2 moves to get to room 5, in which case t=3.

I'm hoping that taking a break and coming back later will sort my brain out as I know this is something I should be able to breeze through.