"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<head>
-<!-- 2025-07-29 ti 00:24 -->
+<!-- 2025-07-29 ti 03:07 -->
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>Fractals</title>
<h2>Table of Contents</h2>
<div id="text-table-of-contents" role="doc-toc">
<ul>
-<li><a href="#org1275a81">1. Fractal circles</a></li>
-<li><a href="#orgd4b8463">2. Fractal circles animated</a></li>
-<li><a href="#org69998f4">3. Fractal of squares</a></li>
-<li><a href="#org1ab8a93">4. Fractal of squares animated</a></li>
-<li><a href="#org8845645">5. Fractal of trees</a></li>
+<li><a href="#org9daf269">1. Fractal circles</a></li>
+<li><a href="#org899c436">2. Fractal circles animated</a></li>
+<li><a href="#org7c10a33">3. Fractal of squares</a></li>
+<li><a href="#orgd51d159">4. Fractal of squares animated</a></li>
+<li><a href="#orgeb0731d">5. Fractal of trees</a></li>
</ul>
</div>
</div>
</style>
-<div id="outline-container-org1275a81" class="outline-2">
-<h2 id="org1275a81"><span class="section-number-2">1.</span> Fractal circles</h2>
+<div id="outline-container-org9daf269" class="outline-2">
+<h2 id="org9daf269"><span class="section-number-2">1.</span> Fractal circles</h2>
<div class="outline-text-2" id="text-1">
<p>
This QBasic program generates a visually captivating spiral fractal
</p>
-<div id="orgd5d762a" class="figure">
+<div id="orgd7ba7e1" class="figure">
<p><a href="fractal circles.bas" class="responsive-img"><img src="fractal%20circles.png" alt="fractal%20circles.png" class="responsive-img" /></a>
</p>
</div>
</div>
</div>
-<div id="outline-container-orgd4b8463" class="outline-2">
-<h2 id="orgd4b8463"><span class="section-number-2">2.</span> Fractal circles animated</h2>
+<div id="outline-container-org899c436" class="outline-2">
+<h2 id="org899c436"><span class="section-number-2">2.</span> Fractal circles animated</h2>
<div class="outline-text-2" id="text-2">
<p>
This QBasic program creates an animated fractal composed of circles,
</div>
</div>
-<div id="outline-container-org69998f4" class="outline-2">
-<h2 id="org69998f4"><span class="section-number-2">3.</span> Fractal of squares</h2>
+<div id="outline-container-org7c10a33" class="outline-2">
+<h2 id="org7c10a33"><span class="section-number-2">3.</span> Fractal of squares</h2>
<div class="outline-text-2" id="text-3">
<p>
This QBasic program generates and displays a fractal pattern composed of squares.
</p>
-<div id="orgae53695" class="figure">
+<div id="orgcc61450" class="figure">
<p><a href="fractal squares.bas" class="responsive-img"><img src="fractal%20squares,%201.png" alt="fractal%20squares,%201.png" class="responsive-img" /></a>
</p>
</div>
-<div id="orgefabacd" class="figure">
+<div id="orgb9604e5" class="figure">
<p><a href="fractal squares.bas" class="responsive-img"><img src="fractal%20squares,%202.png" alt="fractal%20squares,%202.png" class="responsive-img" /></a>
</p>
</div>
</div>
</div>
-<div id="outline-container-org1ab8a93" class="outline-2">
-<h2 id="org1ab8a93"><span class="section-number-2">4.</span> Fractal of squares animated</h2>
+<div id="outline-container-orgd51d159" class="outline-2">
+<h2 id="orgd51d159"><span class="section-number-2">4.</span> Fractal of squares animated</h2>
<div class="outline-text-2" id="text-4">
<p>
This QBasic program generates an animated fractal pattern composed of
</div>
</div>
-<div id="outline-container-org8845645" class="outline-2">
-<h2 id="org8845645"><span class="section-number-2">5.</span> Fractal of trees</h2>
+<div id="outline-container-orgeb0731d" class="outline-2">
+<h2 id="orgeb0731d"><span class="section-number-2">5.</span> Fractal of trees</h2>
<div class="outline-text-2" id="text-5">
<p>
QBasic program that generates a visually appealing fractal tree
</div>
</div>
<div id="postamble" class="status">
-<p class="date">Created: 2025-07-29 ti 00:24</p>
+<p class="date">Created: 2025-07-29 ti 03:07</p>
<p class="validation"><a href="https://validator.w3.org/check?uri=referer">Validate</a></p>
</div>
</body>
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<head>
-<!-- 2025-07-29 ti 00:24 -->
+<!-- 2025-07-29 ti 03:07 -->
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>Spiral series</title>
<h2>Table of Contents</h2>
<div id="text-table-of-contents" role="doc-toc">
<ul>
-<li><a href="#org4de7736">1. Spiral with increasing density</a></li>
-<li><a href="#org1791e8a">2. Spiral with varying height</a></li>
-<li><a href="#orgee2fc76">3. Shaded spiral</a></li>
-<li><a href="#org2ca1638">4. Sphere forming spiral</a></li>
-<li><a href="#org507032b">5. Textured spherical spiral</a></li>
-<li><a href="#org0fa6f97">6. Textured and shaded spherical spiral</a></li>
+<li><a href="#orgbe5e451">1. Spiral with increasing density</a></li>
+<li><a href="#org42e9442">2. Spiral with varying height</a></li>
+<li><a href="#org08ffd8d">3. Shaded spiral</a></li>
+<li><a href="#orgd4086ff">4. Sphere forming spiral</a></li>
+<li><a href="#org13d5094">5. Textured spherical spiral</a></li>
+<li><a href="#org8095c2a">6. Textured and shaded spherical spiral</a></li>
</ul>
</div>
</div>
}
</style>
-<div id="outline-container-org4de7736" class="outline-2">
-<h2 id="org4de7736"><span class="section-number-2">1.</span> Spiral with increasing density</h2>
+<div id="outline-container-orgbe5e451" class="outline-2">
+<h2 id="orgbe5e451"><span class="section-number-2">1.</span> Spiral with increasing density</h2>
<div class="outline-text-2" id="text-1">
-<div id="org9a8ec38" class="figure">
+<div id="orgdd274fd" class="figure">
<p><img src="spiral.png" alt="spiral.png" class="responsive-img" />
</p>
</div>
</div>
</div>
-<div id="outline-container-org1791e8a" class="outline-2">
-<h2 id="org1791e8a"><span class="section-number-2">2.</span> Spiral with varying height</h2>
+<div id="outline-container-org42e9442" class="outline-2">
+<h2 id="org42e9442"><span class="section-number-2">2.</span> Spiral with varying height</h2>
<div class="outline-text-2" id="text-2">
-<div id="orgdcede2b" class="figure">
+<div id="org3c75287" class="figure">
<p><img src="spiral, 2.png" alt="spiral, 2.png" class="responsive-img" />
</p>
</div>
</div>
</div>
-<div id="outline-container-orgee2fc76" class="outline-2">
-<h2 id="orgee2fc76"><span class="section-number-2">3.</span> Shaded spiral</h2>
+<div id="outline-container-org08ffd8d" class="outline-2">
+<h2 id="org08ffd8d"><span class="section-number-2">3.</span> Shaded spiral</h2>
<div class="outline-text-2" id="text-3">
-<div id="org56a4ed5" class="figure">
+<div id="org4e0dbfa" class="figure">
<p><img src="spiral, 3.png" alt="spiral, 3.png" class="responsive-img" />
</p>
</div>
</div>
</div>
-<div id="outline-container-org2ca1638" class="outline-2">
-<h2 id="org2ca1638"><span class="section-number-2">4.</span> Sphere forming spiral</h2>
+<div id="outline-container-orgd4086ff" class="outline-2">
+<h2 id="orgd4086ff"><span class="section-number-2">4.</span> Sphere forming spiral</h2>
<div class="outline-text-2" id="text-4">
<p>
Similar to previous spiral, Line segments are connected between the
</p>
-<div id="org54145e9" class="figure">
+<div id="org338ca23" class="figure">
<p><img src="spiral, 4, 1.png" alt="spiral, 4, 1.png" class="responsive-img" />
</p>
</div>
</p>
-<div id="orga1d97cc" class="figure">
+<div id="org6ad966c" class="figure">
<p><img src="spiral, 4, 2.png" alt="spiral, 4, 2.png" class="responsive-img" />
</p>
</div>
</div>
</div>
-<div id="outline-container-org507032b" class="outline-2">
-<h2 id="org507032b"><span class="section-number-2">5.</span> Textured spherical spiral</h2>
+<div id="outline-container-org13d5094" class="outline-2">
+<h2 id="org13d5094"><span class="section-number-2">5.</span> Textured spherical spiral</h2>
<div class="outline-text-2" id="text-5">
-<div id="orgfab3135" class="figure">
+<div id="org30c81d4" class="figure">
<p><img src="spiral, 5.png" alt="spiral, 5.png" class="responsive-img" />
</p>
</div>
</div>
</div>
-<div id="outline-container-org0fa6f97" class="outline-2">
-<h2 id="org0fa6f97"><span class="section-number-2">6.</span> Textured and shaded spherical spiral</h2>
+<div id="outline-container-org8095c2a" class="outline-2">
+<h2 id="org8095c2a"><span class="section-number-2">6.</span> Textured and shaded spherical spiral</h2>
<div class="outline-text-2" id="text-6">
-<div id="org2841266" class="figure">
+<div id="org2bf0668" class="figure">
<p><img src="spiral, 6.png" alt="spiral, 6.png" class="responsive-img" />
</p>
</div>
</div>
</div>
<div id="postamble" class="status">
-<p class="date">Created: 2025-07-29 ti 00:24</p>
+<p class="date">Created: 2025-07-29 ti 03:07</p>
<p class="validation"><a href="https://validator.w3.org/check?uri=referer">Validate</a></p>
</div>
</body>
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<head>
-<!-- 2025-07-29 ti 02:13 -->
+<!-- 2025-07-29 ti 03:07 -->
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
-<title>Fractals</title>
+<title>Algorithmic textures</title>
<meta name="generator" content="Org Mode" />
<style>
#content { max-width: 60em; margin: auto; }
</head>
<body>
<div id="content" class="content">
-<h1 class="title">Fractals</h1>
+<h1 class="title">Algorithmic textures</h1>
<div id="table-of-contents" role="doc-toc">
<h2>Table of Contents</h2>
<div id="text-table-of-contents" role="doc-toc">
<ul>
-<li><a href="#orgb370f6f">1. Circular waves</a></li>
-<li><a href="#org563db65">2. Diamond square clouds</a></li>
-<li><a href="#orgd785dc2">3. Old paper</a></li>
-<li><a href="#orgdcf6428">4. Wood</a></li>
-<li><a href="#org95d07e4">5. Yellow flame</a></li>
+<li><a href="#org91fa02c">1. Circular waves</a></li>
+<li><a href="#org6016d80">2. Diamond square clouds</a></li>
+<li><a href="#orgd87ac34">3. Old paper</a></li>
+<li><a href="#orgeee80bf">4. Wood</a></li>
+<li><a href="#orgaf13ba6">5. Yellow flame</a></li>
</ul>
</div>
</div>
}
</style>
-<div id="outline-container-orgb370f6f" class="outline-2">
-<h2 id="orgb370f6f"><span class="section-number-2">1.</span> Circular waves</h2>
+<div id="outline-container-org91fa02c" class="outline-2">
+<h2 id="org91fa02c"><span class="section-number-2">1.</span> Circular waves</h2>
<div class="outline-text-2" id="text-1">
<p>
This QBasic program creates visually captivating circular wave
</p>
<div class="org-src-container">
-<pre class="src src-basic-qb45"><span style="color: #6c7086;">' </span><span style="color: #6c7086;">Program to render circular wave patterns.</span>
-<span style="color: #6c7086;">' </span><span style="color: #6c7086;">Algorithm was accidentally discovered while experimenting with sine function.</span>
-<span style="color: #6c7086;">'</span>
-<span style="color: #6c7086;">' </span><span style="color: #6c7086;">This program is free software: released under Creative Commons Zero (CC0) license</span>
-<span style="color: #6c7086;">' </span><span style="color: #6c7086;">by Svjatoslav Agejenko.</span>
-<span style="color: #6c7086;">' </span><span style="color: #6c7086;">Email: svjatoslav@svjatoslav.eu</span>
-<span style="color: #6c7086;">' </span><span style="color: #6c7086;">Homepage: http://www.svjatoslav.eu</span>
-<span style="color: #6c7086;">'</span>
-<span style="color: #6c7086;">' </span><span style="color: #6c7086;">Changelog:</span>
-<span style="color: #6c7086;">' </span><span style="color: #6c7086;">2003, Initial version</span>
-<span style="color: #6c7086;">' </span><span style="color: #6c7086;">2025, Improved program readability</span>
-
-<span style="color: #f38ba8;">SCREEN</span> 13
-
-<span style="color: #6c7086;">' </span><span style="color: #6c7086;">Initialize the screen mode to 320x200 with 16 colors</span>
-
-<span style="color: #6c7086;">' </span><span style="color: #6c7086;">Outer loop for the vertical axis (y-coordinate)</span>
-<span style="color: #cba6f7;">FOR</span> ycoordinate = 1 <span style="color: #cba6f7;">TO</span> 199
- <span style="color: #6c7086;">' </span><span style="color: #6c7086;">Inner loop for the horizontal axis (x-coordinate)</span>
- <span style="color: #cba6f7;">FOR</span> xcoordinate = 1 <span style="color: #cba6f7;">TO</span> 319
- <span style="color: #6c7086;">' </span><span style="color: #6c7086;">Calculate the sine value based on the squared distances from the origin</span>
- colorvalue = <span style="color: #89b4fa;">SIN</span>((xcoordinate ^ 2 + ycoordinate ^ 2) / 10) * 10
-
- <span style="color: #6c7086;">' </span><span style="color: #6c7086;">Clamp the color value to the range [0, 15]</span>
- <span style="color: #cba6f7;">IF</span> colorvalue < 0 <span style="color: #cba6f7;">THEN</span> colorvalue = 0
- <span style="color: #cba6f7;">IF</span> colorvalue > 15 <span style="color: #cba6f7;">THEN</span> colorvalue = 15
-
- <span style="color: #6c7086;">' </span><span style="color: #6c7086;">Set the pixel color at (xcoordinate, ycoordinate) with an offset to use the full 16-color palette</span>
- <span style="color: #f38ba8;">PSET</span> (xcoordinate, ycoordinate), colorvalue + 16
- <span style="color: #cba6f7;">NEXT</span> xcoordinate
-<span style="color: #cba6f7;">NEXT</span> ycoordinate
-
-<span style="color: #6c7086;">' </span><span style="color: #6c7086;">Wait for user key press</span>
-<span style="color: #cba6f7;">WHILE</span> <span style="color: #89b4fa;">INKEY$</span> = <span style="color: #a6e3a1;">""</span>: <span style="color: #cba6f7;">WEND</span>
-<span style="color: #f38ba8;">CLS</span>
-<span style="color: #cba6f7;">END</span>
+<pre class="src src-basic-qb45"><span style="color: #666677;">' </span><span style="color: #666677;">Program to render circular wave patterns.</span>
+<span style="color: #666677;">' </span><span style="color: #666677;">Algorithm was accidentally discovered while experimenting with sine function.</span>
+<span style="color: #666677;">'</span>
+<span style="color: #666677;">' </span><span style="color: #666677;">This program is free software: released under Creative Commons Zero (CC0) license</span>
+<span style="color: #666677;">' </span><span style="color: #666677;">by Svjatoslav Agejenko.</span>
+<span style="color: #666677;">' </span><span style="color: #666677;">Email: svjatoslav@svjatoslav.eu</span>
+<span style="color: #666677;">' </span><span style="color: #666677;">Homepage: http://www.svjatoslav.eu</span>
+<span style="color: #666677;">'</span>
+<span style="color: #666677;">' </span><span style="color: #666677;">Changelog:</span>
+<span style="color: #666677;">' </span><span style="color: #666677;">2003, Initial version</span>
+<span style="color: #666677;">' </span><span style="color: #666677;">2025, Improved program readability</span>
+
+<span style="color: #ee8899;">SCREEN</span> 13
+
+<span style="color: #666677;">' </span><span style="color: #666677;">Initialize the screen mode to 320x200 with 16 colors</span>
+
+<span style="color: #666677;">' </span><span style="color: #666677;">Outer loop for the vertical axis (y-coordinate)</span>
+<span style="color: #bb99ee;">FOR</span> ycoordinate = 1 <span style="color: #bb99ee;">TO</span> 199
+ <span style="color: #666677;">' </span><span style="color: #666677;">Inner loop for the horizontal axis (x-coordinate)</span>
+ <span style="color: #bb99ee;">FOR</span> xcoordinate = 1 <span style="color: #bb99ee;">TO</span> 319
+ <span style="color: #666677;">' </span><span style="color: #666677;">Calculate the sine value based on the squared distances from the origin</span>
+ colorvalue = <span style="color: #88aaee;">SIN</span>((xcoordinate ^ 2 + ycoordinate ^ 2) / 10) * 10
+
+ <span style="color: #666677;">' </span><span style="color: #666677;">Clamp the color value to the range [0, 15]</span>
+ <span style="color: #bb99ee;">IF</span> colorvalue < 0 <span style="color: #bb99ee;">THEN</span> colorvalue = 0
+ <span style="color: #bb99ee;">IF</span> colorvalue > 15 <span style="color: #bb99ee;">THEN</span> colorvalue = 15
+
+ <span style="color: #666677;">' </span><span style="color: #666677;">Set the pixel color at (xcoordinate, ycoordinate) with an offset to use the full 16-color palette</span>
+ <span style="color: #ee8899;">PSET</span> (xcoordinate, ycoordinate), colorvalue + 16
+ <span style="color: #bb99ee;">NEXT</span> xcoordinate
+<span style="color: #bb99ee;">NEXT</span> ycoordinate
+
+<span style="color: #666677;">' </span><span style="color: #666677;">Wait for user key press</span>
+<span style="color: #bb99ee;">WHILE</span> <span style="color: #88aaee;">INKEY$</span> = <span style="color: #99dd99;">""</span>: <span style="color: #bb99ee;">WEND</span>
+<span style="color: #ee8899;">CLS</span>
+<span style="color: #bb99ee;">END</span>
</pre>
</div>
</div>
</div>
-<div id="outline-container-org563db65" class="outline-2">
-<h2 id="org563db65"><span class="section-number-2">2.</span> Diamond square clouds</h2>
+<div id="outline-container-org6016d80" class="outline-2">
+<h2 id="org6016d80"><span class="section-number-2">2.</span> Diamond square clouds</h2>
<div class="outline-text-2" id="text-2">
<p>
This QBasic program demonstrates the Diamond-Square algorithm, a
</p>
<div class="org-src-container">
-<pre class="src src-basic-qb45"><span style="color: #cba6f7;">DECLARE</span> <span style="color: #cba6f7;">SUB</span> DrawPixels (x1 <span style="color: #cba6f7;">AS</span> <span style="color: #f9e2af;">INTEGER</span>, y1 <span style="color: #cba6f7;">AS</span> <span style="color: #f9e2af;">INTEGER</span>, s <span style="color: #cba6f7;">AS</span> <span style="color: #f9e2af;">INTEGER</span>)
-<span style="color: #6c7086;">' </span><span style="color: #6c7086;">Program to render cloud surface using diamond square algorithm.</span>
-<span style="color: #6c7086;">'</span>
-<span style="color: #6c7086;">' </span><span style="color: #6c7086;">This program is free software: released under Creative Commons Zero (CC0) license</span>
-<span style="color: #6c7086;">' </span><span style="color: #6c7086;">by Svjatoslav Agejenko.</span>
-<span style="color: #6c7086;">' </span><span style="color: #6c7086;">Email: svjatoslav@svjatoslav.eu</span>
-<span style="color: #6c7086;">' </span><span style="color: #6c7086;">Homepage: http://www.svjatoslav.eu</span>
-<span style="color: #6c7086;">'</span>
-<span style="color: #6c7086;">' </span><span style="color: #6c7086;">Changelog:</span>
-<span style="color: #6c7086;">' </span><span style="color: #6c7086;">2003.12, Initial version</span>
-<span style="color: #6c7086;">' </span><span style="color: #6c7086;">2024.08, Improved program readability</span>
-
-<span style="color: #cba6f7;">DECLARE</span> <span style="color: #cba6f7;">SUB</span> DrawBox (x1 <span style="color: #cba6f7;">AS</span> <span style="color: #f9e2af;">INTEGER</span>, y1 <span style="color: #cba6f7;">AS</span> <span style="color: #f9e2af;">INTEGER</span>, s <span style="color: #cba6f7;">AS</span> <span style="color: #f9e2af;">INTEGER</span>)
-<span style="color: #cba6f7;">DECLARE</span> <span style="color: #cba6f7;">SUB</span> SetPalette ()
-<span style="color: #cba6f7;">DECLARE</span> <span style="color: #cba6f7;">SUB</span> InitializeProgram ()
-<span style="color: #cba6f7;">DEFINT</span> A-Z
+<pre class="src src-basic-qb45"><span style="color: #bb99ee;">DECLARE</span> <span style="color: #bb99ee;">SUB</span> DrawPixels (x1 <span style="color: #bb99ee;">AS</span> <span style="color: #eeddaa;">INTEGER</span>, y1 <span style="color: #bb99ee;">AS</span> <span style="color: #eeddaa;">INTEGER</span>, s <span style="color: #bb99ee;">AS</span> <span style="color: #eeddaa;">INTEGER</span>)
+<span style="color: #666677;">' </span><span style="color: #666677;">Program to render cloud surface using diamond square algorithm.</span>
+<span style="color: #666677;">'</span>
+<span style="color: #666677;">' </span><span style="color: #666677;">This program is free software: released under Creative Commons Zero (CC0) license</span>
+<span style="color: #666677;">' </span><span style="color: #666677;">by Svjatoslav Agejenko.</span>
+<span style="color: #666677;">' </span><span style="color: #666677;">Email: svjatoslav@svjatoslav.eu</span>
+<span style="color: #666677;">' </span><span style="color: #666677;">Homepage: http://www.svjatoslav.eu</span>
+<span style="color: #666677;">'</span>
+<span style="color: #666677;">' </span><span style="color: #666677;">Changelog:</span>
+<span style="color: #666677;">' </span><span style="color: #666677;">2003.12, Initial version</span>
+<span style="color: #666677;">' </span><span style="color: #666677;">2024.08, Improved program readability</span>
+
+<span style="color: #bb99ee;">DECLARE</span> <span style="color: #bb99ee;">SUB</span> DrawBox (x1 <span style="color: #bb99ee;">AS</span> <span style="color: #eeddaa;">INTEGER</span>, y1 <span style="color: #bb99ee;">AS</span> <span style="color: #eeddaa;">INTEGER</span>, s <span style="color: #bb99ee;">AS</span> <span style="color: #eeddaa;">INTEGER</span>)
+<span style="color: #bb99ee;">DECLARE</span> <span style="color: #bb99ee;">SUB</span> SetPalette ()
+<span style="color: #bb99ee;">DECLARE</span> <span style="color: #bb99ee;">SUB</span> InitializeProgram ()
+<span style="color: #bb99ee;">DEFINT</span> A-Z
InitializeProgram
-<span style="color: #cba6f7;">DIM</span> <span style="color: #f38ba8;">SHARED</span> maxLightness <span style="color: #cba6f7;">AS</span> <span style="color: #f9e2af;">INTEGER</span>
+<span style="color: #bb99ee;">DIM</span> <span style="color: #ee8899;">SHARED</span> maxLightness <span style="color: #bb99ee;">AS</span> <span style="color: #eeddaa;">INTEGER</span>
maxLightness = 127
-<span style="color: #cba6f7;">DIM</span> scale <span style="color: #cba6f7;">AS</span> <span style="color: #f9e2af;">INTEGER</span>
+<span style="color: #bb99ee;">DIM</span> scale <span style="color: #bb99ee;">AS</span> <span style="color: #eeddaa;">INTEGER</span>
scale = 2 ^ 8
-<span style="color: #fab387;">1</span> :
+<span style="color: #eeaa77;">1</span> :
scale = scale \ 2
x1 = (319 \ scale) - 1
y1 = (199 \ scale) - 1
-<span style="color: #cba6f7;">FOR</span> y = 0 <span style="color: #cba6f7;">TO</span> y1
- <span style="color: #cba6f7;">FOR</span> x = 0 <span style="color: #cba6f7;">TO</span> x1
+<span style="color: #bb99ee;">FOR</span> y = 0 <span style="color: #bb99ee;">TO</span> y1
+ <span style="color: #bb99ee;">FOR</span> x = 0 <span style="color: #bb99ee;">TO</span> x1
DrawPixels x * scale, y * scale, scale
- <span style="color: #cba6f7;">NEXT</span> x
-<span style="color: #cba6f7;">NEXT</span> y
+ <span style="color: #bb99ee;">NEXT</span> x
+<span style="color: #bb99ee;">NEXT</span> y
-<span style="color: #cba6f7;">IF</span> scale > 2 <span style="color: #cba6f7;">THEN</span> <span style="color: #cba6f7;">GOTO</span> <span style="color: #fab387;">1</span>
-WAITa$ = <span style="color: #89b4fa;">INPUT$</span>(1)
+<span style="color: #bb99ee;">IF</span> scale > 2 <span style="color: #bb99ee;">THEN</span> <span style="color: #bb99ee;">GOTO</span> <span style="color: #eeaa77;">1</span>
+WAITa$ = <span style="color: #88aaee;">INPUT$</span>(1)
-<span style="color: #cba6f7;">SUB</span> DrawPixels (x1 <span style="color: #cba6f7;">AS</span> <span style="color: #f9e2af;">INTEGER</span>, y1 <span style="color: #cba6f7;">AS</span> <span style="color: #f9e2af;">INTEGER</span>, s <span style="color: #cba6f7;">AS</span> <span style="color: #f9e2af;">INTEGER</span>)
- <span style="color: #6c7086;">' </span><span style="color: #6c7086;">Get the lightness values for the corners of the box</span>
- c1 = <span style="color: #89b4fa;">POINT</span>(x1, y1)
- c2 = <span style="color: #89b4fa;">POINT</span>(x1 + s, y1)
- c3 = <span style="color: #89b4fa;">POINT</span>(x1, y1 + s)
- c4 = <span style="color: #89b4fa;">POINT</span>(x1 + s, y1 + s)
+<span style="color: #bb99ee;">SUB</span> DrawPixels (x1 <span style="color: #bb99ee;">AS</span> <span style="color: #eeddaa;">INTEGER</span>, y1 <span style="color: #bb99ee;">AS</span> <span style="color: #eeddaa;">INTEGER</span>, s <span style="color: #bb99ee;">AS</span> <span style="color: #eeddaa;">INTEGER</span>)
+ <span style="color: #666677;">' </span><span style="color: #666677;">Get the lightness values for the corners of the box</span>
+ c1 = <span style="color: #88aaee;">POINT</span>(x1, y1)
+ c2 = <span style="color: #88aaee;">POINT</span>(x1 + s, y1)
+ c3 = <span style="color: #88aaee;">POINT</span>(x1, y1 + s)
+ c4 = <span style="color: #88aaee;">POINT</span>(x1 + s, y1 + s)
- <span style="color: #6c7086;">' </span><span style="color: #6c7086;">Calculate the midpoint lightness values</span>
+ <span style="color: #666677;">' </span><span style="color: #666677;">Calculate the midpoint lightness values</span>
sp = s \ 2
k = s * 2
kp = k / 2
- cc2 = ((c1 + c2) / 2) + (<span style="color: #89b4fa;">RND</span> * k) - kp
- <span style="color: #cba6f7;">IF</span> cc2 > maxLightness <span style="color: #cba6f7;">THEN</span> cc2 = maxLightness
- <span style="color: #cba6f7;">IF</span> cc2 < 0 <span style="color: #cba6f7;">THEN</span> cc2 = 0
-
- cc3 = ((c1 + c3) / 2) + (<span style="color: #89b4fa;">RND</span> * k) - kp
- <span style="color: #cba6f7;">IF</span> cc3 > maxLightness <span style="color: #cba6f7;">THEN</span> cc3 = maxLightness
- <span style="color: #cba6f7;">IF</span> cc3 < 0 <span style="color: #cba6f7;">THEN</span> cc3 = 0
-
- cc4 = ((c2 + c4) / 2) + (<span style="color: #89b4fa;">RND</span> * k) - kp
- <span style="color: #cba6f7;">IF</span> cc4 > maxLightness <span style="color: #cba6f7;">THEN</span> cc4 = maxLightness
- <span style="color: #cba6f7;">IF</span> cc4 < 0 <span style="color: #cba6f7;">THEN</span> cc4 = 0
-
- cc5 = ((c3 + c4) / 2) + (<span style="color: #89b4fa;">RND</span> * k) - kp
- <span style="color: #cba6f7;">IF</span> cc5 > maxLightness <span style="color: #cba6f7;">THEN</span> cc5 = maxLightness
- <span style="color: #cba6f7;">IF</span> cc5 < 0 <span style="color: #cba6f7;">THEN</span> cc5 = 0
-
- <span style="color: #6c7086;">' </span><span style="color: #6c7086;">Calculate the central lightness value</span>
- cc1 = ((cc2 + cc3 + cc4 + cc5) / 4) + (<span style="color: #89b4fa;">RND</span> * k) - kp
- <span style="color: #cba6f7;">IF</span> cc1 > maxLightness <span style="color: #cba6f7;">THEN</span> cc1 = maxLightness
- <span style="color: #cba6f7;">IF</span> cc1 < 0 <span style="color: #cba6f7;">THEN</span> cc1 = 0
-
- <span style="color: #6c7086;">' </span><span style="color: #6c7086;">Set the calculated lightness values for the box</span>
- <span style="color: #f38ba8;">PSET</span> (x1 + sp, y1 + sp), cc1
- <span style="color: #f38ba8;">PSET</span> (x1 + sp, y1), cc2
- <span style="color: #f38ba8;">PSET</span> (x1, y1 + sp), cc3
- <span style="color: #f38ba8;">PSET</span> (x1 + s, y1 + sp), cc4
- <span style="color: #f38ba8;">PSET</span> (x1 + sp, y1 + s), cc5
-<span style="color: #cba6f7;">END</span> <span style="color: #cba6f7;">SUB</span>
-
-<span style="color: #cba6f7;">SUB</span> InitializeProgram
- <span style="color: #6c7086;">' </span><span style="color: #6c7086;">Set the screen mode and initialize the color palette</span>
- <span style="color: #f38ba8;">SCREEN</span> 13
+ cc2 = ((c1 + c2) / 2) + (<span style="color: #88aaee;">RND</span> * k) - kp
+ <span style="color: #bb99ee;">IF</span> cc2 > maxLightness <span style="color: #bb99ee;">THEN</span> cc2 = maxLightness
+ <span style="color: #bb99ee;">IF</span> cc2 < 0 <span style="color: #bb99ee;">THEN</span> cc2 = 0
+
+ cc3 = ((c1 + c3) / 2) + (<span style="color: #88aaee;">RND</span> * k) - kp
+ <span style="color: #bb99ee;">IF</span> cc3 > maxLightness <span style="color: #bb99ee;">THEN</span> cc3 = maxLightness
+ <span style="color: #bb99ee;">IF</span> cc3 < 0 <span style="color: #bb99ee;">THEN</span> cc3 = 0
+
+ cc4 = ((c2 + c4) / 2) + (<span style="color: #88aaee;">RND</span> * k) - kp
+ <span style="color: #bb99ee;">IF</span> cc4 > maxLightness <span style="color: #bb99ee;">THEN</span> cc4 = maxLightness
+ <span style="color: #bb99ee;">IF</span> cc4 < 0 <span style="color: #bb99ee;">THEN</span> cc4 = 0
+
+ cc5 = ((c3 + c4) / 2) + (<span style="color: #88aaee;">RND</span> * k) - kp
+ <span style="color: #bb99ee;">IF</span> cc5 > maxLightness <span style="color: #bb99ee;">THEN</span> cc5 = maxLightness
+ <span style="color: #bb99ee;">IF</span> cc5 < 0 <span style="color: #bb99ee;">THEN</span> cc5 = 0
+
+ <span style="color: #666677;">' </span><span style="color: #666677;">Calculate the central lightness value</span>
+ cc1 = ((cc2 + cc3 + cc4 + cc5) / 4) + (<span style="color: #88aaee;">RND</span> * k) - kp
+ <span style="color: #bb99ee;">IF</span> cc1 > maxLightness <span style="color: #bb99ee;">THEN</span> cc1 = maxLightness
+ <span style="color: #bb99ee;">IF</span> cc1 < 0 <span style="color: #bb99ee;">THEN</span> cc1 = 0
+
+ <span style="color: #666677;">' </span><span style="color: #666677;">Set the calculated lightness values for the box</span>
+ <span style="color: #ee8899;">PSET</span> (x1 + sp, y1 + sp), cc1
+ <span style="color: #ee8899;">PSET</span> (x1 + sp, y1), cc2
+ <span style="color: #ee8899;">PSET</span> (x1, y1 + sp), cc3
+ <span style="color: #ee8899;">PSET</span> (x1 + s, y1 + sp), cc4
+ <span style="color: #ee8899;">PSET</span> (x1 + sp, y1 + s), cc5
+<span style="color: #bb99ee;">END</span> <span style="color: #bb99ee;">SUB</span>
+
+<span style="color: #bb99ee;">SUB</span> InitializeProgram
+ <span style="color: #666677;">' </span><span style="color: #666677;">Set the screen mode and initialize the color palette</span>
+ <span style="color: #ee8899;">SCREEN</span> 13
SetPalette
- <span style="color: #f38ba8;">RANDOMIZE</span> <span style="color: #f38ba8;">TIMER</span>
-<span style="color: #cba6f7;">END</span> <span style="color: #cba6f7;">SUB</span>
-
-<span style="color: #cba6f7;">SUB</span> SetPalette
- <span style="color: #6c7086;">' </span><span style="color: #6c7086;">Set the color palette for lightness levels</span>
- <span style="color: #cba6f7;">FOR</span> a = 0 <span style="color: #cba6f7;">TO</span> 255
- <span style="color: #f38ba8;">OUT</span> &H3C8, a
- <span style="color: #f38ba8;">OUT</span> &H3C9, a / 4
- <span style="color: #f38ba8;">OUT</span> &H3C9, a / 3
- <span style="color: #f38ba8;">OUT</span> &H3C9, a / 2.3
- <span style="color: #cba6f7;">NEXT</span> a
-<span style="color: #cba6f7;">END</span> <span style="color: #cba6f7;">SUB</span>
+ <span style="color: #ee8899;">RANDOMIZE</span> <span style="color: #ee8899;">TIMER</span>
+<span style="color: #bb99ee;">END</span> <span style="color: #bb99ee;">SUB</span>
+
+<span style="color: #bb99ee;">SUB</span> SetPalette
+ <span style="color: #666677;">' </span><span style="color: #666677;">Set the color palette for lightness levels</span>
+ <span style="color: #bb99ee;">FOR</span> a = 0 <span style="color: #bb99ee;">TO</span> 255
+ <span style="color: #ee8899;">OUT</span> &H3C8, a
+ <span style="color: #ee8899;">OUT</span> &H3C9, a / 4
+ <span style="color: #ee8899;">OUT</span> &H3C9, a / 3
+ <span style="color: #ee8899;">OUT</span> &H3C9, a / 2.3
+ <span style="color: #bb99ee;">NEXT</span> a
+<span style="color: #bb99ee;">END</span> <span style="color: #bb99ee;">SUB</span>
</pre>
</div>
</div>
</div>
-<div id="outline-container-orgd785dc2" class="outline-2">
-<h2 id="orgd785dc2"><span class="section-number-2">3.</span> Old paper</h2>
+<div id="outline-container-orgd87ac34" class="outline-2">
+<h2 id="orgd87ac34"><span class="section-number-2">3.</span> Old paper</h2>
<div class="outline-text-2" id="text-3">
<p>
This QBasic program generates a procedural texture that simulates the
</p>
<div class="org-src-container">
-<pre class="src src-basic-qb45"><span style="color: #6c7086;">' </span><span style="color: #6c7086;">Program to render surface resembling old paper.</span>
-<span style="color: #6c7086;">'</span>
-<span style="color: #6c7086;">' </span><span style="color: #6c7086;">This program is free software: released under Creative Commons Zero (CC0) license</span>
-<span style="color: #6c7086;">' </span><span style="color: #6c7086;">by Svjatoslav Agejenko.</span>
-<span style="color: #6c7086;">' </span><span style="color: #6c7086;">Email: svjatoslav@svjatoslav.eu</span>
-<span style="color: #6c7086;">' </span><span style="color: #6c7086;">Homepage: http://www.svjatoslav.eu</span>
-<span style="color: #6c7086;">'</span>
-<span style="color: #6c7086;">' </span><span style="color: #6c7086;">Changelog:</span>
-<span style="color: #6c7086;">' </span><span style="color: #6c7086;">2003, Initial version</span>
-<span style="color: #6c7086;">' </span><span style="color: #6c7086;">2025, Improved program readability</span>
-
-<span style="color: #cba6f7;">DEFINT</span> A-Z
-<span style="color: #f38ba8;">SCREEN</span> 13
-<span style="color: #f38ba8;">RANDOMIZE</span> <span style="color: #f38ba8;">TIMER</span>
-
-<span style="color: #6c7086;">' </span><span style="color: #6c7086;">Initialize the color palette to grayscale. Each color index from 0 to 63 has R, G, B values equal to the index,</span>
-<span style="color: #6c7086;">' </span><span style="color: #6c7086;">creating a smooth grayscale gradient for the 256-color mode.</span>
-<span style="color: #cba6f7;">FOR</span> paletteIndex = 0 <span style="color: #cba6f7;">TO</span> 63
- <span style="color: #f38ba8;">OUT</span> &H3C8, paletteIndex
- <span style="color: #f38ba8;">OUT</span> &H3C9, paletteIndex <span style="color: #6c7086;">' </span><span style="color: #6c7086;">Set red component</span>
- <span style="color: #f38ba8;">OUT</span> &H3C9, paletteIndex <span style="color: #6c7086;">' </span><span style="color: #6c7086;">Set green component</span>
- <span style="color: #f38ba8;">OUT</span> &H3C9, paletteIndex <span style="color: #6c7086;">' </span><span style="color: #6c7086;">Set blue component</span>
-<span style="color: #cba6f7;">NEXT</span> paletteIndex
+<pre class="src src-basic-qb45"><span style="color: #666677;">' </span><span style="color: #666677;">Program to render surface resembling old paper.</span>
+<span style="color: #666677;">'</span>
+<span style="color: #666677;">' </span><span style="color: #666677;">This program is free software: released under Creative Commons Zero (CC0) license</span>
+<span style="color: #666677;">' </span><span style="color: #666677;">by Svjatoslav Agejenko.</span>
+<span style="color: #666677;">' </span><span style="color: #666677;">Email: svjatoslav@svjatoslav.eu</span>
+<span style="color: #666677;">' </span><span style="color: #666677;">Homepage: http://www.svjatoslav.eu</span>
+<span style="color: #666677;">'</span>
+<span style="color: #666677;">' </span><span style="color: #666677;">Changelog:</span>
+<span style="color: #666677;">' </span><span style="color: #666677;">2003, Initial version</span>
+<span style="color: #666677;">' </span><span style="color: #666677;">2025, Improved program readability</span>
+
+<span style="color: #bb99ee;">DEFINT</span> A-Z
+<span style="color: #ee8899;">SCREEN</span> 13
+<span style="color: #ee8899;">RANDOMIZE</span> <span style="color: #ee8899;">TIMER</span>
+
+<span style="color: #666677;">' </span><span style="color: #666677;">Initialize the color palette to grayscale. Each color index from 0 to 63 has R, G, B values equal to the index,</span>
+<span style="color: #666677;">' </span><span style="color: #666677;">creating a smooth grayscale gradient for the 256-color mode.</span>
+<span style="color: #bb99ee;">FOR</span> paletteIndex = 0 <span style="color: #bb99ee;">TO</span> 63
+ <span style="color: #ee8899;">OUT</span> &H3C8, paletteIndex
+ <span style="color: #ee8899;">OUT</span> &H3C9, paletteIndex <span style="color: #666677;">' </span><span style="color: #666677;">Set red component</span>
+ <span style="color: #ee8899;">OUT</span> &H3C9, paletteIndex <span style="color: #666677;">' </span><span style="color: #666677;">Set green component</span>
+ <span style="color: #ee8899;">OUT</span> &H3C9, paletteIndex <span style="color: #666677;">' </span><span style="color: #666677;">Set blue component</span>
+<span style="color: #bb99ee;">NEXT</span> paletteIndex
noiseOffset = 0
-<span style="color: #6c7086;">' </span><span style="color: #6c7086;">Generate a paper-like surface by averaging the color of the pixel above with some randomness.</span>
-<span style="color: #6c7086;">' </span><span style="color: #6c7086;">This creates a procedural texture that mimics the roughness of paper.</span>
-<span style="color: #cba6f7;">FOR</span> y = 1 <span style="color: #cba6f7;">TO</span> 190
- <span style="color: #cba6f7;">FOR</span> x = 1 <span style="color: #cba6f7;">TO</span> 310
+<span style="color: #666677;">' </span><span style="color: #666677;">Generate a paper-like surface by averaging the color of the pixel above with some randomness.</span>
+<span style="color: #666677;">' </span><span style="color: #666677;">This creates a procedural texture that mimics the roughness of paper.</span>
+<span style="color: #bb99ee;">FOR</span> y = 1 <span style="color: #bb99ee;">TO</span> 190
+ <span style="color: #bb99ee;">FOR</span> x = 1 <span style="color: #bb99ee;">TO</span> 310
stepCounter = stepCounter + 1
- <span style="color: #6c7086;">' </span><span style="color: #6c7086;">Approximately every 10 steps, introduce a new random noise offset to create variation in the pattern.</span>
- <span style="color: #6c7086;">' </span><span style="color: #6c7086;">This prevents the surface from becoming too uniform.</span>
- <span style="color: #cba6f7;">IF</span> stepCounter > 10 <span style="color: #cba6f7;">THEN</span>
- noiseOffset = <span style="color: #89b4fa;">RND</span> * currentColor / 20
- stepCounter = stepCounter - (<span style="color: #89b4fa;">RND</span> * 20 + 10)
- <span style="color: #cba6f7;">END</span> <span style="color: #cba6f7;">IF</span>
+ <span style="color: #666677;">' </span><span style="color: #666677;">Approximately every 10 steps, introduce a new random noise offset to create variation in the pattern.</span>
+ <span style="color: #666677;">' </span><span style="color: #666677;">This prevents the surface from becoming too uniform.</span>
+ <span style="color: #bb99ee;">IF</span> stepCounter > 10 <span style="color: #bb99ee;">THEN</span>
+ noiseOffset = <span style="color: #88aaee;">RND</span> * currentColor / 20
+ stepCounter = stepCounter - (<span style="color: #88aaee;">RND</span> * 20 + 10)
+ <span style="color: #bb99ee;">END</span> <span style="color: #bb99ee;">IF</span>
- <span style="color: #6c7086;">' </span><span style="color: #6c7086;">Get the color of the pixel directly above the current position.</span>
- topColor = <span style="color: #89b4fa;">POINT</span>(x, y - 1)
+ <span style="color: #666677;">' </span><span style="color: #666677;">Get the color of the pixel directly above the current position.</span>
+ topColor = <span style="color: #88aaee;">POINT</span>(x, y - 1)
- <span style="color: #6c7086;">' </span><span style="color: #6c7086;">Calculate the current color as the average of the top color and the previous current color,</span>
- <span style="color: #6c7086;">' </span><span style="color: #6c7086;">plus a small random noise and minus the noise offset. This creates a smooth transition with</span>
- <span style="color: #6c7086;">' </span><span style="color: #6c7086;">controlled randomness.</span>
- currentColor = (topColor + currentColor) \ 2 + ((<span style="color: #89b4fa;">RND</span> * 2) - noiseOffset)
+ <span style="color: #666677;">' </span><span style="color: #666677;">Calculate the current color as the average of the top color and the previous current color,</span>
+ <span style="color: #666677;">' </span><span style="color: #666677;">plus a small random noise and minus the noise offset. This creates a smooth transition with</span>
+ <span style="color: #666677;">' </span><span style="color: #666677;">controlled randomness.</span>
+ currentColor = (topColor + currentColor) \ 2 + ((<span style="color: #88aaee;">RND</span> * 2) - noiseOffset)
- <span style="color: #6c7086;">' </span><span style="color: #6c7086;">Clamp the color value to stay within the valid palette range (0 to 63).</span>
- <span style="color: #cba6f7;">IF</span> currentColor < 0 <span style="color: #cba6f7;">THEN</span> currentColor = 0
- <span style="color: #cba6f7;">IF</span> currentColor > 63 <span style="color: #cba6f7;">THEN</span> currentColor = 63
+ <span style="color: #666677;">' </span><span style="color: #666677;">Clamp the color value to stay within the valid palette range (0 to 63).</span>
+ <span style="color: #bb99ee;">IF</span> currentColor < 0 <span style="color: #bb99ee;">THEN</span> currentColor = 0
+ <span style="color: #bb99ee;">IF</span> currentColor > 63 <span style="color: #bb99ee;">THEN</span> currentColor = 63
- <span style="color: #6c7086;">' </span><span style="color: #6c7086;">Plot the current pixel at (x-1, y) using the calculated color.</span>
- <span style="color: #f38ba8;">PSET</span> (x - 1, y), currentColor
- <span style="color: #cba6f7;">NEXT</span> x
+ <span style="color: #666677;">' </span><span style="color: #666677;">Plot the current pixel at (x-1, y) using the calculated color.</span>
+ <span style="color: #ee8899;">PSET</span> (x - 1, y), currentColor
+ <span style="color: #bb99ee;">NEXT</span> x
- <span style="color: #6c7086;">' </span><span style="color: #6c7086;">Set the starting color for the next row to the last calculated color of the current row.</span>
- <span style="color: #6c7086;">' </span><span style="color: #6c7086;">This ensures continuity between rows.</span>
- <span style="color: #f38ba8;">PSET</span> (0, y + 1), currentColor
-<span style="color: #cba6f7;">NEXT</span> y
+ <span style="color: #666677;">' </span><span style="color: #666677;">Set the starting color for the next row to the last calculated color of the current row.</span>
+ <span style="color: #666677;">' </span><span style="color: #666677;">This ensures continuity between rows.</span>
+ <span style="color: #ee8899;">PSET</span> (0, y + 1), currentColor
+<span style="color: #bb99ee;">NEXT</span> y
-<span style="color: #6c7086;">' </span><span style="color: #6c7086;">Wait for a single key press before exiting the program.</span>
-inputKey$ = <span style="color: #89b4fa;">INPUT$</span>(1)
+<span style="color: #666677;">' </span><span style="color: #666677;">Wait for a single key press before exiting the program.</span>
+inputKey$ = <span style="color: #88aaee;">INPUT$</span>(1)
-<span style="color: #cba6f7;">SYSTEM</span>
+<span style="color: #bb99ee;">SYSTEM</span>
</pre>
</div>
</div>
</div>
-<div id="outline-container-orgdcf6428" class="outline-2">
-<h2 id="orgdcf6428"><span class="section-number-2">4.</span> Wood</h2>
+<div id="outline-container-orgeee80bf" class="outline-2">
+<h2 id="orgeee80bf"><span class="section-number-2">4.</span> Wood</h2>
<div class="outline-text-2" id="text-4">
<p>
This QBasic program creates a visually appealing simulation of a wood
</p>
<div class="org-src-container">
-<pre class="src src-basic-qb45"><span style="color: #6c7086;">' </span><span style="color: #6c7086;">Program to render surface resembling wood.</span>
-<span style="color: #6c7086;">'</span>
-<span style="color: #6c7086;">' </span><span style="color: #6c7086;">This program is free software: released under Creative Commons Zero (CC0) license</span>
-<span style="color: #6c7086;">' </span><span style="color: #6c7086;">by Svjatoslav Agejenko.</span>
-<span style="color: #6c7086;">' </span><span style="color: #6c7086;">Email: svjatoslav@svjatoslav.eu</span>
-<span style="color: #6c7086;">' </span><span style="color: #6c7086;">Homepage: http://www.svjatoslav.eu</span>
-<span style="color: #6c7086;">'</span>
-<span style="color: #6c7086;">' </span><span style="color: #6c7086;">Changelog:</span>
-<span style="color: #6c7086;">' </span><span style="color: #6c7086;">2003.12, Initial version</span>
-<span style="color: #6c7086;">' </span><span style="color: #6c7086;">2024 - 2025, Improved program readability</span>
-
-<span style="color: #cba6f7;">DECLARE</span> <span style="color: #cba6f7;">SUB</span> DrawWoodSurface (woodX%, woodY%)
-<span style="color: #cba6f7;">DECLARE</span> <span style="color: #cba6f7;">SUB</span> DrawPaper (xPos%, y1Pos%)
-<span style="color: #cba6f7;">DEFINT</span> A-Z
-<span style="color: #f38ba8;">SCREEN</span> 12
-<span style="color: #f38ba8;">RANDOMIZE</span> <span style="color: #f38ba8;">TIMER</span>
-
-<span style="color: #6c7086;">' </span><span style="color: #6c7086;">Set palette colors</span>
-<span style="color: #cba6f7;">FOR</span> colorIndex = 0 <span style="color: #cba6f7;">TO</span> 15
- <span style="color: #f38ba8;">OUT</span> &H3C8, colorIndex
- <span style="color: #f38ba8;">OUT</span> &H3C9, colorIndex * 4
- <span style="color: #f38ba8;">OUT</span> &H3C9, colorIndex * 3
- <span style="color: #f38ba8;">OUT</span> &H3C9, colorIndex * 0
-<span style="color: #cba6f7;">NEXT</span> colorIndex
-
-<span style="color: #6c7086;">' </span><span style="color: #6c7086;">Main loop to draw wood at random positions</span>
-<span style="color: #fab387;">100</span>:
-woodX = <span style="color: #89b4fa;">RND</span> * 400 + 200
-woodY = <span style="color: #89b4fa;">RND</span> * 100 + 200
-<span style="color: #cba6f7;">CALL</span> DrawWoodSurface(woodX, woodY)
-<span style="color: #cba6f7;">GOTO</span> <span style="color: #fab387;">100</span>
-
-<span style="color: #6c7086;">' </span><span style="color: #6c7086;">Wait for user input to exit</span>
-exitKey$ = <span style="color: #89b4fa;">INPUT$</span>(1)
-
-<span style="color: #cba6f7;">SUB</span> DrawWoodSurface (woodX, woodY)
- <span style="color: #cba6f7;">DIM</span> lowerY <span style="color: #cba6f7;">AS</span> <span style="color: #f9e2af;">INTEGER</span>
- <span style="color: #cba6f7;">DIM</span> phaseOffset <span style="color: #cba6f7;">AS</span> <span style="color: #f9e2af;">INTEGER</span>
- <span style="color: #cba6f7;">DIM</span> xStepCounter <span style="color: #cba6f7;">AS</span> <span style="color: #f9e2af;">INTEGER</span>
- <span style="color: #cba6f7;">DIM</span> randomOffset <span style="color: #cba6f7;">AS</span> <span style="color: #f9e2af;">INTEGER</span>
- <span style="color: #cba6f7;">DIM</span> newColor <span style="color: #cba6f7;">AS</span> <span style="color: #f9e2af;">INTEGER</span>
- <span style="color: #cba6f7;">DIM</span> upperColor <span style="color: #cba6f7;">AS</span> <span style="color: #f9e2af;">INTEGER</span>
- <span style="color: #cba6f7;">DIM</span> currentColor <span style="color: #cba6f7;">AS</span> <span style="color: #f9e2af;">INTEGER</span>
-
- <span style="color: #6c7086;">' </span><span style="color: #6c7086;">Draw the outline of the wood</span>
+<pre class="src src-basic-qb45"><span style="color: #666677;">' </span><span style="color: #666677;">Program to render surface resembling wood.</span>
+<span style="color: #666677;">'</span>
+<span style="color: #666677;">' </span><span style="color: #666677;">This program is free software: released under Creative Commons Zero (CC0) license</span>
+<span style="color: #666677;">' </span><span style="color: #666677;">by Svjatoslav Agejenko.</span>
+<span style="color: #666677;">' </span><span style="color: #666677;">Email: svjatoslav@svjatoslav.eu</span>
+<span style="color: #666677;">' </span><span style="color: #666677;">Homepage: http://www.svjatoslav.eu</span>
+<span style="color: #666677;">'</span>
+<span style="color: #666677;">' </span><span style="color: #666677;">Changelog:</span>
+<span style="color: #666677;">' </span><span style="color: #666677;">2003.12, Initial version</span>
+<span style="color: #666677;">' </span><span style="color: #666677;">2024 - 2025, Improved program readability</span>
+
+<span style="color: #bb99ee;">DECLARE</span> <span style="color: #bb99ee;">SUB</span> DrawWoodSurface (woodX%, woodY%)
+<span style="color: #bb99ee;">DECLARE</span> <span style="color: #bb99ee;">SUB</span> DrawPaper (xPos%, y1Pos%)
+<span style="color: #bb99ee;">DEFINT</span> A-Z
+<span style="color: #ee8899;">SCREEN</span> 12
+<span style="color: #ee8899;">RANDOMIZE</span> <span style="color: #ee8899;">TIMER</span>
+
+<span style="color: #666677;">' </span><span style="color: #666677;">Set palette colors</span>
+<span style="color: #bb99ee;">FOR</span> colorIndex = 0 <span style="color: #bb99ee;">TO</span> 15
+ <span style="color: #ee8899;">OUT</span> &H3C8, colorIndex
+ <span style="color: #ee8899;">OUT</span> &H3C9, colorIndex * 4
+ <span style="color: #ee8899;">OUT</span> &H3C9, colorIndex * 3
+ <span style="color: #ee8899;">OUT</span> &H3C9, colorIndex * 0
+<span style="color: #bb99ee;">NEXT</span> colorIndex
+
+<span style="color: #666677;">' </span><span style="color: #666677;">Main loop to draw wood at random positions</span>
+<span style="color: #eeaa77;">100</span>:
+woodX = <span style="color: #88aaee;">RND</span> * 400 + 200
+woodY = <span style="color: #88aaee;">RND</span> * 100 + 200
+<span style="color: #bb99ee;">CALL</span> DrawWoodSurface(woodX, woodY)
+<span style="color: #bb99ee;">GOTO</span> <span style="color: #eeaa77;">100</span>
+
+<span style="color: #666677;">' </span><span style="color: #666677;">Wait for user input to exit</span>
+exitKey$ = <span style="color: #88aaee;">INPUT$</span>(1)
+
+<span style="color: #bb99ee;">SUB</span> DrawWoodSurface (woodX, woodY)
+ <span style="color: #bb99ee;">DIM</span> lowerY <span style="color: #bb99ee;">AS</span> <span style="color: #eeddaa;">INTEGER</span>
+ <span style="color: #bb99ee;">DIM</span> phaseOffset <span style="color: #bb99ee;">AS</span> <span style="color: #eeddaa;">INTEGER</span>
+ <span style="color: #bb99ee;">DIM</span> xStepCounter <span style="color: #bb99ee;">AS</span> <span style="color: #eeddaa;">INTEGER</span>
+ <span style="color: #bb99ee;">DIM</span> randomOffset <span style="color: #bb99ee;">AS</span> <span style="color: #eeddaa;">INTEGER</span>
+ <span style="color: #bb99ee;">DIM</span> newColor <span style="color: #bb99ee;">AS</span> <span style="color: #eeddaa;">INTEGER</span>
+ <span style="color: #bb99ee;">DIM</span> upperColor <span style="color: #bb99ee;">AS</span> <span style="color: #eeddaa;">INTEGER</span>
+ <span style="color: #bb99ee;">DIM</span> currentColor <span style="color: #bb99ee;">AS</span> <span style="color: #eeddaa;">INTEGER</span>
+
+ <span style="color: #666677;">' </span><span style="color: #666677;">Draw the outline of the wood</span>
lowerY = woodY + 1
- <span style="color: #f38ba8;">LINE</span> (0, 0)-(woodX, woodY), 0, BF <span style="color: #6c7086;">' </span><span style="color: #6c7086;">Black background</span>
- <span style="color: #f38ba8;">LINE</span> (5, 5)-(woodX - 5, lowerY - 5), 8, BF <span style="color: #6c7086;">' </span><span style="color: #6c7086;">Gray wood outline</span>
- <span style="color: #f38ba8;">LINE</span> (10, 10)-(woodX - 10, lowerY - 10), 15, BF <span style="color: #6c7086;">' </span><span style="color: #6c7086;">White inner highlight</span>
+ <span style="color: #ee8899;">LINE</span> (0, 0)-(woodX, woodY), 0, BF <span style="color: #666677;">' </span><span style="color: #666677;">Black background</span>
+ <span style="color: #ee8899;">LINE</span> (5, 5)-(woodX - 5, lowerY - 5), 8, BF <span style="color: #666677;">' </span><span style="color: #666677;">Gray wood outline</span>
+ <span style="color: #ee8899;">LINE</span> (10, 10)-(woodX - 10, lowerY - 10), 15, BF <span style="color: #666677;">' </span><span style="color: #666677;">White inner highlight</span>
- <span style="color: #6c7086;">' </span><span style="color: #6c7086;">Initialize random phase offset for color variation</span>
- phaseOffset = <span style="color: #89b4fa;">RND</span> * 300
+ <span style="color: #666677;">' </span><span style="color: #666677;">Initialize random phase offset for color variation</span>
+ phaseOffset = <span style="color: #88aaee;">RND</span> * 300
- <span style="color: #6c7086;">' </span><span style="color: #6c7086;">Draw the wood texture</span>
- <span style="color: #cba6f7;">FOR</span> y = woodY - 1 <span style="color: #cba6f7;">TO</span> 0 <span style="color: #cba6f7;">STEP</span> -1
- <span style="color: #cba6f7;">FOR</span> x = woodX - 1 <span style="color: #cba6f7;">TO</span> 0 <span style="color: #cba6f7;">STEP</span> -1
+ <span style="color: #666677;">' </span><span style="color: #666677;">Draw the wood texture</span>
+ <span style="color: #bb99ee;">FOR</span> y = woodY - 1 <span style="color: #bb99ee;">TO</span> 0 <span style="color: #bb99ee;">STEP</span> -1
+ <span style="color: #bb99ee;">FOR</span> x = woodX - 1 <span style="color: #bb99ee;">TO</span> 0 <span style="color: #bb99ee;">STEP</span> -1
xStepCounter = xStepCounter + 1
- <span style="color: #cba6f7;">IF</span> xStepCounter > woodX <span style="color: #cba6f7;">THEN</span>
- randomOffset = <span style="color: #89b4fa;">RND</span> * 13 <span style="color: #6c7086;">' </span><span style="color: #6c7086;">Small random noise for texture variation</span>
- xStepCounter = <span style="color: #89b4fa;">SIN</span>((y + phaseOffset) / 100) * woodX <span style="color: #6c7086;">' </span><span style="color: #6c7086;">Sine wave to create wavy grain pattern</span>
- <span style="color: #cba6f7;">END</span> <span style="color: #cba6f7;">IF</span>
- upperColor = <span style="color: #89b4fa;">POINT</span>(x, y + 1) <span style="color: #6c7086;">' </span><span style="color: #6c7086;">Get color from upper pixel</span>
- currentColor = <span style="color: #89b4fa;">POINT</span>(x, y) <span style="color: #6c7086;">' </span><span style="color: #6c7086;">Get color from current pixel</span>
- newColor = (upperColor * 2 + currentColor + newColor * 3 + randomOffset) / 7 + <span style="color: #89b4fa;">RND</span> * 1
-
- <span style="color: #6c7086;">' </span><span style="color: #6c7086;">Ensure color value is within the valid range (0-15)</span>
- <span style="color: #cba6f7;">IF</span> newColor < 0 <span style="color: #cba6f7;">THEN</span> newColor = 0
- <span style="color: #cba6f7;">IF</span> newColor > 15 <span style="color: #cba6f7;">THEN</span> newColor = 15
-
- <span style="color: #6c7086;">' </span><span style="color: #6c7086;">Set the pixel color for the wood texture</span>
- <span style="color: #f38ba8;">PSET</span> (x + 1, y), newColor
- <span style="color: #cba6f7;">NEXT</span> x
- <span style="color: #cba6f7;">NEXT</span> y
-
-<span style="color: #cba6f7;">END</span> <span style="color: #cba6f7;">SUB</span>
+ <span style="color: #bb99ee;">IF</span> xStepCounter > woodX <span style="color: #bb99ee;">THEN</span>
+ randomOffset = <span style="color: #88aaee;">RND</span> * 13 <span style="color: #666677;">' </span><span style="color: #666677;">Small random noise for texture variation</span>
+ xStepCounter = <span style="color: #88aaee;">SIN</span>((y + phaseOffset) / 100) * woodX <span style="color: #666677;">' </span><span style="color: #666677;">Sine wave to create wavy grain pattern</span>
+ <span style="color: #bb99ee;">END</span> <span style="color: #bb99ee;">IF</span>
+ upperColor = <span style="color: #88aaee;">POINT</span>(x, y + 1) <span style="color: #666677;">' </span><span style="color: #666677;">Get color from upper pixel</span>
+ currentColor = <span style="color: #88aaee;">POINT</span>(x, y) <span style="color: #666677;">' </span><span style="color: #666677;">Get color from current pixel</span>
+ newColor = (upperColor * 2 + currentColor + newColor * 3 + randomOffset) / 7 + <span style="color: #88aaee;">RND</span> * 1
+
+ <span style="color: #666677;">' </span><span style="color: #666677;">Ensure color value is within the valid range (0-15)</span>
+ <span style="color: #bb99ee;">IF</span> newColor < 0 <span style="color: #bb99ee;">THEN</span> newColor = 0
+ <span style="color: #bb99ee;">IF</span> newColor > 15 <span style="color: #bb99ee;">THEN</span> newColor = 15
+
+ <span style="color: #666677;">' </span><span style="color: #666677;">Set the pixel color for the wood texture</span>
+ <span style="color: #ee8899;">PSET</span> (x + 1, y), newColor
+ <span style="color: #bb99ee;">NEXT</span> x
+ <span style="color: #bb99ee;">NEXT</span> y
+
+<span style="color: #bb99ee;">END</span> <span style="color: #bb99ee;">SUB</span>
</pre>
</div>
</div>
</div>
-<div id="outline-container-org95d07e4" class="outline-2">
-<h2 id="org95d07e4"><span class="section-number-2">5.</span> Yellow flame</h2>
+<div id="outline-container-orgaf13ba6" class="outline-2">
+<h2 id="orgaf13ba6"><span class="section-number-2">5.</span> Yellow flame</h2>
<div class="outline-text-2" id="text-5">
<p>
"Yellow Flame" is a visually captivating program written in QBasic
</p>
<div class="org-src-container">
-<pre class="src src-basic-qb45"><span style="color: #6c7086;">' </span><span style="color: #6c7086;">Yellow flame.</span>
-<span style="color: #6c7086;">'</span>
-<span style="color: #6c7086;">' </span><span style="color: #6c7086;">This program is free software: released under Creative Commons Zero (CC0) license</span>
-<span style="color: #6c7086;">' </span><span style="color: #6c7086;">by Svjatoslav Agejenko.</span>
-<span style="color: #6c7086;">' </span><span style="color: #6c7086;">Email: svjatoslav@svjatoslav.eu</span>
-<span style="color: #6c7086;">' </span><span style="color: #6c7086;">Homepage: http://www.svjatoslav.eu</span>
-<span style="color: #6c7086;">'</span>
-<span style="color: #6c7086;">' </span><span style="color: #6c7086;">Changelog:</span>
-<span style="color: #6c7086;">' </span><span style="color: #6c7086;">2003.12, Initial version</span>
-<span style="color: #6c7086;">' </span><span style="color: #6c7086;">2024.08, Improved program readability</span>
-
-
-<span style="color: #cba6f7;">DEFINT</span> A-Z <span style="color: #6c7086;">' </span><span style="color: #6c7086;">Define all variables as integers</span>
-<span style="color: #f38ba8;">SCREEN</span> 13 <span style="color: #6c7086;">' </span><span style="color: #6c7086;">Set graphics mode to 320x200 with 256 colors</span>
-<span style="color: #f38ba8;">RANDOMIZE</span> <span style="color: #f38ba8;">TIMER</span> <span style="color: #6c7086;">' </span><span style="color: #6c7086;">Seed the random number generator</span>
-
-<span style="color: #6c7086;">' </span><span style="color: #6c7086;">Initialize palette registers with sine wave colors</span>
-<span style="color: #cba6f7;">FOR</span> paletteIndex = 0 <span style="color: #cba6f7;">TO</span> 255
- <span style="color: #f38ba8;">OUT</span> &H3C8, paletteIndex
- <span style="color: #f38ba8;">OUT</span> &H3C9, <span style="color: #89b4fa;">INT</span>(<span style="color: #89b4fa;">SIN</span>(paletteIndex / 21) * 30 + 30)
- <span style="color: #f38ba8;">OUT</span> &H3C9, <span style="color: #89b4fa;">INT</span>(<span style="color: #89b4fa;">SIN</span>(paletteIndex / 34) * 30 + 30)
- <span style="color: #f38ba8;">OUT</span> &H3C9, <span style="color: #89b4fa;">INT</span>(<span style="color: #89b4fa;">SIN</span>(paletteIndex / 10) * 30 + 30)
-<span style="color: #cba6f7;">NEXT</span> paletteIndex
-
-<span style="color: #6c7086;">' </span><span style="color: #6c7086;">Generate the surface pattern</span>
-<span style="color: #cba6f7;">FOR</span> y = 1 <span style="color: #cba6f7;">TO</span> 199
- <span style="color: #cba6f7;">FOR</span> x = 1 <span style="color: #cba6f7;">TO</span> 319
- prevPixel = <span style="color: #89b4fa;">POINT</span>(x, y - 1)
- leftPixel = <span style="color: #89b4fa;">POINT</span>(x - 1, y)
- diagPixel = <span style="color: #89b4fa;">POINT</span>(x - 1, y - 1)
- left2Pixel = <span style="color: #89b4fa;">POINT</span>(x - 2, y)
-
- <span style="color: #6c7086;">' </span><span style="color: #6c7086;">Calculate the average of surrounding pixels and add some randomness</span>
- newColor = (prevPixel + leftPixel + diagPixel + left2Pixel) \ 4 + (<span style="color: #89b4fa;">RND</span> * 5 - 2)
-
- <span style="color: #6c7086;">' </span><span style="color: #6c7086;">Clamp the color value within the valid range</span>
- <span style="color: #cba6f7;">IF</span> newColor < 0 <span style="color: #cba6f7;">THEN</span> newColor = 0
- <span style="color: #cba6f7;">IF</span> newColor > 63 <span style="color: #cba6f7;">THEN</span> newColor = 63
-
- <span style="color: #6c7086;">' </span><span style="color: #6c7086;">Set the pixel with the calculated color</span>
- <span style="color: #f38ba8;">PSET</span> (x, y), newColor
- <span style="color: #cba6f7;">NEXT</span> x
-<span style="color: #cba6f7;">NEXT</span> y
-
-<span style="color: #6c7086;">' </span><span style="color: #6c7086;">Wait for user input to exit</span>
-userInput$ = <span style="color: #89b4fa;">INPUT$</span>(1)
+<pre class="src src-basic-qb45"><span style="color: #666677;">' </span><span style="color: #666677;">Yellow flame.</span>
+<span style="color: #666677;">'</span>
+<span style="color: #666677;">' </span><span style="color: #666677;">This program is free software: released under Creative Commons Zero (CC0) license</span>
+<span style="color: #666677;">' </span><span style="color: #666677;">by Svjatoslav Agejenko.</span>
+<span style="color: #666677;">' </span><span style="color: #666677;">Email: svjatoslav@svjatoslav.eu</span>
+<span style="color: #666677;">' </span><span style="color: #666677;">Homepage: http://www.svjatoslav.eu</span>
+<span style="color: #666677;">'</span>
+<span style="color: #666677;">' </span><span style="color: #666677;">Changelog:</span>
+<span style="color: #666677;">' </span><span style="color: #666677;">2003.12, Initial version</span>
+<span style="color: #666677;">' </span><span style="color: #666677;">2024.08, Improved program readability</span>
+
+
+<span style="color: #bb99ee;">DEFINT</span> A-Z <span style="color: #666677;">' </span><span style="color: #666677;">Define all variables as integers</span>
+<span style="color: #ee8899;">SCREEN</span> 13 <span style="color: #666677;">' </span><span style="color: #666677;">Set graphics mode to 320x200 with 256 colors</span>
+<span style="color: #ee8899;">RANDOMIZE</span> <span style="color: #ee8899;">TIMER</span> <span style="color: #666677;">' </span><span style="color: #666677;">Seed the random number generator</span>
+
+<span style="color: #666677;">' </span><span style="color: #666677;">Initialize palette registers with sine wave colors</span>
+<span style="color: #bb99ee;">FOR</span> paletteIndex = 0 <span style="color: #bb99ee;">TO</span> 255
+ <span style="color: #ee8899;">OUT</span> &H3C8, paletteIndex
+ <span style="color: #ee8899;">OUT</span> &H3C9, <span style="color: #88aaee;">INT</span>(<span style="color: #88aaee;">SIN</span>(paletteIndex / 21) * 30 + 30)
+ <span style="color: #ee8899;">OUT</span> &H3C9, <span style="color: #88aaee;">INT</span>(<span style="color: #88aaee;">SIN</span>(paletteIndex / 34) * 30 + 30)
+ <span style="color: #ee8899;">OUT</span> &H3C9, <span style="color: #88aaee;">INT</span>(<span style="color: #88aaee;">SIN</span>(paletteIndex / 10) * 30 + 30)
+<span style="color: #bb99ee;">NEXT</span> paletteIndex
+
+<span style="color: #666677;">' </span><span style="color: #666677;">Generate the surface pattern</span>
+<span style="color: #bb99ee;">FOR</span> y = 1 <span style="color: #bb99ee;">TO</span> 199
+ <span style="color: #bb99ee;">FOR</span> x = 1 <span style="color: #bb99ee;">TO</span> 319
+ prevPixel = <span style="color: #88aaee;">POINT</span>(x, y - 1)
+ leftPixel = <span style="color: #88aaee;">POINT</span>(x - 1, y)
+ diagPixel = <span style="color: #88aaee;">POINT</span>(x - 1, y - 1)
+ left2Pixel = <span style="color: #88aaee;">POINT</span>(x - 2, y)
+
+ <span style="color: #666677;">' </span><span style="color: #666677;">Calculate the average of surrounding pixels and add some randomness</span>
+ newColor = (prevPixel + leftPixel + diagPixel + left2Pixel) \ 4 + (<span style="color: #88aaee;">RND</span> * 5 - 2)
+
+ <span style="color: #666677;">' </span><span style="color: #666677;">Clamp the color value within the valid range</span>
+ <span style="color: #bb99ee;">IF</span> newColor < 0 <span style="color: #bb99ee;">THEN</span> newColor = 0
+ <span style="color: #bb99ee;">IF</span> newColor > 63 <span style="color: #bb99ee;">THEN</span> newColor = 63
+
+ <span style="color: #666677;">' </span><span style="color: #666677;">Set the pixel with the calculated color</span>
+ <span style="color: #ee8899;">PSET</span> (x, y), newColor
+ <span style="color: #bb99ee;">NEXT</span> x
+<span style="color: #bb99ee;">NEXT</span> y
+
+<span style="color: #666677;">' </span><span style="color: #666677;">Wait for user input to exit</span>
+userInput$ = <span style="color: #88aaee;">INPUT$</span>(1)
</pre>
</div>
</div>
</div>
</div>
<div id="postamble" class="status">
-<p class="date">Created: 2025-07-29 ti 02:13</p>
+<p class="date">Created: 2025-07-29 ti 03:07</p>
<p class="validation"><a href="https://validator.w3.org/check?uri=referer">Validate</a></p>
</div>
</body>
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<head>
-<!-- 2025-07-29 ti 00:25 -->
+<!-- 2025-07-29 ti 03:08 -->
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>3D Synthezier</title>
<h2>Table of Contents</h2>
<div id="text-table-of-contents" role="doc-toc">
<ul>
-<li><a href="#orgd62bb9f">1. Operating principle</a>
+<li><a href="#org1c25da5">1. Operating principle</a>
<ul>
-<li><a href="#org9578171">1.1. Rectangular city</a></li>
-<li><a href="#orgfd1e490">1.2. Hexagonal city</a></li>
+<li><a href="#org151ba78">1.1. Rectangular city</a></li>
+<li><a href="#org5a5682d">1.2. Hexagonal city</a></li>
</ul>
</li>
-<li><a href="#org5e2e1e0">2. Scene description language</a>
+<li><a href="#orgbf4536a">2. Scene description language</a>
<ul>
-<li><a href="#orge0b4b15">2.1. here</a></li>
-<li><a href="#org600b9d0">2.2. p</a></li>
-<li><a href="#org2db4d77">2.3. f</a></li>
-<li><a href="#org72c5573">2.4. warn</a></li>
-<li><a href="#org2396707">2.5. end</a></li>
-<li><a href="#orga14a0e7">2.6. mtl</a></li>
-<li><a href="#org255bfd9">2.7. mtlrnd</a></li>
-<li><a href="#org2cbc4f4">2.8. obj</a></li>
-<li><a href="#orga6c738d">2.9. rnd</a></li>
-<li><a href="#orgdc3ba6f">2.10. #</a></li>
-<li><a href="#orga2221a3">2.11. out</a></li>
-<li><a href="#org52c3a71">2.12. set</a></li>
-<li><a href="#org51240ca">2.13. variables usage</a></li>
-<li><a href="#orgd14d063">2.14. cmp</a></li>
-<li><a href="#orgb5a7638">2.15. ?</a></li>
-<li><a href="#orgbf3bead">2.16. dum</a></li>
+<li><a href="#org9ce3ce1">2.1. here</a></li>
+<li><a href="#org20a3f10">2.2. p</a></li>
+<li><a href="#org8539fb7">2.3. f</a></li>
+<li><a href="#orgcb0bb43">2.4. warn</a></li>
+<li><a href="#org67c4bf9">2.5. end</a></li>
+<li><a href="#orgac7f6a8">2.6. mtl</a></li>
+<li><a href="#orgf12132b">2.7. mtlrnd</a></li>
+<li><a href="#org97b7b25">2.8. obj</a></li>
+<li><a href="#org8c1f01d">2.9. rnd</a></li>
+<li><a href="#org80b1639">2.10. #</a></li>
+<li><a href="#org3e586a1">2.11. out</a></li>
+<li><a href="#org7ed97e5">2.12. set</a></li>
+<li><a href="#orgcee2857">2.13. variables usage</a></li>
+<li><a href="#org0ddfdf3">2.14. cmp</a></li>
+<li><a href="#org59d6e09">2.15. ?</a></li>
+<li><a href="#org23411ad">2.16. dum</a></li>
</ul>
</li>
-<li><a href="#org45936ae">3. Installation</a>
+<li><a href="#org3bba71b">3. Installation</a>
<ul>
-<li><a href="#org9091711">3.1. System requirements</a></li>
-<li><a href="#org747bfb4">3.2. Directory layout</a></li>
+<li><a href="#org908b6f7">3.1. System requirements</a></li>
+<li><a href="#orgc19c8f1">3.2. Directory layout</a></li>
</ul>
</li>
-<li><a href="#org4b64769">4. Usage</a></li>
+<li><a href="#org35f0d1e">4. Usage</a></li>
</ul>
</div>
</div>
</style>
-<div id="outline-container-orgd62bb9f" class="outline-2">
-<h2 id="orgd62bb9f"><span class="section-number-2">1.</span> Operating principle</h2>
+<div id="outline-container-org1c25da5" class="outline-2">
+<h2 id="org1c25da5"><span class="section-number-2">1.</span> Operating principle</h2>
<div class="outline-text-2" id="text-1">
<p>
Parses scene definition language and creates 3D world based on
</p>
</div>
-<div id="outline-container-org9578171" class="outline-3">
-<h3 id="org9578171"><span class="section-number-3">1.1.</span> Rectangular city</h3>
+<div id="outline-container-org151ba78" class="outline-3">
+<h3 id="org151ba78"><span class="section-number-3">1.1.</span> Rectangular city</h3>
<div class="outline-text-3" id="text-1-1">
-<div id="orgca7bec9" class="figure">
+<div id="org90c6e66" class="figure">
<p><img src="rectangular city, 1.jpeg" alt="rectangular city, 1.jpeg" class="responsive-img" />
</p>
</div>
-<div id="orga8407e2" class="figure">
+<div id="orgc1cff23" class="figure">
<p><img src="rectangular city, 2.jpeg" alt="rectangular city, 2.jpeg" class="responsive-img" />
</p>
</div>
-<div id="org75af1d1" class="figure">
+<div id="orgefc4043" class="figure">
<p><img src="rectangular city, 3.jpeg" alt="rectangular city, 3.jpeg" class="responsive-img" />
</p>
</div>
</div>
</div>
-<div id="outline-container-orgfd1e490" class="outline-3">
-<h3 id="orgfd1e490"><span class="section-number-3">1.2.</span> Hexagonal city</h3>
+<div id="outline-container-org5a5682d" class="outline-3">
+<h3 id="org5a5682d"><span class="section-number-3">1.2.</span> Hexagonal city</h3>
<div class="outline-text-3" id="text-1-2">
-<div id="orga9cdd42" class="figure">
+<div id="orgeac3b31" class="figure">
<p><img src="hexagonal city, 1.jpeg" alt="hexagonal city, 1.jpeg" class="responsive-img" />
</p>
</div>
-<div id="org8a32cb5" class="figure">
+<div id="org0bb6894" class="figure">
<p><img src="hexagonal city, 2.jpeg" alt="hexagonal city, 2.jpeg" class="responsive-img" />
</p>
</div>
-<div id="orgf7fce13" class="figure">
+<div id="org722f7cd" class="figure">
<p><img src="hexagonal city, 3.jpeg" alt="hexagonal city, 3.jpeg" class="responsive-img" />
</p>
</div>
</div>
</div>
</div>
-<div id="outline-container-org5e2e1e0" class="outline-2">
-<h2 id="org5e2e1e0"><span class="section-number-2">2.</span> Scene description language</h2>
+<div id="outline-container-orgbf4536a" class="outline-2">
+<h2 id="orgbf4536a"><span class="section-number-2">2.</span> Scene description language</h2>
<div class="outline-text-2" id="text-2">
<p>
See also examples.
</p>
</div>
-<div id="outline-container-orge0b4b15" class="outline-3">
-<h3 id="orge0b4b15"><span class="section-number-3">2.1.</span> here</h3>
+<div id="outline-container-org9ce3ce1" class="outline-3">
+<h3 id="org9ce3ce1"><span class="section-number-3">2.1.</span> here</h3>
<div class="outline-text-3" id="text-2-1">
<pre class="example">
here
</p>
</div>
</div>
-<div id="outline-container-org600b9d0" class="outline-3">
-<h3 id="org600b9d0"><span class="section-number-3">2.2.</span> p</h3>
+<div id="outline-container-org20a3f10" class="outline-3">
+<h3 id="org20a3f10"><span class="section-number-3">2.2.</span> p</h3>
<div class="outline-text-3" id="text-2-2">
<pre class="example">
p x y z
</p>
</div>
</div>
-<div id="outline-container-org2db4d77" class="outline-3">
-<h3 id="org2db4d77"><span class="section-number-3">2.3.</span> f</h3>
+<div id="outline-container-org8539fb7" class="outline-3">
+<h3 id="org8539fb7"><span class="section-number-3">2.3.</span> f</h3>
<div class="outline-text-3" id="text-2-3">
<pre class="example">
f p1 p2 p3 p4
</p>
</div>
</div>
-<div id="outline-container-org72c5573" class="outline-3">
-<h3 id="org72c5573"><span class="section-number-3">2.4.</span> warn</h3>
+<div id="outline-container-orgcb0bb43" class="outline-3">
+<h3 id="orgcb0bb43"><span class="section-number-3">2.4.</span> warn</h3>
<div class="outline-text-3" id="text-2-4">
<pre class="example">
warn <message>
</p>
</div>
</div>
-<div id="outline-container-org2396707" class="outline-3">
-<h3 id="org2396707"><span class="section-number-3">2.5.</span> end</h3>
+<div id="outline-container-org67c4bf9" class="outline-3">
+<h3 id="org67c4bf9"><span class="section-number-3">2.5.</span> end</h3>
<div class="outline-text-3" id="text-2-5">
<pre class="example">
end
</p>
</div>
</div>
-<div id="outline-container-orga14a0e7" class="outline-3">
-<h3 id="orga14a0e7"><span class="section-number-3">2.6.</span> mtl</h3>
+<div id="outline-container-orgac7f6a8" class="outline-3">
+<h3 id="orgac7f6a8"><span class="section-number-3">2.6.</span> mtl</h3>
<div class="outline-text-3" id="text-2-6">
<pre class="example">
mtl material
</p>
</div>
</div>
-<div id="outline-container-org255bfd9" class="outline-3">
-<h3 id="org255bfd9"><span class="section-number-3">2.7.</span> mtlrnd</h3>
+<div id="outline-container-orgf12132b" class="outline-3">
+<h3 id="orgf12132b"><span class="section-number-3">2.7.</span> mtlrnd</h3>
<div class="outline-text-3" id="text-2-7">
<pre class="example">
mtlrnd material ...
</p>
</div>
</div>
-<div id="outline-container-org2cbc4f4" class="outline-3">
-<h3 id="org2cbc4f4"><span class="section-number-3">2.8.</span> obj</h3>
+<div id="outline-container-org97b7b25" class="outline-3">
+<h3 id="org97b7b25"><span class="section-number-3">2.8.</span> obj</h3>
<div class="outline-text-3" id="text-2-8">
<pre class="example">
obj object xz45 xy20 x+3 y*2
</p>
-<div id="org1c3cdb9" class="figure">
+<div id="orgec9566e" class="figure">
<p><img src="rotation.png" alt="rotation.png" />
</p>
</div>
</div>
</div>
-<div id="outline-container-orga6c738d" class="outline-3">
-<h3 id="orga6c738d"><span class="section-number-3">2.9.</span> rnd</h3>
+<div id="outline-container-org8c1f01d" class="outline-3">
+<h3 id="org8c1f01d"><span class="section-number-3">2.9.</span> rnd</h3>
<div class="outline-text-3" id="text-2-9">
<pre class="example">
rnd p^1^2^3 p^7^2^1
</p>
</div>
</div>
-<div id="outline-container-orgdc3ba6f" class="outline-3">
-<h3 id="orgdc3ba6f"><span class="section-number-3">2.10.</span> #</h3>
+<div id="outline-container-org80b1639" class="outline-3">
+<h3 id="org80b1639"><span class="section-number-3">2.10.</span> #</h3>
<div class="outline-text-3" id="text-2-10">
<pre class="example">
# whatever text
</p>
</div>
</div>
-<div id="outline-container-orga2221a3" class="outline-3">
-<h3 id="orga2221a3"><span class="section-number-3">2.11.</span> out</h3>
+<div id="outline-container-org3e586a1" class="outline-3">
+<h3 id="org3e586a1"><span class="section-number-3">2.11.</span> out</h3>
<div class="outline-text-3" id="text-2-11">
<pre class="example">
out file
</p>
</div>
</div>
-<div id="outline-container-org52c3a71" class="outline-3">
-<h3 id="org52c3a71"><span class="section-number-3">2.12.</span> set</h3>
+<div id="outline-container-org7ed97e5" class="outline-3">
+<h3 id="org7ed97e5"><span class="section-number-3">2.12.</span> set</h3>
<div class="outline-text-3" id="text-2-12">
<pre class="example">
set variable contents
</p>
</div>
</div>
-<div id="outline-container-org51240ca" class="outline-3">
-<h3 id="org51240ca"><span class="section-number-3">2.13.</span> variables usage</h3>
+<div id="outline-container-orgcee2857" class="outline-3">
+<h3 id="orgcee2857"><span class="section-number-3">2.13.</span> variables usage</h3>
<div class="outline-text-3" id="text-2-13">
<pre class="example">
anycommand %1 anything
</p>
</div>
</div>
-<div id="outline-container-orgd14d063" class="outline-3">
-<h3 id="orgd14d063"><span class="section-number-3">2.14.</span> cmp</h3>
+<div id="outline-container-org0ddfdf3" class="outline-3">
+<h3 id="org0ddfdf3"><span class="section-number-3">2.14.</span> cmp</h3>
<div class="outline-text-3" id="text-2-14">
<pre class="example">
cmp flag string1 string2
</p>
</div>
</div>
-<div id="outline-container-orgb5a7638" class="outline-3">
-<h3 id="orgb5a7638"><span class="section-number-3">2.15.</span> ?</h3>
+<div id="outline-container-org59d6e09" class="outline-3">
+<h3 id="org59d6e09"><span class="section-number-3">2.15.</span> ?</h3>
<div class="outline-text-3" id="text-2-15">
<pre class="example">
?flag anycommand
</p>
</div>
</div>
-<div id="outline-container-orgbf3bead" class="outline-3">
-<h3 id="orgbf3bead"><span class="section-number-3">2.16.</span> dum</h3>
+<div id="outline-container-org23411ad" class="outline-3">
+<h3 id="org23411ad"><span class="section-number-3">2.16.</span> dum</h3>
<div class="outline-text-3" id="text-2-16">
<pre class="example">
dum
</div>
</div>
-<div id="outline-container-org45936ae" class="outline-2">
-<h2 id="org45936ae"><span class="section-number-2">3.</span> Installation</h2>
+<div id="outline-container-org3bba71b" class="outline-2">
+<h2 id="org3bba71b"><span class="section-number-2">3.</span> Installation</h2>
<div class="outline-text-2" id="text-3">
<p>
Edit <b>bin/3dparse.bas</b> file and update include path in there.
</p>
</div>
-<div id="outline-container-org9091711" class="outline-3">
-<h3 id="org9091711"><span class="section-number-3">3.1.</span> System requirements</h3>
+<div id="outline-container-org908b6f7" class="outline-3">
+<h3 id="org908b6f7"><span class="section-number-3">3.1.</span> System requirements</h3>
<div class="outline-text-3" id="text-3-1">
<table border="2" cellspacing="0" cellpadding="6" rules="groups" frame="hsides">
</div>
</div>
-<div id="outline-container-org747bfb4" class="outline-3">
-<h3 id="org747bfb4"><span class="section-number-3">3.2.</span> Directory layout</h3>
+<div id="outline-container-orgc19c8f1" class="outline-3">
+<h3 id="orgc19c8f1"><span class="section-number-3">3.2.</span> Directory layout</h3>
<div class="outline-text-3" id="text-3-2">
<dl class="org-dl">
<dt>bin</dt><dd><dl class="org-dl">
</div>
</div>
-<div id="outline-container-org4b64769" class="outline-2">
-<h2 id="org4b64769"><span class="section-number-2">4.</span> Usage</h2>
+<div id="outline-container-org35f0d1e" class="outline-2">
+<h2 id="org35f0d1e"><span class="section-number-2">4.</span> Usage</h2>
<div class="outline-text-2" id="text-4">
<p>
Make sure you have QB binaries in your PATH. Execute
</div>
</div>
<div id="postamble" class="status">
-<p class="date">Created: 2025-07-29 ti 00:25</p>
+<p class="date">Created: 2025-07-29 ti 03:08</p>
<p class="validation"><a href="https://validator.w3.org/check?uri=referer">Validate</a></p>
</div>
</body>
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<head>
-<!-- 2025-07-29 ti 00:25 -->
+<!-- 2025-07-29 ti 03:08 -->
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>Miscellaneous 3D graphics demos</title>
<h2>Table of Contents</h2>
<div id="text-table-of-contents" role="doc-toc">
<ul>
-<li><a href="#org99dc38f">1. Rotating exclamation mark</a></li>
-<li><a href="#org5031e81">2. 3D bouncing ball</a></li>
-<li><a href="#orgb787adc">3. 3D text in a room</a></li>
-<li><a href="#orge396a31">4. 3D bouncing cubes on grid floor</a></li>
-<li><a href="#org0dfb16f">5. Matrix math for rotation in 3D space</a></li>
-<li><a href="#org428e42e">6. Maze explorer</a></li>
-<li><a href="#org0f0266a">7. Tank animation</a></li>
-<li><a href="#orgdd0d5ff">8. Tiled room</a></li>
+<li><a href="#orgb924a7a">1. Rotating exclamation mark</a></li>
+<li><a href="#org936edd2">2. 3D bouncing ball</a></li>
+<li><a href="#org28da862">3. 3D text in a room</a></li>
+<li><a href="#orgdf64df9">4. 3D bouncing cubes on grid floor</a></li>
+<li><a href="#orga5d0129">5. Matrix math for rotation in 3D space</a></li>
+<li><a href="#org9c405ef">6. Maze explorer</a></li>
+<li><a href="#org2131992">7. Tank animation</a></li>
+<li><a href="#orga1c32d2">8. Tiled room</a></li>
</ul>
</div>
</div>
}
</style>
-<div id="outline-container-org99dc38f" class="outline-2">
-<h2 id="org99dc38f"><span class="section-number-2">1.</span> Rotating exclamation mark</h2>
+<div id="outline-container-orgb924a7a" class="outline-2">
+<h2 id="orgb924a7a"><span class="section-number-2">1.</span> Rotating exclamation mark</h2>
<div class="outline-text-2" id="text-1">
<p>
Wireframe 3D model of a rotating exclamation mark.
</div>
</div>
-
-<div id="outline-container-org5031e81" class="outline-2">
-<h2 id="org5031e81"><span class="section-number-2">2.</span> 3D bouncing ball</h2>
+<div id="outline-container-org936edd2" class="outline-2">
+<h2 id="org936edd2"><span class="section-number-2">2.</span> 3D bouncing ball</h2>
<div class="outline-text-2" id="text-2">
<p>
-3D ball made of point cloud.
+This QBasic program creates a visually engaging 3D animation of a
+point-cloud ball bouncing around the screen. The program is an example
+of early computer graphics techniques.
</p>
<div class="flex-center">
</div>
</div>
-
-<div id="outline-container-orgb787adc" class="outline-2">
-<h2 id="orgb787adc"><span class="section-number-2">3.</span> 3D text in a room</h2>
+<div id="outline-container-org28da862" class="outline-2">
+<h2 id="org28da862"><span class="section-number-2">3.</span> 3D text in a room</h2>
<div class="outline-text-2" id="text-3">
<p>
Wireframe 3D text hanging in a wireframe 3D room. User can look and
</div>
</div>
-
-<div id="outline-container-orge396a31" class="outline-2">
-<h2 id="orge396a31"><span class="section-number-2">4.</span> 3D bouncing cubes on grid floor</h2>
+<div id="outline-container-orgdf64df9" class="outline-2">
+<h2 id="orgdf64df9"><span class="section-number-2">4.</span> 3D bouncing cubes on grid floor</h2>
<div class="outline-text-2" id="text-4">
<p>
3D wireframe cubes bouncing on a grid floor, creating an immersive and
</div>
</div>
-
-<div id="outline-container-org0dfb16f" class="outline-2">
-<h2 id="org0dfb16f"><span class="section-number-2">5.</span> Matrix math for rotation in 3D space</h2>
+<div id="outline-container-orga5d0129" class="outline-2">
+<h2 id="orga5d0129"><span class="section-number-2">5.</span> Matrix math for rotation in 3D space</h2>
<div class="outline-text-2" id="text-5">
<p>
Instead of combining simple 2D rotors, pixels in this 3D space are
</div>
</div>
-
-<div id="outline-container-org428e42e" class="outline-2">
-<h2 id="org428e42e"><span class="section-number-2">6.</span> Maze explorer</h2>
+<div id="outline-container-org9c405ef" class="outline-2">
+<h2 id="org9c405ef"><span class="section-number-2">6.</span> Maze explorer</h2>
<div class="outline-text-2" id="text-6">
<p>
-TODO: add description
+The Evolving 3D Maze Explorer is a QBasic program that generates and
+navigates through a dynamically evolving 3D maze. This program is an
+excellent example of early 3D graphics programming and provides an
+interactive experience where users can explore a maze that grows and
+changes as they navigate through it.
</p>
-<div id="orgb0cf3ab" class="figure">
+<div id="org18556fb" class="figure">
<p><a href="Maze%20explorer.bas" class="responsive-img"><img src="Maze%20explorer.png" alt="Maze%20explorer.png" class="responsive-img" /></a>
</p>
</div>
</div>
</div>
-<div id="outline-container-org0f0266a" class="outline-2">
-<h2 id="org0f0266a"><span class="section-number-2">7.</span> Tank animation</h2>
+<div id="outline-container-org2131992" class="outline-2">
+<h2 id="org2131992"><span class="section-number-2">7.</span> Tank animation</h2>
<div class="outline-text-2" id="text-7">
<p>
Animated tank driving through the bridge back and forward. User can
</div>
</div>
-
-<div id="outline-container-orgdd0d5ff" class="outline-2">
-<h2 id="orgdd0d5ff"><span class="section-number-2">8.</span> Tiled room</h2>
+<div id="outline-container-orga1c32d2" class="outline-2">
+<h2 id="orga1c32d2"><span class="section-number-2">8.</span> Tiled room</h2>
<div class="outline-text-2" id="text-8">
<p>
Room with some tiles on the wall and on the floor. User can freely fly
</div>
</div>
<div id="postamble" class="status">
-<p class="date">Created: 2025-07-29 ti 00:25</p>
+<p class="date">Created: 2025-07-29 ti 03:08</p>
<p class="validation"><a href="https://validator.w3.org/check?uri=referer">Validate</a></p>
</div>
</body>
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<head>
-<!-- 2025-07-29 ti 00:25 -->
+<!-- 2025-07-29 ti 03:08 -->
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>Space themed 3D graphics</title>
<h2>Table of Contents</h2>
<div id="text-table-of-contents" role="doc-toc">
<ul>
-<li><a href="#org62db6cb">1. Galaxy explorer</a></li>
-<li><a href="#org9ea0324">2. Rocket simulator</a></li>
-<li><a href="#org16bf836">3. Stars</a></li>
-<li><a href="#orga3aeb9c">4. Universe explorer</a></li>
+<li><a href="#orga620c09">1. Galaxy explorer</a></li>
+<li><a href="#org6a18994">2. Rocket simulator</a></li>
+<li><a href="#org2a8c3d5">3. Stars</a></li>
+<li><a href="#orgee560d0">4. Universe explorer</a></li>
</ul>
</div>
</div>
}
</style>
-<div id="outline-container-org62db6cb" class="outline-2">
-<h2 id="org62db6cb"><span class="section-number-2">1.</span> Galaxy explorer</h2>
+<div id="outline-container-orga620c09" class="outline-2">
+<h2 id="orga620c09"><span class="section-number-2">1.</span> Galaxy explorer</h2>
<div class="outline-text-2" id="text-1">
<p>
-TODO: add description
+This QBasic program renders a navigable 3D point cloud galaxy,
+allowing users to explore a virtual galaxy using mouse or keyboard
+controls. The program creates a visually engaging simulation of a
+galaxy with stars distributed in a spiral pattern.
</p>
-<div id="org78f3755" class="figure">
+<div id="orgb61875a" class="figure">
<p><a href="Galaxy%20explorer.bas" class="responsive-img"><img src="Galaxy%20explorer.png" alt="Galaxy%20explorer.png" class="responsive-img" /></a>
</p>
</div>
</div>
</div>
-
-<div id="outline-container-org9ea0324" class="outline-2">
-<h2 id="org9ea0324"><span class="section-number-2">2.</span> Rocket simulator</h2>
+<div id="outline-container-org6a18994" class="outline-2">
+<h2 id="org6a18994"><span class="section-number-2">2.</span> Rocket simulator</h2>
<div class="outline-text-2" id="text-2">
<p>
-TODO: add description
+QBasic program that simulates the takeoff and flight of a rocket from
+the surface of a planet. This program provides a simple yet engaging
+3D visualization of a rocket's journey, allowing users to navigate and
+observe the rocket's trajectory from various angles.
</p>
<div class="flex-center">
</div>
</div>
-
-<div id="outline-container-org16bf836" class="outline-2">
-<h2 id="org16bf836"><span class="section-number-2">3.</span> Stars</h2>
+<div id="outline-container-org2a8c3d5" class="outline-2">
+<h2 id="org2a8c3d5"><span class="section-number-2">3.</span> Stars</h2>
<div class="outline-text-2" id="text-3">
<p>
-TODO: add description
+The 3D Starfield Simulation is a QBasic program that creates a
+visually captivating simulation of a starfield in three
+dimensions. This program is designed to render stars moving in space,
+giving the illusion of flying through a galaxy.
</p>
+<p>
+How the Program Works:
+</p>
+
+<dl class="org-dl">
+<dt>Camera Rotation</dt><dd>The camera's rotation is calculated to give a
+dynamic view of the starfield.</dd>
+<dt>Star Movement</dt><dd>Each star's position is updated to simulate
+movement through space. Stars that get too close to the viewer are
+repositioned to the far distance to create an infinite starfield
+effect.</dd>
+<dt>Projection</dt><dd>The 3D coordinates of each star are projected onto a
+2D screen using perspective projection, which scales the stars based
+on their distance from the viewer.</dd>
+<dt>Brightness and Color</dt><dd>The brightness of each star is adjusted
+based on its distance, with closer stars appearing brighter.</dd>
+</dl>
+
<div class="flex-center">
<video controls loop autoplay>
<source src="Stars.webm" type="video/webm">
</div>
</div>
-<div id="outline-container-orga3aeb9c" class="outline-2">
-<h2 id="orga3aeb9c"><span class="section-number-2">4.</span> Universe explorer</h2>
+<div id="outline-container-orgee560d0" class="outline-2">
+<h2 id="orgee560d0"><span class="section-number-2">4.</span> Universe explorer</h2>
<div class="outline-text-2" id="text-4">
<p>
-TODO: add description
+This QBasic program that simulates a navigable 3D universe. Users can
+freely fly through a dynamically generated universe composed of galaxy
+clusters, galaxies, and stars. The program employs a clever algorithm
+to manage the level of detail, dynamically increasing or decreasing
+the complexity of the universe regions based on the user's
+position. This ensures a reasonable quantity of stars is rendered at
+any given time, optimizing performance and visual experience.
</p>
+<p>
+What's in it for the Reader?
+</p>
+
+<dl class="org-dl">
+<dt>Algorithm Insight</dt><dd>The program provides a practical example of
+dynamic level-of-detail algorithms, which can be useful for anyone
+interested in computer graphics, game development, or simulation
+programming.</dd>
+
+<dt>3D Navigation</dt><dd>It demonstrates how to implement a 3D navigation
+system using basic input devices like a mouse and keyboard, offering
+insights into handling user inputs for movement and interaction in a
+3D space.</dd>
+
+<dt>Procedural Generation</dt><dd>The universe is procedurally generated,
+showcasing how to create complex structures like galaxies and star
+systems algorithmically.</dd>
+
+<dt>Performance Optimization</dt><dd>The program highlights techniques for
+optimizing performance in resource-intensive applications, such as
+limiting the number of rendered objects based on distance.</dd>
+</dl>
+
-<div id="org29b02e4" class="figure">
+<div id="org2d55013" class="figure">
<p><a href="Universe%20explorer/Universe%20explorer.bas" class="responsive-img"><img src="Universe%20explorer/1.png" alt="1.png" class="responsive-img" /></a>
</p>
</div>
-<div id="org84b010b" class="figure">
+<div id="org2003483" class="figure">
<p><a href="Universe%20explorer/Universe%20explorer.bas" class="responsive-img"><img src="Universe%20explorer/2.png" alt="2.png" class="responsive-img" /></a>
</p>
</div>
-<div id="org04a7c40" class="figure">
+<div id="orgc45e0da" class="figure">
<p><a href="Universe%20explorer/Universe%20explorer.bas" class="responsive-img"><img src="Universe%20explorer/3.png" alt="3.png" class="responsive-img" /></a>
</p>
</div>
</div>
</div>
<div id="postamble" class="status">
-<p class="date">Created: 2025-07-29 ti 00:25</p>
+<p class="date">Created: 2025-07-29 ti 03:08</p>
<p class="validation"><a href="https://validator.w3.org/check?uri=referer">Validate</a></p>
</div>
</body>
--- /dev/null
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
+"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
+<head>
+<!-- 2025-07-29 ti 03:29 -->
+<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
+<meta name="viewport" content="width=device-width, initial-scale=1" />
+<title>Plotting</title>
+<meta name="generator" content="Org Mode" />
+<style>
+ #content { max-width: 60em; margin: auto; }
+ .title { text-align: center;
+ margin-bottom: .2em; }
+ .subtitle { text-align: center;
+ font-size: medium;
+ font-weight: bold;
+ margin-top:0; }
+ .todo { font-family: monospace; color: red; }
+ .done { font-family: monospace; color: green; }
+ .priority { font-family: monospace; color: orange; }
+ .tag { background-color: #eee; font-family: monospace;
+ padding: 2px; font-size: 80%; font-weight: normal; }
+ .timestamp { color: #bebebe; }
+ .timestamp-kwd { color: #5f9ea0; }
+ .org-right { margin-left: auto; margin-right: 0px; text-align: right; }
+ .org-left { margin-left: 0px; margin-right: auto; text-align: left; }
+ .org-center { margin-left: auto; margin-right: auto; text-align: center; }
+ .underline { text-decoration: underline; }
+ #postamble p, #preamble p { font-size: 90%; margin: .2em; }
+ p.verse { margin-left: 3%; }
+ pre {
+ border: 1px solid #e6e6e6;
+ border-radius: 3px;
+ background-color: #f2f2f2;
+ padding: 8pt;
+ font-family: monospace;
+ overflow: auto;
+ margin: 1.2em;
+ }
+ pre.src {
+ position: relative;
+ overflow: auto;
+ }
+ pre.src:before {
+ display: none;
+ position: absolute;
+ top: -8px;
+ right: 12px;
+ padding: 3px;
+ color: #555;
+ background-color: #f2f2f299;
+ }
+ pre.src:hover:before { display: inline; margin-top: 14px;}
+ /* Languages per Org manual */
+ pre.src-asymptote:before { content: 'Asymptote'; }
+ pre.src-awk:before { content: 'Awk'; }
+ pre.src-authinfo::before { content: 'Authinfo'; }
+ pre.src-C:before { content: 'C'; }
+ /* pre.src-C++ doesn't work in CSS */
+ pre.src-clojure:before { content: 'Clojure'; }
+ pre.src-css:before { content: 'CSS'; }
+ pre.src-D:before { content: 'D'; }
+ pre.src-ditaa:before { content: 'ditaa'; }
+ pre.src-dot:before { content: 'Graphviz'; }
+ pre.src-calc:before { content: 'Emacs Calc'; }
+ pre.src-emacs-lisp:before { content: 'Emacs Lisp'; }
+ pre.src-fortran:before { content: 'Fortran'; }
+ pre.src-gnuplot:before { content: 'gnuplot'; }
+ pre.src-haskell:before { content: 'Haskell'; }
+ pre.src-hledger:before { content: 'hledger'; }
+ pre.src-java:before { content: 'Java'; }
+ pre.src-js:before { content: 'Javascript'; }
+ pre.src-latex:before { content: 'LaTeX'; }
+ pre.src-ledger:before { content: 'Ledger'; }
+ pre.src-lisp:before { content: 'Lisp'; }
+ pre.src-lilypond:before { content: 'Lilypond'; }
+ pre.src-lua:before { content: 'Lua'; }
+ pre.src-matlab:before { content: 'MATLAB'; }
+ pre.src-mscgen:before { content: 'Mscgen'; }
+ pre.src-ocaml:before { content: 'Objective Caml'; }
+ pre.src-octave:before { content: 'Octave'; }
+ pre.src-org:before { content: 'Org mode'; }
+ pre.src-oz:before { content: 'OZ'; }
+ pre.src-plantuml:before { content: 'Plantuml'; }
+ pre.src-processing:before { content: 'Processing.js'; }
+ pre.src-python:before { content: 'Python'; }
+ pre.src-R:before { content: 'R'; }
+ pre.src-ruby:before { content: 'Ruby'; }
+ pre.src-sass:before { content: 'Sass'; }
+ pre.src-scheme:before { content: 'Scheme'; }
+ pre.src-screen:before { content: 'Gnu Screen'; }
+ pre.src-sed:before { content: 'Sed'; }
+ pre.src-sh:before { content: 'shell'; }
+ pre.src-sql:before { content: 'SQL'; }
+ pre.src-sqlite:before { content: 'SQLite'; }
+ /* additional languages in org.el's org-babel-load-languages alist */
+ pre.src-forth:before { content: 'Forth'; }
+ pre.src-io:before { content: 'IO'; }
+ pre.src-J:before { content: 'J'; }
+ pre.src-makefile:before { content: 'Makefile'; }
+ pre.src-maxima:before { content: 'Maxima'; }
+ pre.src-perl:before { content: 'Perl'; }
+ pre.src-picolisp:before { content: 'Pico Lisp'; }
+ pre.src-scala:before { content: 'Scala'; }
+ pre.src-shell:before { content: 'Shell Script'; }
+ pre.src-ebnf2ps:before { content: 'ebfn2ps'; }
+ /* additional language identifiers per "defun org-babel-execute"
+ in ob-*.el */
+ pre.src-cpp:before { content: 'C++'; }
+ pre.src-abc:before { content: 'ABC'; }
+ pre.src-coq:before { content: 'Coq'; }
+ pre.src-groovy:before { content: 'Groovy'; }
+ /* additional language identifiers from org-babel-shell-names in
+ ob-shell.el: ob-shell is the only babel language using a lambda to put
+ the execution function name together. */
+ pre.src-bash:before { content: 'bash'; }
+ pre.src-csh:before { content: 'csh'; }
+ pre.src-ash:before { content: 'ash'; }
+ pre.src-dash:before { content: 'dash'; }
+ pre.src-ksh:before { content: 'ksh'; }
+ pre.src-mksh:before { content: 'mksh'; }
+ pre.src-posh:before { content: 'posh'; }
+ /* Additional Emacs modes also supported by the LaTeX listings package */
+ pre.src-ada:before { content: 'Ada'; }
+ pre.src-asm:before { content: 'Assembler'; }
+ pre.src-caml:before { content: 'Caml'; }
+ pre.src-delphi:before { content: 'Delphi'; }
+ pre.src-html:before { content: 'HTML'; }
+ pre.src-idl:before { content: 'IDL'; }
+ pre.src-mercury:before { content: 'Mercury'; }
+ pre.src-metapost:before { content: 'MetaPost'; }
+ pre.src-modula-2:before { content: 'Modula-2'; }
+ pre.src-pascal:before { content: 'Pascal'; }
+ pre.src-ps:before { content: 'PostScript'; }
+ pre.src-prolog:before { content: 'Prolog'; }
+ pre.src-simula:before { content: 'Simula'; }
+ pre.src-tcl:before { content: 'tcl'; }
+ pre.src-tex:before { content: 'TeX'; }
+ pre.src-plain-tex:before { content: 'Plain TeX'; }
+ pre.src-verilog:before { content: 'Verilog'; }
+ pre.src-vhdl:before { content: 'VHDL'; }
+ pre.src-xml:before { content: 'XML'; }
+ pre.src-nxml:before { content: 'XML'; }
+ /* add a generic configuration mode; LaTeX export needs an additional
+ (add-to-list 'org-latex-listings-langs '(conf " ")) in .emacs */
+ pre.src-conf:before { content: 'Configuration File'; }
+
+ table { border-collapse:collapse; }
+ caption.t-above { caption-side: top; }
+ caption.t-bottom { caption-side: bottom; }
+ td, th { vertical-align:top; }
+ th.org-right { text-align: center; }
+ th.org-left { text-align: center; }
+ th.org-center { text-align: center; }
+ td.org-right { text-align: right; }
+ td.org-left { text-align: left; }
+ td.org-center { text-align: center; }
+ dt { font-weight: bold; }
+ .footpara { display: inline; }
+ .footdef { margin-bottom: 1em; }
+ .figure { padding: 1em; }
+ .figure p { text-align: center; }
+ .equation-container {
+ display: table;
+ text-align: center;
+ width: 100%;
+ }
+ .equation {
+ vertical-align: middle;
+ }
+ .equation-label {
+ display: table-cell;
+ text-align: right;
+ vertical-align: middle;
+ }
+ .inlinetask {
+ padding: 10px;
+ border: 2px solid gray;
+ margin: 10px;
+ background: #ffffcc;
+ }
+ #org-div-home-and-up
+ { text-align: right; font-size: 70%; white-space: nowrap; }
+ textarea { overflow-x: auto; }
+ .linenr { font-size: smaller }
+ .code-highlighted { background-color: #ffff00; }
+ .org-info-js_info-navigation { border-style: none; }
+ #org-info-js_console-label
+ { font-size: 10px; font-weight: bold; white-space: nowrap; }
+ .org-info-js_search-highlight
+ { background-color: #ffff00; color: #000000; font-weight: bold; }
+ .org-svg { }
+</style>
+<style type="text/css">
+ body {
+ max-width: 35cm !important;
+ }
+ #content {
+ max-width: 80em !important;
+ width: 90%;
+ }
+ </style>
+<link rel="stylesheet" type="text/css" href="https://thomasf.github.io/solarized-css/solarized-dark.min.css" />
+</head>
+<body>
+<div id="content" class="content">
+<h1 class="title">Plotting</h1>
+<div id="table-of-contents" role="doc-toc">
+<h2>Table of Contents</h2>
+<div id="text-table-of-contents" role="doc-toc">
+<ul>
+<li><a href="#org0872694">1. 2D graph</a></li>
+<li><a href="#org5fc76c6">2. 3D graph</a></li>
+<li><a href="#org6205eea">3. Deriviative calculator</a></li>
+<li><a href="#org79d74b6">4. Sine and cosine table</a></li>
+</ul>
+</div>
+</div>
+<style>
+ .flex-center {
+ display: flex; /* activate flexbox */
+ justify-content: center; /* horizontally center anything inside */
+ }
+
+ .flex-center video {
+ width: min(90%, 1000px); /* whichever is smaller wins */
+ height: auto; /* preserve aspect ratio */
+ }
+
+ .responsive-img {
+ width: min(100%, 1000px);
+ height: auto;
+ }
+</style>
+
+<div id="outline-container-org0872694" class="outline-2">
+<h2 id="org0872694"><span class="section-number-2">1.</span> 2D graph</h2>
+<div class="outline-text-2" id="text-1">
+<p>
+The 2D Graph Plotter is a simple yet effective program written in
+QBasic that allows users to plot mathematical functions on a
+two-dimensional grid. This program is particularly useful for
+visualizing mathematical functions and understanding their graphical
+representations.
+</p>
+
+<p>
+The main loop of the program calculates the y-value for each x-value
+based on a user-defined mathematical function.
+</p>
+
+
+<div id="org6145a94" class="figure">
+<p><a href="2D%20graph%20plot.bas" class="responsive-img"><img src="2D%20graph%20plot.png" alt="2D%20graph%20plot.png" class="responsive-img" /></a>
+</p>
+</div>
+
+<p>
+<a href="2D%20graph%20plot.bas">Source code</a>
+</p>
+</div>
+</div>
+
+<div id="outline-container-org5fc76c6" class="outline-2">
+<h2 id="org5fc76c6"><span class="section-number-2">2.</span> 3D graph</h2>
+<div class="outline-text-2" id="text-2">
+<p>
+The 3D Heightmap Explorer is a QBasic program designed to visualize
+mathematical functions in three dimensions. It allows users to explore
+various heightmaps by defining custom formulas and observing their
+graphical representations. This program is particularly useful for
+educational purposes, helping users understand complex mathematical
+surfaces.
+</p>
+
+<p>
+Users can navigate through the 3D space using keyboard controls to
+move around and inspect the heightmap from different angles.
+</p>
+
+<p>
+The core of the program is the formula subroutine, where users can
+define their mathematical functions. Multiple example formulas are
+provided, which can be enabled or disabled to create different visual
+effects.
+</p>
+
+<p>
+The program includes a grid system that helps users perceive the scale
+and orientation of the 3D space. This includes background grids and a
+central 3D cross to indicate the zero point.
+</p>
+
+<p>
+The formula subroutine evaluates the user-defined mathematical
+function to determine the height (Z-coordinate) of each point on the
+grid.
+</p>
+
+
+<div id="org4ff9548" class="figure">
+<p><a href="3D%20graph.bas" class="responsive-img"><img src="3D%20graph.png" alt="3D%20graph.png" class="responsive-img" /></a>
+</p>
+</div>
+
+<p>
+<a href="3D%20graph.bas">Source code</a>
+</p>
+</div>
+</div>
+
+<div id="outline-container-org6205eea" class="outline-2">
+<h2 id="org6205eea"><span class="section-number-2">3.</span> Deriviative calculator</h2>
+<div class="outline-text-2" id="text-3">
+<p>
+This QBasic program is designed to compute and plot an arbitrary
+mathematical function on a 2D graph. Additionally, it calculates and
+plots the derivative of the function, providing a visual
+representation of both the function and its rate of change. The
+program is a great educational tool for those interested in
+understanding how mathematical functions and their derivatives can be
+visualized.
+</p>
+
+
+<div id="org29b9361" class="figure">
+<p><a href="Deriviative%20calculator.bas" class="responsive-img"><img src="Deriviative%20calculator.png" alt="Deriviative%20calculator.png" class="responsive-img" /></a>
+</p>
+</div>
+
+<p>
+<a href="Deriviative%20calculator.bas">Source code</a>
+</p>
+</div>
+</div>
+
+<div id="outline-container-org79d74b6" class="outline-2">
+<h2 id="org79d74b6"><span class="section-number-2">4.</span> Sine and cosine table</h2>
+<div class="outline-text-2" id="text-4">
+<p>
+The SIN & COS Table Generator is a QBasic program designed to visually
+plot the sine and cosine functions on a graphical screen. This program
+is particularly useful for educational purposes, providing a clear
+visual representation of these fundamental trigonometric functions.
+</p>
+
+
+<div id="orge4c445c" class="figure">
+<p><a href="Sine%20and%20cosine%20table.bas" class="responsive-img"><img src="Sine%20and%20cosine%20table.png" alt="Sine%20and%20cosine%20table.png" class="responsive-img" /></a>
+</p>
+</div>
+
+<p>
+<a href="Sine%20and%20cosine%20table.bas">Source code</a>
+</p>
+</div>
+</div>
+</div>
+<div id="postamble" class="status">
+<p class="date">Created: 2025-07-29 ti 03:29</p>
+<p class="validation"><a href="https://validator.w3.org/check?uri=referer">Validate</a></p>
+</div>
+</body>
+</html>
--- /dev/null
+#+TITLE: Plotting
+#+LANGUAGE: en
+#+LATEX_HEADER: \usepackage[margin=1.0in]{geometry}
+#+LATEX_HEADER: \usepackage{parskip}
+#+LATEX_HEADER: \usepackage[none]{hyphenat}
+
+#+OPTIONS: H:20 num:20
+#+OPTIONS: author:nil
+
+#+begin_export html
+<style>
+ .flex-center {
+ display: flex; /* activate flexbox */
+ justify-content: center; /* horizontally center anything inside */
+ }
+
+ .flex-center video {
+ width: min(90%, 1000px); /* whichever is smaller wins */
+ height: auto; /* preserve aspect ratio */
+ }
+
+ .responsive-img {
+ width: min(100%, 1000px);
+ height: auto;
+ }
+</style>
+#+end_export
+
+* 2D graph
+
+The 2D Graph Plotter is a simple yet effective program written in
+QBasic that allows users to plot mathematical functions on a
+two-dimensional grid. This program is particularly useful for
+visualizing mathematical functions and understanding their graphical
+representations.
+
+The main loop of the program calculates the y-value for each x-value
+based on a user-defined mathematical function.
+
+#+attr_html: :class responsive-img
+#+attr_latex: :width 1000px
+[[file:2D%20graph%20plot.bas][file:2D%20graph%20plot.png]]
+
+[[file:2D%20graph%20plot.bas][Source code]]
+
+* 3D graph
+
+The 3D Heightmap Explorer is a QBasic program designed to visualize
+mathematical functions in three dimensions. It allows users to explore
+various heightmaps by defining custom formulas and observing their
+graphical representations. This program is particularly useful for
+educational purposes, helping users understand complex mathematical
+surfaces.
+
+Users can navigate through the 3D space using keyboard controls to
+move around and inspect the heightmap from different angles.
+
+The core of the program is the formula subroutine, where users can
+define their mathematical functions. Multiple example formulas are
+provided, which can be enabled or disabled to create different visual
+effects.
+
+The program includes a grid system that helps users perceive the scale
+and orientation of the 3D space. This includes background grids and a
+central 3D cross to indicate the zero point.
+
+The formula subroutine evaluates the user-defined mathematical
+function to determine the height (Z-coordinate) of each point on the
+grid.
+
+#+attr_html: :class responsive-img
+#+attr_latex: :width 1000px
+[[file:3D%20graph.bas][file:3D%20graph.png]]
+
+[[file:3D%20graph.bas][Source code]]
+
+* Deriviative calculator
+
+This QBasic program is designed to compute and plot an arbitrary
+mathematical function on a 2D graph. Additionally, it calculates and
+plots the derivative of the function, providing a visual
+representation of both the function and its rate of change. The
+program is a great educational tool for those interested in
+understanding how mathematical functions and their derivatives can be
+visualized.
+
+#+attr_html: :class responsive-img
+#+attr_latex: :width 1000px
+[[file:Deriviative%20calculator.bas][file:Deriviative%20calculator.png]]
+
+[[file:Deriviative%20calculator.bas][Source code]]
+
+* Sine and cosine table
+
+The SIN & COS Table Generator is a QBasic program designed to visually
+plot the sine and cosine functions on a graphical screen. This program
+is particularly useful for educational purposes, providing a clear
+visual representation of these fundamental trigonometric functions.
+
+#+attr_html: :class responsive-img
+#+attr_latex: :width 1000px
+[[file:Sine%20and%20cosine%20table.bas][file:Sine%20and%20cosine%20table.png]]
+
+[[file:Sine%20and%20cosine%20table.bas][Source code]]
--- /dev/null
+' Program to simulate shock waves propagation in gas.\r
+' This program is free software: released under Creative Commons Zero (CC0) license\r
+' by Svjatoslav Agejenko.\r
+' Email: svjatoslav@svjatoslav.eu\r
+' Homepage: http://www.svjatoslav.eu\r
+'\r
+' Changelog:\r
+' 2003, Initial version\r
+' 2024 - 2025, Improved program readability\r
+\r
+DECLARE SUB SetLocalPressure(xCoord!, yCoord!, pressureValue!)\r
+DECLARE SUB DrawBoundaryLine(startX!, startY!, endX!, endY!)\r
+DIM SHARED wallBoundary\r
+wallBoundary = 9980 ' Special value indicating solid wall boundaries\r
+\r
+' Shared arrays for fluid simulation:\r
+DIM SHARED pressureGrid(1 TO 100, 1 TO 100) ' Stores pressure values at each grid point\r
+DIM SHARED horizontalVelocity(1 TO 100, 1 TO 100) ' Stores horizontal velocity components\r
+DIM SHARED verticalVelocity(1 TO 100, 1 TO 100) ' Stores vertical velocity components\r
+DIM SHARED horizontalPressureChange(1 TO 100, 1 TO 100) ' Stores x-direction pressure change at each grid point\r
+DIM SHARED verticalPressureChange(1 TO 100, 1 TO 100) ' Stores y-direction pressure change at each grid point\r
+\r
+SCREEN 13\r
+PAINT (1, 1), 1\r
+SetupInitialConditions\r
+\r
+1 ' Main simulation loop\r
+\r
+ ' Check if any key is pressed; if so, exit the program\r
+ IF INKEY$ <> "" THEN SYSTEM\r
+\r
+ ' Display pressure values in a grid at the bottom of the screen.\r
+ FOR gridY = 2 TO 99\r
+ FOR gridX = 2 TO 99\r
+ IF pressureGrid(gridX, gridY) = wallBoundary THEN\r
+ ' Set velocities to zero for wall boundaries\r
+ horizontalVelocity(gridX - 1, gridY) = 0\r
+ verticalVelocity(gridX, gridY - 1) = 0\r
+ horizontalVelocity(gridX, gridY) = 0\r
+ verticalVelocity(gridX, gridY) = 0\r
+ GOTO 3 ' Skip further calculations for this grid point if it's a wall\r
+ END IF\r
+\r
+ ' Apply gravitation by subtracting pressure from vertical speed\r
+ verticalVelocity(gridX, gridY) = verticalVelocity(gridX, gridY) - (pressureGrid(gridX, gridY) / 500)\r
+\r
+ IF pressureGrid(gridX + 1, gridY) = wallBoundary THEN\r
+ horizontalVelocity(gridX, gridY) = 0 ' Set horizontal speed to zero if there's a wall to the right\r
+ GOTO 2 ' Skip further calculations for this grid point if there's a wall to the right\r
+ END IF\r
+\r
+ ' Calculate x-direction speed based on pressure difference and previous speed\r
+ horizontalVelocity(gridX, gridY) = (pressureGrid(gridX + 1, gridY) - pressureGrid(gridX, gridY)) / 20 + horizontalVelocity(gridX, gridY)\r
+\r
+2 ' Label for skipping further calculations if there's a wall to the right\r
+ IF pressureGrid(gridX, gridY + 1) = wallBoundary THEN\r
+ verticalVelocity(gridX, gridY) = 0 ' Set vertical speed to zero if there's a wall below\r
+ GOTO 3 ' Skip further calculations for this grid point if there's a wall below\r
+ END IF\r
+\r
+ ' Calculate y-direction speed based on pressure difference and previous speed\r
+ verticalVelocity(gridX, gridY) = (pressureGrid(gridX, gridY + 1) - pressureGrid(gridX, gridY)) / 20 + verticalVelocity(gridX, gridY)\r
+\r
+3 ' Label for skipping further calculations if there's a wall below or above\r
+ NEXT gridX\r
+ NEXT gridY\r
+\r
+4 ' Negative pressure correction loop\r
+ negativePressureFlag = 0 ' Initialize negative pressure flag to zero\r
+ FOR gridY = 2 TO 99\r
+ FOR gridX = 2 TO 99\r
+ pressureDifference = pressureGrid(gridX, gridY) + horizontalVelocity(gridX, gridY) + verticalVelocity(gridX, gridY) - horizontalVelocity(gridX - 1, gridY) - verticalVelocity(gridX, gridY - 1)\r
+\r
+ IF pressureDifference = 0 OR ((pressureDifference < 0) AND (pressureDifference > -.0001)) THEN\r
+ ' If difference in pressure is zero or slightly negative, set speeds to zero\r
+ IF horizontalVelocity(gridX, gridY) < 0 THEN\r
+ horizontalVelocity(gridX, gridY) = 0\r
+ END IF\r
+ IF verticalVelocity(gridX, gridY) < 0 THEN\r
+ verticalVelocity(gridX, gridY) = 0\r
+ END IF\r
+ IF horizontalVelocity(gridX - 1, gridY) > 0 THEN\r
+ horizontalVelocity(gridX - 1, gridY) = 0\r
+ END IF\r
+ IF verticalVelocity(gridX, gridY - 1) > 0 THEN\r
+ verticalVelocity(gridX, gridY - 1) = 0\r
+ END IF\r
+ END IF\r
+\r
+ ' If pressure difference is negative\r
+ IF pressureDifference < 0 THEN\r
+ IF horizontalVelocity(gridX, gridY) < 0 THEN\r
+ horizontalVelocity(gridX, gridY) = horizontalVelocity(gridX, gridY) / 1.5 ' Divide horizontal speed by 1.5 if negative\r
+ END IF\r
+ IF verticalVelocity(gridX, gridY) < 0 THEN\r
+ verticalVelocity(gridX, gridY) = verticalVelocity(gridX, gridY) / 1.5 ' Divide vertical speed by 1.5 if negative\r
+ END IF\r
+ IF horizontalVelocity(gridX - 1, gridY) > 0 THEN\r
+ horizontalVelocity(gridX - 1, gridY) = horizontalVelocity(gridX - 1, gridY) / 1.5 ' Divide horizontal speed by 1.5 if positive\r
+ END IF\r
+ IF verticalVelocity(gridX, gridY - 1) > 0 THEN\r
+ verticalVelocity(gridX, gridY - 1) = verticalVelocity(gridX, gridY - 1) / 1.5 ' Divide vertical speed by 1.5 if positive\r
+ END IF\r
+ negativePressureFlag = 1 ' Set negative pressure flag to one\r
+ ' Display negative pressure value at the bottom of the screen\r
+ LOCATE 20, 1\r
+ PRINT pressureDifference\r
+ END IF\r
+ NEXT gridX\r
+ NEXT gridY\r
+\r
+ IF negativePressureFlag = 1 THEN GOTO 4 ' If negative pressure was detected, repeat this loop to correct speeds\r
+\r
+' Update pressure based on velocity\r
+FOR gridY = 2 TO 99\r
+ FOR gridX = 2 TO 99\r
+ ' Update pressure based on speed in the x-direction\r
+ IF horizontalVelocity(gridX, gridY) > 0 THEN\r
+ horizontalPressureChange(gridX - 1, gridY) = ((pressureGrid(gridX, gridY) * horizontalVelocity(gridX - 1, gridY)) + (horizontalVelocity(gridX, gridY) * horizontalVelocity(gridX, gridY))) / (pressureGrid(gridX, gridY) + horizontalVelocity(gridX, gridY)) - horizontalVelocity(gridX - 1, gridY)\r
+ END IF\r
+\r
+ ' Update pressure based on speed in the y-direction\r
+ IF verticalVelocity(gridX, gridY) > 0 THEN\r
+ verticalPressureChange(gridX, gridY - 1) = ((pressureGrid(gridX, gridY) * verticalVelocity(gridX, gridY - 1)) + (verticalVelocity(gridX, gridY) * verticalVelocity(gridX, gridY))) / (pressureGrid(gridX, gridY) + verticalVelocity(gridX, gridY)) - verticalVelocity(gridX, gridY - 1)\r
+ END IF\r
+\r
+ ' Handle negative speeds in the x-direction\r
+ IF horizontalVelocity(gridX - 1, gridY) < 0 THEN\r
+ horizontalPressureChange(gridX, gridY) = ((pressureGrid(gridX, gridY) * horizontalVelocity(gridX, gridY)) - (horizontalVelocity(gridX - 1, gridY) * horizontalVelocity(gridX - 1, gridY))) / (pressureGrid(gridX, gridY) - horizontalVelocity(gridX - 1, gridY)) - horizontalVelocity(gridX, gridY)\r
+ END IF\r
+\r
+ ' Handle negative speeds in the y-direction\r
+ IF verticalVelocity(gridX, gridY - 1) < 0 THEN\r
+ verticalPressureChange(gridX, gridY) = ((pressureGrid(gridX, gridY) * verticalVelocity(gridX, gridY)) - (verticalVelocity(gridX, gridY - 1) * verticalVelocity(gridX, gridY - 1))) / (pressureGrid(gridX, gridY) - verticalVelocity(gridX, gridY - 1)) - verticalVelocity(gridX, gridY)\r
+ END IF\r
+ NEXT gridX\r
+NEXT gridY\r
+\r
+' Update pressure grid based on velocities\r
+FOR gridY = 2 TO 99\r
+ FOR gridX = 2 TO 99\r
+ ' Update pressure based on speed in the x-direction\r
+ pressureGrid(gridX + 1, gridY) = pressureGrid(gridX + 1, gridY) - horizontalVelocity(gridX, gridY)\r
+\r
+ ' Update pressure based on speed in the y-direction\r
+ pressureGrid(gridX, gridY + 1) = pressureGrid(gridX, gridY + 1) - verticalVelocity(gridX, gridY)\r
+\r
+ ' Add x and y speeds to pressure\r
+ pressureGrid(gridX, gridY) = pressureGrid(gridX, gridY) + horizontalVelocity(gridX, gridY)\r
+ pressureGrid(gridX, gridY) = pressureGrid(gridX, gridY) + verticalVelocity(gridX, gridY)\r
+ NEXT gridX\r
+NEXT gridY\r
+\r
+' Update velocities based on pressure changes\r
+FOR gridY = 2 TO 99\r
+ FOR gridX = 2 TO 99\r
+ ' Update speed based on previous speed in the x-direction\r
+ horizontalVelocity(gridX, gridY) = horizontalVelocity(gridX, gridY) + horizontalPressureChange(gridX, gridY)\r
+\r
+ ' Reset pressure change to zero for next iteration\r
+ horizontalPressureChange(gridX, gridY) = 0\r
+\r
+ ' Update speed based on previous speed in the y-direction\r
+ verticalVelocity(gridX, gridY) = verticalVelocity(gridX, gridY) + verticalPressureChange(gridX, gridY)\r
+\r
+ ' Reset pressure change to zero for next iteration\r
+ verticalPressureChange(gridX, gridY) = 0\r
+ NEXT gridX\r
+NEXT gridY\r
+\r
+' Draw the grid based on pressure values\r
+FOR gridY = 1 TO 100\r
+ FOR gridX = 1 TO 100\r
+ ' Draw pixel based on pressure value\r
+ PSET (gridX, gridY), pressureGrid(gridX, gridY) + 16\r
+ NEXT gridX\r
+NEXT gridY\r
+\r
+GOTO 1 ' Repeat the main simulation loop\r
+\r
+SUB DrawBoundaryLine (startX!, startY!, endX!, endY!)\r
+ ' Draws a straight line between two points in the pressure grid\r
+ ' All points along the line are set to wallBoundary value\r
+ ' Uses linear interpolation for smooth line drawing\r
+ maxSteps = ABS(startX - endX)\r
+ IF ABS(startY - endY) > maxSteps THEN maxSteps = ABS(startY - endY)\r
+ deltaX = endX - startX\r
+ deltaY = endY - startY\r
+ FOR stepCount = 0 TO maxSteps\r
+ ' Calculate interpolated coordinates\r
+ interpX = deltaX * stepCount / maxSteps + startX\r
+ interpY = deltaY * stepCount / maxSteps + startY\r
+ ' Mark this point as a wall boundary\r
+ pressureGrid(interpX, interpY) = wallBoundary\r
+ NEXT stepCount\r
+END SUB\r
+\r
+SUB SetLocalPressure (xCoord!, yCoord!, pressureValue!)\r
+ ' Sets a 2x2 block of cells to specified pressure value\r
+ ' Creates localized pressure disturbances in simulation\r
+ pressureGrid(xCoord, yCoord) = pressureValue\r
+ pressureGrid(xCoord + 1, yCoord) = pressureValue\r
+ pressureGrid(xCoord, yCoord + 1) = pressureValue\r
+ pressureGrid(xCoord + 1, yCoord + 1) = pressureValue\r
+END SUB\r
+\r
+SUB SetupInitialConditions\r
+ ' Sets up initial conditions for the simulation:\r
+ ' - Initializes all pressure and velocity arrays\r
+ ' - Places initial pressure disturbances\r
+ ' - Creates boundary walls\r
+ FOR yIndex = 1 TO 100\r
+ FOR xIndex = 1 TO 100\r
+ ' Initialize pressure and velocity variables\r
+ pressureGrid(xIndex, yIndex) = 3\r
+ horizontalVelocity(xIndex, yIndex) = 0\r
+ verticalVelocity(xIndex, yIndex) = 0\r
+ horizontalPressureChange(xIndex, yIndex) = 0\r
+ verticalPressureChange(xIndex, yIndex) = 0\r
+ NEXT xIndex\r
+ NEXT yIndex\r
+\r
+ ' Create initial pressure spots\r
+ FOR yIndex = 30 TO 60\r
+ FOR xIndex = 10 TO 50\r
+ SetLocalPressure xIndex, yIndex, 30\r
+ NEXT xIndex\r
+ NEXT yIndex\r
+\r
+ ' Draw boundary lines\r
+ DrawBoundaryLine 2, 2, 2, 99\r
+ DrawBoundaryLine 99, 2, 99, 99\r
+ DrawBoundaryLine 2, 99, 99, 99\r
+ DrawBoundaryLine 2, 2, 99, 2\r
+\r
+ ' Draw additional lines for testing\r
+ FOR xIndex = 5 TO 40 STEP 5\r
+ DrawBoundaryLine xIndex, 80, xIndex + 50, 80 - xIndex\r
+ NEXT xIndex\r
+END SUB\r
+++ /dev/null
-' Program to simulate shock waves propagation in gas.\r
-' This program is free software: released under Creative Commons Zero (CC0) license\r
-' by Svjatoslav Agejenko.\r
-' Email: svjatoslav@svjatoslav.eu\r
-' Homepage: http://www.svjatoslav.eu\r
-'\r
-' Changelog:\r
-' 2003, Initial version\r
-' 2024 - 2025, Improved program readability\r
-\r
-DECLARE SUB SetLocalPressure(xCoord!, yCoord!, pressureValue!)\r
-DECLARE SUB DrawBoundaryLine(startX!, startY!, endX!, endY!)\r
-DIM SHARED wallBoundary\r
-wallBoundary = 9980 ' Special value indicating solid wall boundaries\r
-\r
-' Shared arrays for fluid simulation:\r
-DIM SHARED pressureGrid(1 TO 100, 1 TO 100) ' Stores pressure values at each grid point\r
-DIM SHARED horizontalVelocity(1 TO 100, 1 TO 100) ' Stores horizontal velocity components\r
-DIM SHARED verticalVelocity(1 TO 100, 1 TO 100) ' Stores vertical velocity components\r
-DIM SHARED horizontalPressureChange(1 TO 100, 1 TO 100) ' Stores x-direction pressure change at each grid point\r
-DIM SHARED verticalPressureChange(1 TO 100, 1 TO 100) ' Stores y-direction pressure change at each grid point\r
-\r
-SCREEN 13\r
-PAINT (1, 1), 1\r
-SetupInitialConditions\r
-\r
-1 ' Main simulation loop\r
-\r
- ' Check if any key is pressed; if so, exit the program\r
- IF INKEY$ <> "" THEN SYSTEM\r
-\r
- ' Display pressure values in a grid at the bottom of the screen.\r
- FOR gridY = 2 TO 99\r
- FOR gridX = 2 TO 99\r
- IF pressureGrid(gridX, gridY) = wallBoundary THEN\r
- ' Set velocities to zero for wall boundaries\r
- horizontalVelocity(gridX - 1, gridY) = 0\r
- verticalVelocity(gridX, gridY - 1) = 0\r
- horizontalVelocity(gridX, gridY) = 0\r
- verticalVelocity(gridX, gridY) = 0\r
- GOTO 3 ' Skip further calculations for this grid point if it's a wall\r
- END IF\r
-\r
- ' Apply gravitation by subtracting pressure from vertical speed\r
- verticalVelocity(gridX, gridY) = verticalVelocity(gridX, gridY) - (pressureGrid(gridX, gridY) / 500)\r
-\r
- IF pressureGrid(gridX + 1, gridY) = wallBoundary THEN\r
- horizontalVelocity(gridX, gridY) = 0 ' Set horizontal speed to zero if there's a wall to the right\r
- GOTO 2 ' Skip further calculations for this grid point if there's a wall to the right\r
- END IF\r
-\r
- ' Calculate x-direction speed based on pressure difference and previous speed\r
- horizontalVelocity(gridX, gridY) = (pressureGrid(gridX + 1, gridY) - pressureGrid(gridX, gridY)) / 20 + horizontalVelocity(gridX, gridY)\r
-\r
-2 ' Label for skipping further calculations if there's a wall to the right\r
- IF pressureGrid(gridX, gridY + 1) = wallBoundary THEN\r
- verticalVelocity(gridX, gridY) = 0 ' Set vertical speed to zero if there's a wall below\r
- GOTO 3 ' Skip further calculations for this grid point if there's a wall below\r
- END IF\r
-\r
- ' Calculate y-direction speed based on pressure difference and previous speed\r
- verticalVelocity(gridX, gridY) = (pressureGrid(gridX, gridY + 1) - pressureGrid(gridX, gridY)) / 20 + verticalVelocity(gridX, gridY)\r
-\r
-3 ' Label for skipping further calculations if there's a wall below or above\r
- NEXT gridX\r
- NEXT gridY\r
-\r
-4 ' Negative pressure correction loop\r
- negativePressureFlag = 0 ' Initialize negative pressure flag to zero\r
- FOR gridY = 2 TO 99\r
- FOR gridX = 2 TO 99\r
- pressureDifference = pressureGrid(gridX, gridY) + horizontalVelocity(gridX, gridY) + verticalVelocity(gridX, gridY) - horizontalVelocity(gridX - 1, gridY) - verticalVelocity(gridX, gridY - 1)\r
-\r
- IF pressureDifference = 0 OR ((pressureDifference < 0) AND (pressureDifference > -.0001)) THEN\r
- ' If difference in pressure is zero or slightly negative, set speeds to zero\r
- IF horizontalVelocity(gridX, gridY) < 0 THEN\r
- horizontalVelocity(gridX, gridY) = 0\r
- END IF\r
- IF verticalVelocity(gridX, gridY) < 0 THEN\r
- verticalVelocity(gridX, gridY) = 0\r
- END IF\r
- IF horizontalVelocity(gridX - 1, gridY) > 0 THEN\r
- horizontalVelocity(gridX - 1, gridY) = 0\r
- END IF\r
- IF verticalVelocity(gridX, gridY - 1) > 0 THEN\r
- verticalVelocity(gridX, gridY - 1) = 0\r
- END IF\r
- END IF\r
-\r
- ' If pressure difference is negative\r
- IF pressureDifference < 0 THEN\r
- IF horizontalVelocity(gridX, gridY) < 0 THEN\r
- horizontalVelocity(gridX, gridY) = horizontalVelocity(gridX, gridY) / 1.5 ' Divide horizontal speed by 1.5 if negative\r
- END IF\r
- IF verticalVelocity(gridX, gridY) < 0 THEN\r
- verticalVelocity(gridX, gridY) = verticalVelocity(gridX, gridY) / 1.5 ' Divide vertical speed by 1.5 if negative\r
- END IF\r
- IF horizontalVelocity(gridX - 1, gridY) > 0 THEN\r
- horizontalVelocity(gridX - 1, gridY) = horizontalVelocity(gridX - 1, gridY) / 1.5 ' Divide horizontal speed by 1.5 if positive\r
- END IF\r
- IF verticalVelocity(gridX, gridY - 1) > 0 THEN\r
- verticalVelocity(gridX, gridY - 1) = verticalVelocity(gridX, gridY - 1) / 1.5 ' Divide vertical speed by 1.5 if positive\r
- END IF\r
- negativePressureFlag = 1 ' Set negative pressure flag to one\r
- ' Display negative pressure value at the bottom of the screen\r
- LOCATE 20, 1\r
- PRINT pressureDifference\r
- END IF\r
- NEXT gridX\r
- NEXT gridY\r
-\r
- IF negativePressureFlag = 1 THEN GOTO 4 ' If negative pressure was detected, repeat this loop to correct speeds\r
-\r
-' Update pressure based on velocity\r
-FOR gridY = 2 TO 99\r
- FOR gridX = 2 TO 99\r
- ' Update pressure based on speed in the x-direction\r
- IF horizontalVelocity(gridX, gridY) > 0 THEN\r
- horizontalPressureChange(gridX - 1, gridY) = ((pressureGrid(gridX, gridY) * horizontalVelocity(gridX - 1, gridY)) + (horizontalVelocity(gridX, gridY) * horizontalVelocity(gridX, gridY))) / (pressureGrid(gridX, gridY) + horizontalVelocity(gridX, gridY)) - horizontalVelocity(gridX - 1, gridY)\r
- END IF\r
-\r
- ' Update pressure based on speed in the y-direction\r
- IF verticalVelocity(gridX, gridY) > 0 THEN\r
- verticalPressureChange(gridX, gridY - 1) = ((pressureGrid(gridX, gridY) * verticalVelocity(gridX, gridY - 1)) + (verticalVelocity(gridX, gridY) * verticalVelocity(gridX, gridY))) / (pressureGrid(gridX, gridY) + verticalVelocity(gridX, gridY)) - verticalVelocity(gridX, gridY - 1)\r
- END IF\r
-\r
- ' Handle negative speeds in the x-direction\r
- IF horizontalVelocity(gridX - 1, gridY) < 0 THEN\r
- horizontalPressureChange(gridX, gridY) = ((pressureGrid(gridX, gridY) * horizontalVelocity(gridX, gridY)) - (horizontalVelocity(gridX - 1, gridY) * horizontalVelocity(gridX - 1, gridY))) / (pressureGrid(gridX, gridY) - horizontalVelocity(gridX - 1, gridY)) - horizontalVelocity(gridX, gridY)\r
- END IF\r
-\r
- ' Handle negative speeds in the y-direction\r
- IF verticalVelocity(gridX, gridY - 1) < 0 THEN\r
- verticalPressureChange(gridX, gridY) = ((pressureGrid(gridX, gridY) * verticalVelocity(gridX, gridY)) - (verticalVelocity(gridX, gridY - 1) * verticalVelocity(gridX, gridY - 1))) / (pressureGrid(gridX, gridY) - verticalVelocity(gridX, gridY - 1)) - verticalVelocity(gridX, gridY)\r
- END IF\r
- NEXT gridX\r
-NEXT gridY\r
-\r
-' Update pressure grid based on velocities\r
-FOR gridY = 2 TO 99\r
- FOR gridX = 2 TO 99\r
- ' Update pressure based on speed in the x-direction\r
- pressureGrid(gridX + 1, gridY) = pressureGrid(gridX + 1, gridY) - horizontalVelocity(gridX, gridY)\r
-\r
- ' Update pressure based on speed in the y-direction\r
- pressureGrid(gridX, gridY + 1) = pressureGrid(gridX, gridY + 1) - verticalVelocity(gridX, gridY)\r
-\r
- ' Add x and y speeds to pressure\r
- pressureGrid(gridX, gridY) = pressureGrid(gridX, gridY) + horizontalVelocity(gridX, gridY)\r
- pressureGrid(gridX, gridY) = pressureGrid(gridX, gridY) + verticalVelocity(gridX, gridY)\r
- NEXT gridX\r
-NEXT gridY\r
-\r
-' Update velocities based on pressure changes\r
-FOR gridY = 2 TO 99\r
- FOR gridX = 2 TO 99\r
- ' Update speed based on previous speed in the x-direction\r
- horizontalVelocity(gridX, gridY) = horizontalVelocity(gridX, gridY) + horizontalPressureChange(gridX, gridY)\r
-\r
- ' Reset pressure change to zero for next iteration\r
- horizontalPressureChange(gridX, gridY) = 0\r
-\r
- ' Update speed based on previous speed in the y-direction\r
- verticalVelocity(gridX, gridY) = verticalVelocity(gridX, gridY) + verticalPressureChange(gridX, gridY)\r
-\r
- ' Reset pressure change to zero for next iteration\r
- verticalPressureChange(gridX, gridY) = 0\r
- NEXT gridX\r
-NEXT gridY\r
-\r
-' Draw the grid based on pressure values\r
-FOR gridY = 1 TO 100\r
- FOR gridX = 1 TO 100\r
- ' Draw pixel based on pressure value\r
- PSET (gridX, gridY), pressureGrid(gridX, gridY) + 16\r
- NEXT gridX\r
-NEXT gridY\r
-\r
-GOTO 1 ' Repeat the main simulation loop\r
-\r
-SUB DrawBoundaryLine (startX!, startY!, endX!, endY!)\r
- ' Draws a straight line between two points in the pressure grid\r
- ' All points along the line are set to wallBoundary value\r
- ' Uses linear interpolation for smooth line drawing\r
- maxSteps = ABS(startX - endX)\r
- IF ABS(startY - endY) > maxSteps THEN maxSteps = ABS(startY - endY)\r
- deltaX = endX - startX\r
- deltaY = endY - startY\r
- FOR stepCount = 0 TO maxSteps\r
- ' Calculate interpolated coordinates\r
- interpX = deltaX * stepCount / maxSteps + startX\r
- interpY = deltaY * stepCount / maxSteps + startY\r
- ' Mark this point as a wall boundary\r
- pressureGrid(interpX, interpY) = wallBoundary\r
- NEXT stepCount\r
-END SUB\r
-\r
-SUB SetLocalPressure (xCoord!, yCoord!, pressureValue!)\r
- ' Sets a 2x2 block of cells to specified pressure value\r
- ' Creates localized pressure disturbances in simulation\r
- pressureGrid(xCoord, yCoord) = pressureValue\r
- pressureGrid(xCoord + 1, yCoord) = pressureValue\r
- pressureGrid(xCoord, yCoord + 1) = pressureValue\r
- pressureGrid(xCoord + 1, yCoord + 1) = pressureValue\r
-END SUB\r
-\r
-SUB SetupInitialConditions\r
- ' Sets up initial conditions for the simulation:\r
- ' - Initializes all pressure and velocity arrays\r
- ' - Places initial pressure disturbances\r
- ' - Creates boundary walls\r
- FOR yIndex = 1 TO 100\r
- FOR xIndex = 1 TO 100\r
- ' Initialize pressure and velocity variables\r
- pressureGrid(xIndex, yIndex) = 3\r
- horizontalVelocity(xIndex, yIndex) = 0\r
- verticalVelocity(xIndex, yIndex) = 0\r
- horizontalPressureChange(xIndex, yIndex) = 0\r
- verticalPressureChange(xIndex, yIndex) = 0\r
- NEXT xIndex\r
- NEXT yIndex\r
-\r
- ' Create initial pressure spots\r
- FOR yIndex = 30 TO 60\r
- FOR xIndex = 10 TO 50\r
- SetLocalPressure xIndex, yIndex, 30\r
- NEXT xIndex\r
- NEXT yIndex\r
-\r
- ' Draw boundary lines\r
- DrawBoundaryLine 2, 2, 2, 99\r
- DrawBoundaryLine 99, 2, 99, 99\r
- DrawBoundaryLine 2, 99, 99, 99\r
- DrawBoundaryLine 2, 2, 99, 2\r
-\r
- ' Draw additional lines for testing\r
- FOR xIndex = 5 TO 40 STEP 5\r
- DrawBoundaryLine xIndex, 80, xIndex + 50, 80 - xIndex\r
- NEXT xIndex\r
-END SUB\r
+++ /dev/null
-<HTML>\r
-<HEAD><TITLE>explode</TITLE></HEAD>\r
-\r
-<BODY>\r
-\r
-<CENTER><H1>explode</H1></CENTER>\r
-<BR>\r
-<BR>\r
-<BR>Simulates air flow.\r
-Air tries to spread equally around space,\r
-while having is inertial farces, mass and gravitation.\r
-Simulation animates shock waves propagation on\r
-flat space after explosion.\r
-\r
-<BR><IMG SRC="sshot.png">\r
-</BODY>\r
-</HTML>
\ No newline at end of file
+++ /dev/null
-' Program simulates interference between two slightly different frequencies\r
-'\r
-' This program is free software: released under Creative Commons Zero (CC0) license\r
-' by Svjatoslav Agejenko.\r
-' Email: svjatoslav@svjatoslav.eu\r
-' Homepage: http://www.svjatoslav.eu\r
-'\r
-' Changelog:\r
-' ?, Initial version\r
-' 2024-2025, Improved program readability\r
-\r
-DECLARE SUB GetFrequency ()\r
-DECLARE SUB Start ()\r
-DECLARE FUNCTION GetY! (t!)\r
-\r
-SCREEN 12\r
-1\r
-\r
-' Check for user input and exit if any key is pressed\r
-IF INKEY$ <> "" THEN SYSTEM\r
-\r
-frame = frame + 1\r
-FOR x = 0 TO 639\r
-\r
- oldY1 = y1\r
- oldY2 = y2\r
- oldY3 = y3\r
-\r
- ' Calculate new Y values for the waves\r
- ' First wave: simple sine wave\r
- y1 = SIN(frame + x / 4) * 20 + 150\r
-\r
- ' Second wave: same but with additional phase shift that increases with x\r
- ' This creates a slight frequency difference\r
- y2 = SIN(frame + x / 4 + (x / 50)) * 20 + 150\r
-\r
- ' Third line: sum of both waves to show interference pattern\r
- y3 = y1 + y2\r
-\r
- ' Clear the previous frame by drawing black vertical line\r
- LINE (x, 0)-(x, 479), 0\r
-\r
- ' Draw new lines for each wave\r
- LINE (x - 1, oldY1)-(x, y1), 1 ' Blue wave\r
- LINE (x - 1, oldY2)-(x, y2), 2 ' Green wave\r
- LINE (x - 1, oldY3)-(x, y3), 15 ' White combined wave\r
-\r
-NEXT x\r
-GOTO 1\r
-\r
-\r
--- /dev/null
+' Program simulates interference between two slightly different frequencies\r
+'\r
+' This program is free software: released under Creative Commons Zero (CC0) license\r
+' by Svjatoslav Agejenko.\r
+' Email: svjatoslav@svjatoslav.eu\r
+' Homepage: http://www.svjatoslav.eu\r
+'\r
+' Changelog:\r
+' ?, Initial version\r
+' 2024-2025, Improved program readability\r
+\r
+DECLARE SUB GetFrequency ()\r
+DECLARE SUB Start ()\r
+DECLARE FUNCTION GetY! (t!)\r
+\r
+SCREEN 12\r
+1\r
+\r
+' Check for user input and exit if any key is pressed\r
+IF INKEY$ <> "" THEN SYSTEM\r
+\r
+frame = frame + 1\r
+FOR x = 0 TO 639\r
+\r
+ oldY1 = y1\r
+ oldY2 = y2\r
+ oldY3 = y3\r
+\r
+ ' Calculate new Y values for the waves\r
+ ' First wave: simple sine wave\r
+ y1 = SIN(frame + x / 4) * 20 + 150\r
+\r
+ ' Second wave: same but with additional phase shift that increases with x\r
+ ' This creates a slight frequency difference\r
+ y2 = SIN(frame + x / 4 + (x / 50)) * 20 + 150\r
+\r
+ ' Third line: sum of both waves to show interference pattern\r
+ y3 = y1 + y2\r
+\r
+ ' Clear the previous frame by drawing black vertical line\r
+ LINE (x, 0)-(x, 479), 0\r
+\r
+ ' Draw new lines for each wave\r
+ LINE (x - 1, oldY1)-(x, y1), 1 ' Blue wave\r
+ LINE (x - 1, oldY2)-(x, y2), 2 ' Green wave\r
+ LINE (x - 1, oldY3)-(x, y3), 15 ' White combined wave\r
+\r
+NEXT x\r
+GOTO 1\r
+\r
+\r
+++ /dev/null
-' Program simulates lot of frequencies interfering with itself.\r
-' As a result, interferogram is produced.\r
-'\r
-' This program is free software: released under Creative Commons Zero (CC0) license\r
-' by Svjatoslav Agejenko.\r
-' Email: svjatoslav@svjatoslav.eu\r
-' Homepage: http://www.svjatoslav.eu\r
-'\r
-' Changelog:\r
-' ?, Initial version\r
-' 2024 - 2025, Improved program readability\r
-\r
-' Set graphics mode (640x480 with 16 colors)\r
-SCREEN 12\r
-\r
-' Start drawing from the leftmost pixel\r
-PSET (0, 0)\r
-\r
-' Loop through all horizontal positions on screen\r
-FOR currentXPosition = 0 TO 639\r
-\r
- ' Calculate frequency scaling factor based on position\r
- ' This creates a gradient effect in the interference pattern\r
- frequencyScalingFactor = (currentXPosition - 320) / 5000 + 1\r
-\r
- ' Initialize accumulated signal value\r
- totalSignalValue = 0\r
-\r
- ' Sample the signal at multiple time steps to calculate interference\r
- FOR currentTimeStep = 1 TO 5000 STEP 5\r
- ' Generate two sine waves:\r
- ' y1 - base frequency wave\r
- ' y2 - frequency scaled wave (based on horizontal position)\r
- baseWave = SIN(currentTimeStep)\r
- scaledWave = SIN(currentTimeStep * frequencyScalingFactor)\r
-\r
- ' Calculate interference by summing the waves and taking absolute value\r
- totalSignalValue = totalSignalValue + ABS(baseWave + scaledWave)\r
- NEXT currentTimeStep\r
-\r
- ' Normalize the signal value\r
- normalizedSignalValue = totalSignalValue / 5\r
-\r
- ' Limit the value to screen boundaries\r
- IF normalizedSignalValue > 470 THEN normalizedSignalValue = 470\r
- IF normalizedSignalValue < 0 THEN normalizedSignalValue = 0\r
-\r
- ' Draw a line from previous position to current position\r
- LINE -(currentXPosition, 479 - normalizedSignalValue), 15\r
-\r
-NEXT currentXPosition\r
-\r
--- /dev/null
+' Program simulates lot of frequencies interfering with itself.\r
+' As a result, interferogram is produced.\r
+'\r
+' This program is free software: released under Creative Commons Zero (CC0) license\r
+' by Svjatoslav Agejenko.\r
+' Email: svjatoslav@svjatoslav.eu\r
+' Homepage: http://www.svjatoslav.eu\r
+'\r
+' Changelog:\r
+' ?, Initial version\r
+' 2024 - 2025, Improved program readability\r
+\r
+' Set graphics mode (640x480 with 16 colors)\r
+SCREEN 12\r
+\r
+' Start drawing from the leftmost pixel\r
+PSET (0, 0)\r
+\r
+' Loop through all horizontal positions on screen\r
+FOR currentXPosition = 0 TO 639\r
+\r
+ ' Calculate frequency scaling factor based on position\r
+ ' This creates a gradient effect in the interference pattern\r
+ frequencyScalingFactor = (currentXPosition - 320) / 5000 + 1\r
+\r
+ ' Initialize accumulated signal value\r
+ totalSignalValue = 0\r
+\r
+ ' Sample the signal at multiple time steps to calculate interference\r
+ FOR currentTimeStep = 1 TO 5000 STEP 5\r
+ ' Generate two sine waves:\r
+ ' y1 - base frequency wave\r
+ ' y2 - frequency scaled wave (based on horizontal position)\r
+ baseWave = SIN(currentTimeStep)\r
+ scaledWave = SIN(currentTimeStep * frequencyScalingFactor)\r
+\r
+ ' Calculate interference by summing the waves and taking absolute value\r
+ totalSignalValue = totalSignalValue + ABS(baseWave + scaledWave)\r
+ NEXT currentTimeStep\r
+\r
+ ' Normalize the signal value\r
+ normalizedSignalValue = totalSignalValue / 5\r
+\r
+ ' Limit the value to screen boundaries\r
+ IF normalizedSignalValue > 470 THEN normalizedSignalValue = 470\r
+ IF normalizedSignalValue < 0 THEN normalizedSignalValue = 0\r
+\r
+ ' Draw a line from previous position to current position\r
+ LINE -(currentXPosition, 479 - normalizedSignalValue), 15\r
+\r
+NEXT currentXPosition\r
+\r
--- /dev/null
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
+"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
+<head>
+<!-- 2025-07-29 ti 03:58 -->
+<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
+<meta name="viewport" content="width=device-width, initial-scale=1" />
+<title>Simulation</title>
+<meta name="generator" content="Org Mode" />
+<style>
+ #content { max-width: 60em; margin: auto; }
+ .title { text-align: center;
+ margin-bottom: .2em; }
+ .subtitle { text-align: center;
+ font-size: medium;
+ font-weight: bold;
+ margin-top:0; }
+ .todo { font-family: monospace; color: red; }
+ .done { font-family: monospace; color: green; }
+ .priority { font-family: monospace; color: orange; }
+ .tag { background-color: #eee; font-family: monospace;
+ padding: 2px; font-size: 80%; font-weight: normal; }
+ .timestamp { color: #bebebe; }
+ .timestamp-kwd { color: #5f9ea0; }
+ .org-right { margin-left: auto; margin-right: 0px; text-align: right; }
+ .org-left { margin-left: 0px; margin-right: auto; text-align: left; }
+ .org-center { margin-left: auto; margin-right: auto; text-align: center; }
+ .underline { text-decoration: underline; }
+ #postamble p, #preamble p { font-size: 90%; margin: .2em; }
+ p.verse { margin-left: 3%; }
+ pre {
+ border: 1px solid #e6e6e6;
+ border-radius: 3px;
+ background-color: #f2f2f2;
+ padding: 8pt;
+ font-family: monospace;
+ overflow: auto;
+ margin: 1.2em;
+ }
+ pre.src {
+ position: relative;
+ overflow: auto;
+ }
+ pre.src:before {
+ display: none;
+ position: absolute;
+ top: -8px;
+ right: 12px;
+ padding: 3px;
+ color: #555;
+ background-color: #f2f2f299;
+ }
+ pre.src:hover:before { display: inline; margin-top: 14px;}
+ /* Languages per Org manual */
+ pre.src-asymptote:before { content: 'Asymptote'; }
+ pre.src-awk:before { content: 'Awk'; }
+ pre.src-authinfo::before { content: 'Authinfo'; }
+ pre.src-C:before { content: 'C'; }
+ /* pre.src-C++ doesn't work in CSS */
+ pre.src-clojure:before { content: 'Clojure'; }
+ pre.src-css:before { content: 'CSS'; }
+ pre.src-D:before { content: 'D'; }
+ pre.src-ditaa:before { content: 'ditaa'; }
+ pre.src-dot:before { content: 'Graphviz'; }
+ pre.src-calc:before { content: 'Emacs Calc'; }
+ pre.src-emacs-lisp:before { content: 'Emacs Lisp'; }
+ pre.src-fortran:before { content: 'Fortran'; }
+ pre.src-gnuplot:before { content: 'gnuplot'; }
+ pre.src-haskell:before { content: 'Haskell'; }
+ pre.src-hledger:before { content: 'hledger'; }
+ pre.src-java:before { content: 'Java'; }
+ pre.src-js:before { content: 'Javascript'; }
+ pre.src-latex:before { content: 'LaTeX'; }
+ pre.src-ledger:before { content: 'Ledger'; }
+ pre.src-lisp:before { content: 'Lisp'; }
+ pre.src-lilypond:before { content: 'Lilypond'; }
+ pre.src-lua:before { content: 'Lua'; }
+ pre.src-matlab:before { content: 'MATLAB'; }
+ pre.src-mscgen:before { content: 'Mscgen'; }
+ pre.src-ocaml:before { content: 'Objective Caml'; }
+ pre.src-octave:before { content: 'Octave'; }
+ pre.src-org:before { content: 'Org mode'; }
+ pre.src-oz:before { content: 'OZ'; }
+ pre.src-plantuml:before { content: 'Plantuml'; }
+ pre.src-processing:before { content: 'Processing.js'; }
+ pre.src-python:before { content: 'Python'; }
+ pre.src-R:before { content: 'R'; }
+ pre.src-ruby:before { content: 'Ruby'; }
+ pre.src-sass:before { content: 'Sass'; }
+ pre.src-scheme:before { content: 'Scheme'; }
+ pre.src-screen:before { content: 'Gnu Screen'; }
+ pre.src-sed:before { content: 'Sed'; }
+ pre.src-sh:before { content: 'shell'; }
+ pre.src-sql:before { content: 'SQL'; }
+ pre.src-sqlite:before { content: 'SQLite'; }
+ /* additional languages in org.el's org-babel-load-languages alist */
+ pre.src-forth:before { content: 'Forth'; }
+ pre.src-io:before { content: 'IO'; }
+ pre.src-J:before { content: 'J'; }
+ pre.src-makefile:before { content: 'Makefile'; }
+ pre.src-maxima:before { content: 'Maxima'; }
+ pre.src-perl:before { content: 'Perl'; }
+ pre.src-picolisp:before { content: 'Pico Lisp'; }
+ pre.src-scala:before { content: 'Scala'; }
+ pre.src-shell:before { content: 'Shell Script'; }
+ pre.src-ebnf2ps:before { content: 'ebfn2ps'; }
+ /* additional language identifiers per "defun org-babel-execute"
+ in ob-*.el */
+ pre.src-cpp:before { content: 'C++'; }
+ pre.src-abc:before { content: 'ABC'; }
+ pre.src-coq:before { content: 'Coq'; }
+ pre.src-groovy:before { content: 'Groovy'; }
+ /* additional language identifiers from org-babel-shell-names in
+ ob-shell.el: ob-shell is the only babel language using a lambda to put
+ the execution function name together. */
+ pre.src-bash:before { content: 'bash'; }
+ pre.src-csh:before { content: 'csh'; }
+ pre.src-ash:before { content: 'ash'; }
+ pre.src-dash:before { content: 'dash'; }
+ pre.src-ksh:before { content: 'ksh'; }
+ pre.src-mksh:before { content: 'mksh'; }
+ pre.src-posh:before { content: 'posh'; }
+ /* Additional Emacs modes also supported by the LaTeX listings package */
+ pre.src-ada:before { content: 'Ada'; }
+ pre.src-asm:before { content: 'Assembler'; }
+ pre.src-caml:before { content: 'Caml'; }
+ pre.src-delphi:before { content: 'Delphi'; }
+ pre.src-html:before { content: 'HTML'; }
+ pre.src-idl:before { content: 'IDL'; }
+ pre.src-mercury:before { content: 'Mercury'; }
+ pre.src-metapost:before { content: 'MetaPost'; }
+ pre.src-modula-2:before { content: 'Modula-2'; }
+ pre.src-pascal:before { content: 'Pascal'; }
+ pre.src-ps:before { content: 'PostScript'; }
+ pre.src-prolog:before { content: 'Prolog'; }
+ pre.src-simula:before { content: 'Simula'; }
+ pre.src-tcl:before { content: 'tcl'; }
+ pre.src-tex:before { content: 'TeX'; }
+ pre.src-plain-tex:before { content: 'Plain TeX'; }
+ pre.src-verilog:before { content: 'Verilog'; }
+ pre.src-vhdl:before { content: 'VHDL'; }
+ pre.src-xml:before { content: 'XML'; }
+ pre.src-nxml:before { content: 'XML'; }
+ /* add a generic configuration mode; LaTeX export needs an additional
+ (add-to-list 'org-latex-listings-langs '(conf " ")) in .emacs */
+ pre.src-conf:before { content: 'Configuration File'; }
+
+ table { border-collapse:collapse; }
+ caption.t-above { caption-side: top; }
+ caption.t-bottom { caption-side: bottom; }
+ td, th { vertical-align:top; }
+ th.org-right { text-align: center; }
+ th.org-left { text-align: center; }
+ th.org-center { text-align: center; }
+ td.org-right { text-align: right; }
+ td.org-left { text-align: left; }
+ td.org-center { text-align: center; }
+ dt { font-weight: bold; }
+ .footpara { display: inline; }
+ .footdef { margin-bottom: 1em; }
+ .figure { padding: 1em; }
+ .figure p { text-align: center; }
+ .equation-container {
+ display: table;
+ text-align: center;
+ width: 100%;
+ }
+ .equation {
+ vertical-align: middle;
+ }
+ .equation-label {
+ display: table-cell;
+ text-align: right;
+ vertical-align: middle;
+ }
+ .inlinetask {
+ padding: 10px;
+ border: 2px solid gray;
+ margin: 10px;
+ background: #ffffcc;
+ }
+ #org-div-home-and-up
+ { text-align: right; font-size: 70%; white-space: nowrap; }
+ textarea { overflow-x: auto; }
+ .linenr { font-size: smaller }
+ .code-highlighted { background-color: #ffff00; }
+ .org-info-js_info-navigation { border-style: none; }
+ #org-info-js_console-label
+ { font-size: 10px; font-weight: bold; white-space: nowrap; }
+ .org-info-js_search-highlight
+ { background-color: #ffff00; color: #000000; font-weight: bold; }
+ .org-svg { }
+</style>
+<style type="text/css">
+ body {
+ max-width: 35cm !important;
+ }
+ #content {
+ max-width: 80em !important;
+ width: 90%;
+ }
+ </style>
+<link rel="stylesheet" type="text/css" href="https://thomasf.github.io/solarized-css/solarized-dark.min.css" />
+</head>
+<body>
+<div id="content" class="content">
+<h1 class="title">Simulation</h1>
+<div id="table-of-contents" role="doc-toc">
+<h2>Table of Contents</h2>
+<div id="text-table-of-contents" role="doc-toc">
+<ul>
+<li><a href="#org187906b">1. Explosion simulator</a></li>
+<li><a href="#org5e5f63c">2. Gravity in 2D</a></li>
+<li><a href="#org959c6bb">3. Gravity in 3D</a></li>
+<li><a href="#orgaad08ff">4. Interference</a></li>
+<li><a href="#orgfcd4eec">5. Interferogram</a></li>
+<li><a href="#org6429047">6. Surface tension</a></li>
+<li><a href="#orgba5018d">7. Wave 1</a></li>
+<li><a href="#orgce1b523">8. Wave 2</a></li>
+</ul>
+</div>
+</div>
+<style>
+ .flex-center {
+ display: flex; /* activate flexbox */
+ justify-content: center; /* horizontally center anything inside */
+ }
+
+ .flex-center video {
+ width: min(90%, 1000px); /* whichever is smaller wins */
+ height: auto; /* preserve aspect ratio */
+ }
+
+ .responsive-img {
+ width: min(100%, 1000px);
+ height: auto;
+ }
+</style>
+
+<div id="outline-container-org187906b" class="outline-2">
+<h2 id="org187906b"><span class="section-number-2">1.</span> Explosion simulator</h2>
+<div class="outline-text-2" id="text-1">
+<p>
+This QBasic program simulates the propagation of shock waves in a gas
+within a confined space. It models the behavior of pressure and
+velocity in a two-dimensional grid, providing a visual representation
+of how shock waves interact with boundaries and each other.
+</p>
+
+<p>
+The program initializes a 100x100 grid to represent pressure and
+velocity values. It sets up initial conditions, including placing
+pressure disturbances and defining boundary walls.
+</p>
+
+<p>
+The core of the program is a loop that continuously updates the
+pressure and velocity values. The velocities in the horizontal and
+vertical directions are updated based on pressure differences between
+adjacent grid points. The program checks for and corrects negative
+pressure values to ensure physical realism. The pressure grid is
+updated based on the current velocities. The program handles boundary
+conditions by setting velocities to zero at wall boundaries.
+</p>
+
+
+<div id="org4b80f69" class="figure">
+<p><a href="Explosion%20simulator.bas" class="responsive-img"><img src="Explosion%20simulator.png" alt="Explosion%20simulator.png" class="responsive-img" /></a>
+</p>
+</div>
+
+<p>
+<a href="Explosion%20simulator.bas">Source code</a>
+</p>
+</div>
+</div>
+
+<div id="outline-container-org5e5f63c" class="outline-2">
+<h2 id="org5e5f63c"><span class="section-number-2">2.</span> Gravity in 2D</h2>
+<div class="outline-text-2" id="text-2">
+<p>
+The Gravitation Simulation program is a simple yet insightful QBasic
+application that simulates the gravitational interaction between a
+central mass and an orbiting object in a two-dimensional space. This
+program provides a visual representation of how gravitational forces
+influence the motion of celestial bodies, making it an excellent
+educational tool for understanding basic orbital mechanics.
+</p>
+
+
+<div id="org2742953" class="figure">
+<p><a href="Gravity%20in%202D.bas" class="responsive-img"><img src="Gravity%20in%202D.png" alt="Gravity%20in%202D.png" class="responsive-img" /></a>
+</p>
+</div>
+
+<p>
+<a href="Gravity%20in%202D.bas">Source code</a>
+</p>
+</div>
+</div>
+
+<div id="outline-container-org959c6bb" class="outline-2">
+<h2 id="org959c6bb"><span class="section-number-2">3.</span> Gravity in 3D</h2>
+<div class="outline-text-2" id="text-3">
+<p>
+This QBasic program simulates the gravitational interactions between
+spheres in a three-dimensional space. It provides a visual
+representation of how spheres might move under the influence of
+gravitational forces, offering an educational insight into basic
+physics principles.
+</p>
+
+<p>
+When spheres are far apart, gravity is dominating force. When Distance
+between spheres crosses critical threshold, much stronger repulsive
+force emerges and becomes dominant.
+</p>
+
+<p>
+There is also friction. This ensures that after some bouncing, spheres
+will reach stable configuration.
+</p>
+
+<div class="flex-center">
+ <video controls loop autoplay>
+ <source src="Gravity%20in%203D.webm" type="video/webm">
+ Your browser does not support the video tag.
+ </video>
+</div>
+
+<p>
+<a href="Gravity%20in%203D.bas">Source code</a>
+</p>
+</div>
+</div>
+
+<div id="outline-container-orgaad08ff" class="outline-2">
+<h2 id="orgaad08ff"><span class="section-number-2">4.</span> Interference</h2>
+<div class="outline-text-2" id="text-4">
+<p>
+This QBasic program simulates the interference pattern created by two
+sine waves with slightly different frequencies. It visually
+demonstrates how wave interference works, which is a fundamental
+concept in physics and engineering, particularly in the study of
+sound, light, and other wave phenomena.
+</p>
+
+<p>
+Program combines two waves to create an interference pattern, which is
+displayed as a third waveform.
+</p>
+
+<div class="flex-center">
+ <video controls loop autoplay>
+ <source src="Interference.webm" type="video/webm">
+ Your browser does not support the video tag.
+ </video>
+</div>
+
+<p>
+<a href="Interference.bas">Source code</a>
+</p>
+</div>
+</div>
+
+<div id="outline-container-orgfcd4eec" class="outline-2">
+<h2 id="orgfcd4eec"><span class="section-number-2">5.</span> Interferogram</h2>
+<div class="outline-text-2" id="text-5">
+<p>
+This QBasic program simulates the interference pattern created by
+multiple frequencies interacting with each other. The result is a
+visual representation known as an interferogram, which is commonly
+used in physics and engineering to analyze wave interactions.
+</p>
+
+
+<div id="org39ac305" class="figure">
+<p><a href="Interferogram.bas" class="responsive-img"><img src="Interferogram.png" alt="Interferogram.png" class="responsive-img" /></a>
+</p>
+</div>
+
+<p>
+<a href="Interferogram.bas">Source code</a>
+</p>
+</div>
+</div>
+
+<div id="outline-container-org6429047" class="outline-2">
+<h2 id="org6429047"><span class="section-number-2">6.</span> Surface tension</h2>
+<div class="outline-text-2" id="text-6">
+<p>
+This QBasic program simulates the behavior of water spills and the
+subsequent effects of surface tension using cellular automata
+rules. The simulation models how water spreads and how surface tension
+affects the shape of the water body, particularly smoothing out sharp
+edges over time.
+</p>
+
+<p>
+The main loop continuously calculates the next state of each cell
+based on the surface tension rules. It uses the Moore neighborhood,
+which includes all eight surrounding cells, to determine the state of
+each cell in the next iteration.
+</p>
+
+<p>
+The rules dictate that a water cell survives only if surrounded by a
+moderate density of other water cells, while an empty space becomes a
+water cell if surrounded by a high density of water cells.
+</p>
+
+
+<div id="org9e2b24d" class="figure">
+<p><a href="Surface%20tension.bas" class="responsive-img"><img src="Surface%20tension.png" alt="Surface%20tension.png" class="responsive-img" /></a>
+</p>
+</div>
+
+<p>
+<a href="Surface%20tension.bas">Source code</a>
+</p>
+</div>
+</div>
+
+<div id="outline-container-orgba5018d" class="outline-2">
+<h2 id="orgba5018d"><span class="section-number-2">7.</span> Wave 1</h2>
+<div class="outline-text-2" id="text-7">
+<p>
+This QBasic program simulates the propagation of waves across a
+surface. It provides a visual representation of wave dynamics, which
+can be both educational and a source of inspiration for those
+interested in physics simulations or algorithmic art.
+</p>
+
+<p>
+The program updates the velocity and height of each point based on the
+calculated averages, applying a damping factor to simulate energy
+loss.
+</p>
+
+
+<div id="org820684a" class="figure">
+<p><a href="Wave%201.bas" class="responsive-img"><img src="Wave%201.png" alt="Wave%201.png" class="responsive-img" /></a>
+</p>
+</div>
+
+<p>
+<a href="Wave%201.bas">Source code</a>
+</p>
+</div>
+</div>
+
+<div id="outline-container-orgce1b523" class="outline-2">
+<h2 id="orgce1b523"><span class="section-number-2">8.</span> Wave 2</h2>
+<div class="outline-text-2" id="text-8">
+<p>
+This QBasic program simulates and visualizes the behavior of water
+waves on a 2D surface. It creates a dynamic animation of water
+disturbed by random rain droplets, demonstrating how waves propagate
+and interact with each other. The program is an example of a simple
+physics simulation and can serve as an educational tool for
+understanding wave mechanics.
+</p>
+
+
+<div id="org2e6254c" class="figure">
+<p><a href="Wave%202.bas" class="responsive-img"><img src="Wave%202.png" alt="Wave%202.png" class="responsive-img" /></a>
+</p>
+</div>
+
+<p>
+<a href="Wave%202.bas">Source code</a>
+</p>
+</div>
+</div>
+</div>
+<div id="postamble" class="status">
+<p class="date">Created: 2025-07-29 ti 03:58</p>
+<p class="validation"><a href="https://validator.w3.org/check?uri=referer">Validate</a></p>
+</div>
+</body>
+</html>
--- /dev/null
+#+TITLE: Simulation
+#+LANGUAGE: en
+#+LATEX_HEADER: \usepackage[margin=1.0in]{geometry}
+#+LATEX_HEADER: \usepackage{parskip}
+#+LATEX_HEADER: \usepackage[none]{hyphenat}
+
+#+OPTIONS: H:20 num:20
+#+OPTIONS: author:nil
+
+#+begin_export html
+<style>
+ .flex-center {
+ display: flex; /* activate flexbox */
+ justify-content: center; /* horizontally center anything inside */
+ }
+
+ .flex-center video {
+ width: min(90%, 1000px); /* whichever is smaller wins */
+ height: auto; /* preserve aspect ratio */
+ }
+
+ .responsive-img {
+ width: min(100%, 1000px);
+ height: auto;
+ }
+</style>
+#+end_export
+
+* Explosion simulator
+
+This QBasic program simulates the propagation of shock waves in a gas
+within a confined space. It models the behavior of pressure and
+velocity in a two-dimensional grid, providing a visual representation
+of how shock waves interact with boundaries and each other.
+
+The program initializes a 100x100 grid to represent pressure and
+velocity values. It sets up initial conditions, including placing
+pressure disturbances and defining boundary walls.
+
+The core of the program is a loop that continuously updates the
+pressure and velocity values. The velocities in the horizontal and
+vertical directions are updated based on pressure differences between
+adjacent grid points. The program checks for and corrects negative
+pressure values to ensure physical realism. The pressure grid is
+updated based on the current velocities. The program handles boundary
+conditions by setting velocities to zero at wall boundaries.
+
+#+attr_html: :class responsive-img
+#+attr_latex: :width 1000px
+[[file:Explosion%20simulator.bas][file:Explosion%20simulator.png]]
+
+[[file:Explosion%20simulator.bas][Source code]]
+
+* Gravity in 2D
+
+The Gravitation Simulation program is a simple yet insightful QBasic
+application that simulates the gravitational interaction between a
+central mass and an orbiting object in a two-dimensional space. This
+program provides a visual representation of how gravitational forces
+influence the motion of celestial bodies, making it an excellent
+educational tool for understanding basic orbital mechanics.
+
+#+attr_html: :class responsive-img
+#+attr_latex: :width 1000px
+[[file:Gravity%20in%202D.bas][file:Gravity%20in%202D.png]]
+
+[[file:Gravity%20in%202D.bas][Source code]]
+
+* Gravity in 3D
+
+This QBasic program simulates the gravitational interactions between
+spheres in a three-dimensional space. It provides a visual
+representation of how spheres might move under the influence of
+gravitational forces, offering an educational insight into basic
+physics principles.
+
+When spheres are far apart, gravity is dominating force. When Distance
+between spheres crosses critical threshold, much stronger repulsive
+force emerges and becomes dominant.
+
+There is also friction. This ensures that after some bouncing, spheres
+will reach stable configuration.
+
+#+begin_export html
+<div class="flex-center">
+ <video controls loop autoplay>
+ <source src="Gravity%20in%203D.webm" type="video/webm">
+ Your browser does not support the video tag.
+ </video>
+</div>
+#+end_export
+
+[[file:Gravity%20in%203D.bas][Source code]]
+
+* Interference
+
+This QBasic program simulates the interference pattern created by two
+sine waves with slightly different frequencies. It visually
+demonstrates how wave interference works, which is a fundamental
+concept in physics and engineering, particularly in the study of
+sound, light, and other wave phenomena.
+
+Program combines two waves to create an interference pattern, which is
+displayed as a third waveform.
+
+#+begin_export html
+<div class="flex-center">
+ <video controls loop autoplay>
+ <source src="Interference.webm" type="video/webm">
+ Your browser does not support the video tag.
+ </video>
+</div>
+#+end_export
+
+[[file:Interference.bas][Source code]]
+
+* Interferogram
+
+This QBasic program simulates the interference pattern created by
+multiple frequencies interacting with each other. The result is a
+visual representation known as an interferogram, which is commonly
+used in physics and engineering to analyze wave interactions.
+
+#+attr_html: :class responsive-img
+#+attr_latex: :width 1000px
+[[file:Interferogram.bas][file:Interferogram.png]]
+
+[[file:Interferogram.bas][Source code]]
+
+* Surface tension
+
+This QBasic program simulates the behavior of water spills and the
+subsequent effects of surface tension using cellular automata
+rules. The simulation models how water spreads and how surface tension
+affects the shape of the water body, particularly smoothing out sharp
+edges over time.
+
+The main loop continuously calculates the next state of each cell
+based on the surface tension rules. It uses the Moore neighborhood,
+which includes all eight surrounding cells, to determine the state of
+each cell in the next iteration.
+
+The rules dictate that a water cell survives only if surrounded by a
+moderate density of other water cells, while an empty space becomes a
+water cell if surrounded by a high density of water cells.
+
+#+attr_html: :class responsive-img
+#+attr_latex: :width 1000px
+[[file:Surface%20tension.bas][file:Surface%20tension.png]]
+
+[[file:Surface%20tension.bas][Source code]]
+
+* Wave 1
+
+This QBasic program simulates the propagation of waves across a
+surface. It provides a visual representation of wave dynamics, which
+can be both educational and a source of inspiration for those
+interested in physics simulations or algorithmic art.
+
+The program updates the velocity and height of each point based on the
+calculated averages, applying a damping factor to simulate energy
+loss.
+
+#+attr_html: :class responsive-img
+#+attr_latex: :width 1000px
+[[file:Wave%201.bas][file:Wave%201.png]]
+
+[[file:Wave%201.bas][Source code]]
+
+* Wave 2
+
+This QBasic program simulates and visualizes the behavior of water
+waves on a 2D surface. It creates a dynamic animation of water
+disturbed by random rain droplets, demonstrating how waves propagate
+and interact with each other. The program is an example of a simple
+physics simulation and can serve as an educational tool for
+understanding wave mechanics.
+
+#+attr_html: :class responsive-img
+#+attr_latex: :width 1000px
+[[file:Wave%202.bas][file:Wave%202.png]]
+
+[[file:Wave%202.bas][Source code]]
export_org_to_html "3D GFX/Miscellaneous"
export_org_to_html "3D GFX/Space"
+export_org_to_html "Math/Plotting"
+export_org_to_html "Math/Simulation"
+export_org_to_html "Math/Truth table"
+
+
# Upload project homepage to the server.
rsync -avz --delete -e 'ssh -p 10006' ./ \
--include="*/" \