<?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: Zack</title>
    <description>The latest articles on DEV Community by Zack (@zack_building).</description>
    <link>https://dev.to/zack_building</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%2F3821287%2F10fbadd0-07dc-4802-89a8-c393fc8ae902.jpg</url>
      <title>DEV Community: Zack</title>
      <link>https://dev.to/zack_building</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/zack_building"/>
    <language>en</language>
    <item>
      <title>I Built an Adaptive "Guess My Age" Quiz with Bayesian Inference &amp; Pure Web Audio (No Selfies)</title>
      <dc:creator>Zack</dc:creator>
      <pubDate>Wed, 25 Nov 2026 08:43:28 +0000</pubDate>
      <link>https://dev.to/zack_building/i-built-an-adaptive-guess-my-age-quiz-with-bayesian-inference-pure-web-audio-no-selfies-1g54</link>
      <guid>https://dev.to/zack_building/i-built-an-adaptive-guess-my-age-quiz-with-bayesian-inference-pure-web-audio-no-selfies-1g54</guid>
      <description>&lt;p&gt;Most "guess my age" sites fall into two camps: AI photo scanners that want you to upload a selfie, or rigid BuzzFeed-style point quizzes where every player gets the exact same 15 questions.&lt;br&gt;
``&lt;br&gt;
I wanted to build something faster, more private, and genuinely fun to play—so I built &lt;strong&gt;&lt;a href="https://guessmyagequiz.com/" rel="noopener noreferrer"&gt;Guess My Age Quiz&lt;/a&gt;&lt;/strong&gt;: a zero-selfie, adaptive browser game in vanilla JavaScript that estimates your age from everyday habits, childhood media formats, and nostalgia clues.&lt;/p&gt;

&lt;p&gt;👉 &lt;strong&gt;Try it live (~60 seconds, no signup, no camera):&lt;/strong&gt; &lt;a href="https://guessmyagequiz.com/" rel="noopener noreferrer"&gt;https://guessmyagequiz.com/&lt;/a&gt;&lt;/p&gt;




&lt;h2&gt;
  
  
  Why Not Fixed Point Scoring?
&lt;/h2&gt;

&lt;p&gt;Simple point totals break down fast. If a 22-year-old happens to own vinyl records or a 45-year-old uses TikTok daily, rigid scoring throws the guess way off.&lt;/p&gt;

&lt;p&gt;Instead, Guess My Age Quiz treats your age as a &lt;strong&gt;probability distribution across 80 discrete ages (6–85)&lt;/strong&gt; and updates it in real time using Bayesian inference:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Gaussian likelihoods per option:&lt;/strong&gt; Each answer nudges a smooth probability curve (&lt;code&gt;peak&lt;/code&gt;, &lt;code&gt;sigma&lt;/code&gt;) rather than adding arbitrary points.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Shannon entropy &amp;amp; information gain:&lt;/strong&gt; Before rendering the next question, the quiz calculates which remaining question in the pool maximizes expected entropy reduction—so every tap narrows your likely age window as fast as possible.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Coarse-to-fine routing (with rollback):&lt;/strong&gt; Early questions separate wide generational bands. Once your 10%–90% credible interval tightens to &lt;code&gt;&amp;lt;= 14&lt;/code&gt; years, it switches to finer milestone clues. If a surprising answer strongly contradicts the current estimate, it automatically rolls back to broader cohort clues to double-check.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Clean skip handling:&lt;/strong&gt; Selecting "I don't remember" or "Not applicable" triggers a quick follow-up distinguishing &lt;em&gt;lack of access&lt;/em&gt; from &lt;em&gt;never having heard of it&lt;/em&gt;, keeping neutral answers from skewing the estimate.&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  "Most Decisive Clue" Attribution
&lt;/h2&gt;

&lt;p&gt;At the end of the quiz, I didn't want to just print a number and call it a day. To show &lt;em&gt;why&lt;/em&gt; the quiz guessed your age, it runs a quick leave-one-out check across your answered clues—removing each answer one by one from the posterior to surface the single choice that shifted your estimated age the most.&lt;/p&gt;

&lt;p&gt;It also groups your answers into a decade-by-decade &lt;strong&gt;Memory Years Summary&lt;/strong&gt; so you can see which era your nostalgia anchors cluster around.&lt;/p&gt;




&lt;h2&gt;
  
  
  Ditching &lt;code&gt;&amp;lt;iframe&amp;gt;&lt;/code&gt; for Instant Load
&lt;/h2&gt;

&lt;p&gt;The first version embedded the quiz inside an &lt;code&gt;&amp;lt;iframe&amp;gt;&lt;/code&gt;. Clicking &lt;strong&gt;Play&lt;/strong&gt; felt noticeably sluggish because the browser had to fetch a second document, re-parse CSS/JS, fetch the question bank, and sync results back to the parent page via &lt;code&gt;postMessage&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;Moving the quiz inline directly onto the landing page—and prefetching the question bank JSON silently while the cover card is displayed—made clicking &lt;strong&gt;Play&lt;/strong&gt; completely instant and eliminated cross-frame state plumbing altogether.&lt;/p&gt;




&lt;h2&gt;
  
  
  Tactile Retro Sound Effects with Pure Web Audio API
&lt;/h2&gt;

&lt;p&gt;To match the vintage "Editorial Pop-Quiz Dossier" aesthetic without shipping audio files, every sound effect is synthesized on the fly with the Web Audio API (with a Sound On/Off toggle right above the quiz):&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Per-question click:&lt;/strong&gt; A &lt;code&gt;32ms&lt;/code&gt; bandpass-filtered white noise burst layered with a &lt;code&gt;42ms&lt;/code&gt; sine pitch-drop (&lt;code&gt;215 Hz -&amp;gt; 92 Hz&lt;/code&gt;) for a crisp mechanical card-snap feel.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Final dossier reveal:&lt;/strong&gt; A low-end ink-stamp thump (&lt;code&gt;155 Hz -&amp;gt; 48 Hz&lt;/code&gt;) that opens into a low-pass filtered &lt;code&gt;Fmaj9&lt;/code&gt; vintage chord—plus a subtle desk-bell chime if the quiz nails your exact age!&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  Client-Side Shareable Result Card (HTML5 Canvas)
&lt;/h2&gt;

&lt;p&gt;After a quick post-quiz accuracy check (where you can optionally confirm whether the guess was spot-on or enter your real age), the quiz renders a &lt;code&gt;900px&lt;/code&gt;-wide vertical dossier PNG directly on an offscreen &lt;code&gt;&amp;lt;canvas&amp;gt;&lt;/code&gt;—complete with your guessed age stamp, real-age accuracy banner, decade memory bars, and most decisive clue—ready to download or share on X with zero backend image rendering.&lt;/p&gt;




&lt;h2&gt;
  
  
  Test It Out &amp;amp; Tell Me How Close It Got!
&lt;/h2&gt;

&lt;p&gt;Give &lt;strong&gt;&lt;a href="https://guessmyagequiz.com/" rel="noopener noreferrer"&gt;Guess My Age Quiz&lt;/a&gt;&lt;/strong&gt; a try and drop a comment below:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;strong&gt;How close was the guess to your real age?&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;What was your "Most Decisive Clue"?&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;What habit or nostalgia clue do you think is the sharpest age giveaway that I should add next?&lt;/strong&gt;&lt;/li&gt;
&lt;/ol&gt;

</description>
      <category>webdev</category>
      <category>sideprojects</category>
      <category>javascript</category>
      <category>showdev</category>
    </item>
    <item>
      <title>Building a Web-based Document Scanner: Tackling Perspective and Shadows with OpenCV</title>
      <dc:creator>Zack</dc:creator>
      <pubDate>Sat, 28 Mar 2026 13:30:59 +0000</pubDate>
      <link>https://dev.to/zack_building/building-a-web-based-document-scanner-tackling-perspective-and-shadows-with-opencv-2677</link>
      <guid>https://dev.to/zack_building/building-a-web-based-document-scanner-tackling-perspective-and-shadows-with-opencv-2677</guid>
      <description>&lt;p&gt;We've all been there: you need to scan a receipt or a signed document, but all you have is your phone. You take a photo, but it's skewed, shadowy, and looks nothing like a real "scan."&lt;/p&gt;

&lt;p&gt;I decided to solve this by building DocuScanPro, a web-based document scanner that focuses on high-fidelity image enhancement directly in the browser.&lt;/p&gt;

&lt;p&gt;The Problem: Perspective and Lighting&lt;br&gt;
Standard mobile photos suffer from two major issues:&lt;/p&gt;

&lt;p&gt;Perspective Distortion: When you don't take the photo perfectly from above.&lt;br&gt;
Uneven Lighting: Shadows from your hand or environmental lighting that make the text hard to read.&lt;br&gt;
The Solution: A Python + OpenCV Pipeline&lt;br&gt;
To tackle this, I built a backend processing engine using FastAPI and OpenCV. Here’s a high-level look at the pipeline:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Finding the Document
We use Canny edge detection followed by contour approximation to identify the four corners of the document.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;python&lt;/p&gt;

&lt;h1&gt;
  
  
  Simple example of findContours in OpenCV
&lt;/h1&gt;

&lt;p&gt;contours, _ = cv2.findContours(edged, cv2.RETR_LIST, cv2.CHAIN_APPROX_SIMPLE)&lt;/p&gt;

&lt;h1&gt;
  
  
  ... find the largest 4-point contour
&lt;/h1&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Perspective Transform&lt;br&gt;
Once we have the corners, we apply a warp perspective transform to "flatten" the document into a perfect rectangle.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Shadow Removal &amp;amp; Enhancement&lt;br&gt;
This is where the magic happens. Instead of a simple global threshold, I implemented Adaptive Thresholding. This calculates a threshold for small regions of the image, which helps eliminate shadows while keeping the text sharp and the background a clean, "paper" white.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;The Results (Before &amp;amp; After)&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fxwr4n7wm791wsz618kj4.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fxwr4n7wm791wsz618kj4.jpg" alt=" " width="800" height="800"&gt;&lt;/a&gt;&lt;br&gt;
&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Febuwj2stfv1j0gz2b5eh.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Febuwj2stfv1j0gz2b5eh.jpg" alt=" " width="800" height="1097"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Try it out!&lt;br&gt;
I’ve just launched the initial version and I’m looking for feedback on the algorithm performance—especially for edge cases like white paper on light tables.&lt;/p&gt;

&lt;p&gt;Check out the live tool here: &lt;a href="https://www.docuscan.pro/" rel="noopener noreferrer"&gt;https://www.docuscan.pro/&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;I'd love to hear your thoughts on the image processing logic or any libraries you recommend.&lt;/p&gt;

</description>
      <category>python</category>
      <category>productivity</category>
      <category>react</category>
      <category>webdev</category>
    </item>
  </channel>
</rss>
