天气预报员

算法The weather in Eorzea can be predicted. First, the number of Eorzean hours and days since the Unix epoch is calculated.

// Get seconds since Jan 1st 1970

const unixSeconds = Date.now() / 1000

// Get Eorzean hours/days since (1 Eorzean hour = 175 seconds)

const eorzeanHours = Math.floor(unixSeconds / 175)

const eorzeanDays = Math.floor(eorzeanHours / 24)Next, compute which of the 3 time chunks the hour falls in.

let timeChunk = (eorzeanHours % 24) - (eorzeanHours % 8)

// Adjust time chunk so that

// 16:00 is 00,

// 00:00 is 08,

// 08:00 is 16

timeChunk = (timeChunk + 8) % 24The number of Eorzean days and the time chunk form the seed that is hashed.

const seed = eorzeanDays * 100 + timeChunk

// Do a little hashing

const step1 = (seed << 11) ^ seed

const step2 = (step1 >>> 8) ^ step1

// Return a number between 0-99 inclusive

const weatherChance = step2 % 100With weatherChance computed as a number from 0 to 99, each zone can determine its weather. For example, the weather in Eureka Anemos is Gales if weatherChance is between 30 and 59. Its full table of weathers is

weatherChanceWeather

00-29

晴朗30-59

强风60-89

暴雨90-99

小雪