<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: feng leng</title>
    <description>The latest articles on DEV Community by feng leng (@feng_leng_bd37d06a9181942).</description>
    <link>https://dev.to/feng_leng_bd37d06a9181942</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F3955747%2F978977cb-1ff4-43f2-b5c7-4d5cf6b85f8c.png</url>
      <title>DEV Community: feng leng</title>
      <link>https://dev.to/feng_leng_bd37d06a9181942</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/feng_leng_bd37d06a9181942"/>
    <language>en</language>
    <item>
      <title>Modeling a 4,000-year-old astrology system as pure functions, in the browser</title>
      <dc:creator>feng leng</dc:creator>
      <pubDate>Thu, 26 Nov 2026 06:43:55 +0000</pubDate>
      <link>https://dev.to/feng_leng_bd37d06a9181942/modeling-a-4000-year-old-astrology-system-as-pure-functions-in-the-browser-3577</link>
      <guid>https://dev.to/feng_leng_bd37d06a9181942/modeling-a-4000-year-old-astrology-system-as-pure-functions-in-the-browser-3577</guid>
      <description>&lt;p&gt;I built a cultural site with a free Chinese astrology chart tool. The rule I set for myself: &lt;strong&gt;the chart is computed entirely in the browser, and the birth data never leaves the device.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;That constraint turned an astrology problem into a data-modeling problem. Here is the shape of it.&lt;/p&gt;

&lt;h2&gt;
  
  
  Input
&lt;/h2&gt;

&lt;p&gt;Three numbers and one flag: birth date, birth hour, sex. No account, no analytics on the form.&lt;/p&gt;

&lt;p&gt;The tricky part is that the system does not use the solar calendar directly. It needs:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;the &lt;strong&gt;lunar date&lt;/strong&gt; (for placing the Life palace),&lt;/li&gt;
&lt;li&gt;the &lt;strong&gt;solar terms&lt;/strong&gt; (for the four pillars),&lt;/li&gt;
&lt;li&gt;the &lt;strong&gt;hour branch&lt;/strong&gt; (子丑寅卯…, two-hour buckets).&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  The pipeline
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="c1"&gt;// pure functions, no side effects, no server&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;pillars&lt;/span&gt;   &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;fourPillars&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;date&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;solarTermTable&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;   &lt;span class="c1"&gt;// year/month/day/hour&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;lifePalace&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;locateLifePalace&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;lunarMonth&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;hourBranch&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;placement&lt;/span&gt;  &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;placeStars&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;lifePalace&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;pillars&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;     &lt;span class="c1"&gt;// 14 majors + minors&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;transforms&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;applyFourTransformations&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;yearStem&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;  &lt;span class="c1"&gt;// 祿 權 科 忌&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;decades&lt;/span&gt;    &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;decadalCycles&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;placement&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;transforms&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Each step is a pure function of the previous one. That has three concrete payoffs:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Testable against the classical tables.&lt;/strong&gt; I can write a fixture per rule ("this year stem maps this star to 祿") and assert it.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Reproducible.&lt;/strong&gt; Same input, same chart, no floating-point drift, no timezone surprises if you pin the zone.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Cacheable.&lt;/strong&gt; The whole chart is a plain object; rendering is a separate concern from computing.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  The two places people get it wrong
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;1. The day boundary is not midnight.&lt;/strong&gt; In a lunar-calendar system, the day rolls at 子時 (23:00), not 00:00. If you compute "the day pillar" at 23:30 the naive way, you get the wrong day for a chunk of births. This is the single most common bug in hobby implementations.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;2. Solar terms are astronomical, not calendar.&lt;/strong&gt; The month pillar depends on the sun's position, not on the first of the month. A table of solar-term instants per year is fine; deriving them from the calendar is not.&lt;/p&gt;

&lt;h2&gt;
  
  
  What I left out on purpose
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;No "prediction engine". The classical texts are advice literature; a UI that outputs dates and verdicts is lying about its sources.&lt;/li&gt;
&lt;li&gt;No server-side rendering of the chart. If it is not needed, it is not a place to leak data.&lt;/li&gt;
&lt;li&gt;No fuzzy fallback for missing birth hour. The hour decides the Life palace; guessing it silently produces a plausible-looking wrong chart.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Citing the sources
&lt;/h2&gt;

&lt;p&gt;The part of the site I care most about is not the rendering. Every reading quotes the passage it leans on, with volume and section, from public-domain editions of 紫微斗數全書 and the 道藏本. If the tool cannot point at a source, it should not say the thing.&lt;/p&gt;




&lt;p&gt;If you want to see the result: &lt;a href="https://h00ai.com/en/chart.html" rel="noopener noreferrer"&gt;free chart&lt;/a&gt; · &lt;a href="https://h00ai.com/en/learn/knowledge.html" rel="noopener noreferrer"&gt;the palace reference&lt;/a&gt; · &lt;a href="https://h00ai.com/en/classics/index.html" rel="noopener noreferrer"&gt;the classical library&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Happy to go deeper on the calendar math, the placement tables, or the citation pipeline in the comments.&lt;/p&gt;

</description>
      <category>architecture</category>
      <category>javascript</category>
      <category>programming</category>
      <category>webdev</category>
    </item>
    <item>
      <title>What I learned building twelve 3D temples for a website nobody asked for</title>
      <dc:creator>feng leng</dc:creator>
      <pubDate>Thu, 26 Nov 2026 03:53:02 +0000</pubDate>
      <link>https://dev.to/feng_leng_bd37d06a9181942/what-i-learned-building-twelve-3d-temples-for-a-website-nobody-asked-for-1h9o</link>
      <guid>https://dev.to/feng_leng_bd37d06a9181942/what-i-learned-building-twelve-3d-temples-for-a-website-nobody-asked-for-1h9o</guid>
      <description>&lt;p&gt;I wanted to see whether a cultural site could feel like &lt;em&gt;somewhere&lt;/em&gt; instead of &lt;em&gt;documentation&lt;/em&gt;.&lt;/p&gt;

&lt;p&gt;So I built &lt;a href="https://h00ai.com/en/index.html" rel="noopener noreferrer"&gt;Twelve Halls&lt;/a&gt;: twelve temples, each with its own deity, each answering one kind of question — love, money, work, health, travel, family. You land in front of a door. You push it. The incense lights, the room opens, and you can ask a question drawn from a Chinese astrological chart.&lt;/p&gt;

&lt;p&gt;This is not a launch post. It is a list of things that turned out to matter.&lt;/p&gt;

&lt;h2&gt;
  
  
  1. A door is worth more than a menu
&lt;/h2&gt;

&lt;p&gt;The first version was a grid of twelve cards, like every other site. The bounce told the story. So I rebuilt the entry as a 3D door you push open. Same content, same links. People started entering halls.&lt;/p&gt;

&lt;p&gt;The lesson isn't "use 3D". It's that one small physical gesture does more for attention than a well-designed list.&lt;/p&gt;

&lt;h2&gt;
  
  
  2. Texture budget is the whole game
&lt;/h2&gt;

&lt;p&gt;Each hall is a single scene with pre-baked lighting. Target: a few hundred kilobytes per hall, so a phone on 4G loads it without a spinner. That meant WebP, aggressive compression, and a separate smaller texture set for phones — and giving up reflections nobody would see at 6cm.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="c1"&gt;// rough budget per hall&lt;/span&gt;
&lt;span class="c1"&gt;// scene: 1 pre-baked equirect-equivalent background&lt;/span&gt;
&lt;span class="c1"&gt;// + deity plate + particle layer&lt;/span&gt;
&lt;span class="c1"&gt;// mobile: 1024px texture set, desktop: 2048px&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  3. The reading has to quote its source
&lt;/h2&gt;

&lt;p&gt;The chart side is Zi Wei Dou Shu: twelve palaces, fourteen major stars, four transformations. It runs entirely in the browser — birth data never leaves the device. That is both a privacy decision and an honesty one.&lt;/p&gt;

&lt;p&gt;But the part I care about is citation. Every reading quotes the classical passage it leans on, with volume and section, from public-domain editions. Not because it makes the reading true, but because it lets the reader argue with it.&lt;/p&gt;

&lt;h2&gt;
  
  
  4. A wishing tree beats a spinner
&lt;/h2&gt;

&lt;p&gt;The site has a tree where visitors hang wishes. It began as decoration. It ended up being the thing people write to me about — reading strangers' wishes turns out to be more compelling than any feature I designed.&lt;/p&gt;

&lt;h2&gt;
  
  
  5. Bilingual is not translation
&lt;/h2&gt;

&lt;p&gt;English and Chinese are not two files of the same text. The Chinese page assumes familiar vocabulary; the English page has to explain what a palace is before using the word. Same site, different teaching.&lt;/p&gt;




&lt;p&gt;No metrics to sell. If you want to walk through it: &lt;strong&gt;&lt;a href="https://h00ai.com/en/index.html" rel="noopener noreferrer"&gt;h00ai.com&lt;/a&gt;&lt;/strong&gt; — free, no account.&lt;/p&gt;

&lt;p&gt;The classical library, if you care more about the source texts than the 3D: &lt;a href="https://h00ai.com/en/classics/index.html" rel="noopener noreferrer"&gt;h00ai.com/en/classics&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Happy to answer anything about the rendering approach, the calendar math, or the source texts.&lt;/p&gt;

</description>
      <category>design</category>
      <category>showdev</category>
      <category>ui</category>
      <category>webdev</category>
    </item>
    <item>
      <title>How I Built a Free AI Fortune-Telling &amp; Dream Interpretation App</title>
      <dc:creator>feng leng</dc:creator>
      <pubDate>Thu, 28 May 2026 13:25:49 +0000</pubDate>
      <link>https://dev.to/feng_leng_bd37d06a9181942/how-i-built-a-free-ai-fortune-telling-dream-interpretation-app-5ab6</link>
      <guid>https://dev.to/feng_leng_bd37d06a9181942/how-i-built-a-free-ai-fortune-telling-dream-interpretation-app-5ab6</guid>
      <description>&lt;p&gt;Tech stack: dead simple.&lt;/p&gt;

&lt;p&gt;Backend: Node.js API servers on a $6 VPS. Three independent fortune-telling endpoints — Ziwei star charts, Bazi elemental analysis, Qimen strategic timing — plus a dream interpretation module. Each master's reading is cross-validated by a synthesis layer.&lt;/p&gt;

&lt;p&gt;Frontend: Single static HTML file. No React. No framework. 82KB total. Canvas particle background, modal-based interaction, dark theme with Chinese gold aesthetic.&lt;/p&gt;

&lt;p&gt;The real challenge wasn't the AI — it was making 3,000-year-old Chinese metaphysics understandable to a global English-speaking audience without dumbing it down.&lt;/p&gt;

&lt;p&gt;Key decisions:&lt;br&gt;
• Completely free — no signup, no paywall, no ads&lt;br&gt;
• Five masters independently read your destiny, then cross-validate&lt;br&gt;
• Dream dictionary: 50 symbols visible before you type anything&lt;br&gt;
• Auto-publishing blog: new articles every Wednesday &amp;amp; Friday&lt;/p&gt;

&lt;p&gt;Live: loyueai.com&lt;br&gt;
Would love feedback from the dev community.&lt;/p&gt;

</description>
      <category>showdev</category>
      <category>opensource</category>
      <category>webdev</category>
      <category>tutorial</category>
    </item>
  </channel>
</rss>
