I have been collecting caravan closed city stats for a couple of months now. I have collected over 400 inputs. While I was collecting the stats, there was an update, and the closed city percentage changed from 1.6 to 1.5. This meant that 200 inputs were outdated. Now that I am tracking caravan closed city status stats, I have notice a slight difference between 3 and 4 unlocked cities. That got me thinking. Is there a difference how many cities are unlocked? Is it better to have more or less cities unlocked when farming Silk?

Because I am not a mathematician and I can't calculate (or willing to calculate) what are the exact percentages on closed cities, I decided to just simulate it and let the computer do the math. I know how to write code, so this is what I did.

## Code[]

First I made a list of caravan cities. Zero means that the city is open; one means that it is closed. Then I simulated closing cities. We got information from devs that, if all cities are open the number of cities close is 1.5. They can be closed even, if they are not open (we just don't see that). We also know that one city has to be open all the time. At the end we sum all closed cities. Then we loop over this simulation a couple times (100,000 in this case). And we also loop over the whole thing for each city (1 open city, 2 open cities, etc.).

And here is the code (the code can also be found in Module:Test):

local p = {} function p.caravan_closed () -- 0 = open -- 1 = closed local caravan_cities = { [1] = 0, [2] = 0, [3] = 0, [4] = 0, [5] = 0, [6] = 0, [7] = 0, [8] = 0 } local open_cities = 0 local sum = 0 local total = 100000 local temp = '' for city_1 = 1, 8 do open_cities = city_1 sum = 0 for entries = 1, total do caravan_cities = { [1] = 0, [2] = 0, [3] = 0, [4] = 0, [5] = 0, [6] = 0, [7] = 0, [8] = 0 } -- One city is closed for sure. caravan_cities[math.random(1,8)] = 1 -- One city is closed 50% of the time. if math.random(1,10) > 5 then local random_number = math.random(1,8) for i = 1, 10 do if caravan_cities[random_number] ~= 1 then caravan_cities[random_number] = 1 break else random_number = math.random(1,8) end end end -- Checks, if all cities are closed. local semi_sum = 0 for city_2 = 1, open_cities do semi_sum = semi_sum + caravan_cities[city_2] end -- Opens one city, if they are all closed. if semi_sum == open_cities then caravan_cities[open_cities] = 0 end -- Sums all closed cities. for city_3 = 1, open_cities do sum = sum + caravan_cities[city_3] end end temp = temp .. '\n' .. open_cities .. ' open cities: ' temp = temp .. math.floor(((sum/(open_cities*total))*100)*100)/100 temp = temp .. '% chance of 1 city being closed.' end return temp end return p

## Results[]

- 1 open cities: 0% chance of 1 city being closed.
- 2 open cities: 17.81% chance of 1 city being closed.
- 3 open cities: 18.75% chance of 1 city being closed.
- 4 open cities: 18.74% chance of 1 city being closed.
- 5 open cities: 18.77% chance of 1 city being closed.
- 6 open cities: 18.75% chance of 1 city being closed.
- 7 open cities: 18.76% chance of 1 city being closed.
- 8 open cities: 18.75% chance of 1 city being closed.

As it turns out there is only a difference when 2 cities are open; and that only a small one. The reason why I calculated the percent of 1 city being closed, is because you usually want to just farm one city (e.g. Xian for Silk).

I guess we'll be changing the Tips for Adventurers Guild. Also, I will probably stop gathering Caravan data.

PS: Let me know, if I made a mistake in the code!