Dev.to WebDev 🛠 Dev 👁 0 📖 1 min read

Cast the BaZi chart in code, then let the model read it

Ask a chat model for a BaZi chart twice. Change nothing but the wording of the question, and you often get two different sets of pillars. The model is writing a chart the way it writes a paragraph. A chart is a function

Ask a chat model for a BaZi chart twice. Change nothing but the wording of the question, and you often get two different sets of pillars. The model is writing a chart the way it writes a paragraph. A chart is a function of a date, a clock time, and a place. Run it again with the same arguments and the characters should match.

The model never receives a blank chart

On the BaZi calculator, the order is fixed.

  1. Take the birth date, the clock time, and the birthplace.
  2. Restore that clock time with the timezone that place was using that day, daylight saving included. Mainland China is UTC+8 in most years. In the summers of 1986 through 1991 it was UTC+9. Using today's offset for a 1988 birth moves the hour pillar.
  3. Cut that instant into four pillars. The year changes at Start of Spring, not on 1 January. The month follows the solar terms, not the Gregorian month and not the lunar month. The day pillar on this page flips at 23:00, not at midnight.
  4. Only then does the model see the page. It may explain the Day Master, the Ten Gods, and the ten-year cycle already printed. It does not rewrite a stem because the question sounded urgent.

Zi Wei is the same contract with a different table. The same instant goes in. Stars and palaces come out. The model explains those fields. A follow-up such as "what about my job?" stays on that chart. It does not recast the hour.

The page is a Next.js app. The Zi Wei placement uses iztro. The chart object is produced before any prompt is sent.


js
function castBazi({ date, time, place }) {
  const instant = restoreHistoricalTimezone(date, time, place); // DST included
  return fourPillars(instant); // the model may only describe this object
}
📰 Read the original article on Dev.to WebDev

Originally published by Dev.to WebDev. Aggregated on AIWithGhost for educational purposes — full credit and traffic to the original publisher.