<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Robert J Woodhead on Medium]]></title>
        <description><![CDATA[Stories by Robert J Woodhead on Medium]]></description>
        <link>https://medium.com/@MadOverlord?source=rss-9e002cee8dfd------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*QEW-de_OkcSQRkVgYHy-vA.jpeg</url>
            <title>Stories by Robert J Woodhead on Medium</title>
            <link>https://medium.com/@MadOverlord?source=rss-9e002cee8dfd------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 29 Nov 2026 04:26:18 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@MadOverlord/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Optimizing NAND2Tetris assembly code]]></title>
            <link>https://medium.com/@MadOverlord/optimizing-nand2tetris-assembly-code-f378700d0096?source=rss-9e002cee8dfd------2</link>
            <guid isPermaLink="false">https://medium.com/p/f378700d0096</guid>
            <category><![CDATA[optimization]]></category>
            <category><![CDATA[assembly-language]]></category>
            <category><![CDATA[nand2tetris]]></category>
            <dc:creator><![CDATA[Robert J Woodhead]]></dc:creator>
            <pubDate>Fri, 29 Dec 2023 13:54:50 GMT</pubDate>
            <atom:updated>2023-12-29T13:54:50.840Z</atom:updated>
            <content:encoded><![CDATA[<p>One of the joys of writing assembly language code on any processor is that since you are so close to the bare metal, you can indulge in clever optimizations to make your programs smaller and faster. These days, high-level language compilers are very good at finding optimizations, but in the bad old days, there was no substitute for getting your hands dirty and spending hours cutting a cycle or two out of that inner loop.</p><p>The NAND2Tetris Hack machine, because it is such a simple architecture, presents many opportunities for finding these optimizations. Some of these are very machine-specific, but others are applicable in other circumstances. Here are a few that I’ve encountered over the years.</p><h3>Messing with the space/time complexity of the 16-bit multiply</h3><p>The 16-bit multiply routine is one of the homework exercises for NAND2Tetris, and it can be performed in a number of simple ways; for example, here is a relatively straightforward version.</p><pre>// Multiplies R0 and R1 and stores the result in R2.<br>// (R0, R1, R2 refer to RAM[0], RAM[1], and RAM[2], respectively.)<br><br>// IMPORTANT: DOES NOT TRASH R0,R1 (even though the test allows it,<br>// it&#39;s terrible form)<br><br>// Simple multiplier: loops 15 times, using a bitmask to check if an<br>// addition needs to be made.<br><br>(INIT)<br> @R2      // Initialize product (R2) to 0<br> M = 0<br><br> @MASK    // Initialize MASK to 0000...0001<br> M = 1<br><br> @R0      // Initialize Multiplicand to copy of R0<br> D = M<br> @MULC<br> M = D<br><br> @R1      // Initialize Multiplier to copy of R1<br> D = M<br> @MULP<br> M = D<br><br> @15      // # of times through the loop<br> D = A    // (we don&#39;t need to handle the MSBit)<br> @INDEX<br> M = D<br><br>(LOOP)    // Invariant part of this loop is 16 instructions<br><br> @MULP    // MULP = MULP &amp; MASK. If the result is non-zero,<br> D = M    // we need to do an add<br> @MASK<br> D = D &amp; M<br> @NEXT<br> D ; JEQ<br><br> @MULC    // R2 = R2 + MULC<br> D = M<br> @R2<br> M = M + D<br><br>(NEXT)<br><br> @MULC    // MULC = MULC * 2 (Shift Left 1 bit)<br> D = M<br> M = M + D<br><br> @MASK    // MASK = MASK * 2 (Shift left 1 bit)<br> D = M<br> M = M + D<br><br> @INDEX       // Decrement INDEX<br> MD = M - 1   // Store back in INDEX and in D<br> @LOOP        // and loop if non-zero<br> D ; JNE<br><br> @END<br>(END)<br> 0 ; JMP</pre><p>It runs in about 260+4n instructions, where n is the number of 1 bits in the multiplier. Fairly constant time, but clearly we can do better speed-wise (space-wise, it’s about the best you can do). The key to improving overall speed of the code is reducing the number of times we have to loop. The simple algorithm does one loop per bit of the multiplier (15 times since we don’t care about the top bit). However, if we know the position of the topmost 1 bit, then we can quit at that point since there will never be any more additions and the job is complete.</p><p>The straightforward way of doing this requires a slightly more expensive loop (20 invariant instructions vs. 16 for the simple loop). Since the simple loop runs 15 times, that’s 240 instructions. This means that the more complex algorithm is a win whenever the multiplier has 12 or fewer bits we need to check. In addition, because A*B == B*A, we can compare the multiplier and multiplicand and swap them so the multiplier is the smaller number. This means that the simple algorithm only wins when *both* the multiplier and multiplicand have 12 or more significant bits — and since the result is a 15 bit number, you’re not going to get a usable result in that case anyway! So the more complex loop is a *win*</p><p>The trick therefore is finding a simple way to determine if we have any more bits we need to check in the Multiplier. The way we do this is use a negative mask to strip bits out of it one at a time; if it ever becomes 0, then we know we are done, and if the bit-stripping changes it, we know the bit in question is a 1. This also means we don’t need a loop counter, but we do need a copy of the Multiplier.</p><pre>// Multiplies R0 and R1 and stores the result in R2.<br>// (R0, R1, R2 refer to RAM[0], RAM[1], and RAM[2], respectively.)<br><br>// IMPORTANT: DOES NOT TRASH R0,R1 (even though the test allows it,<br>// it&#39;s terrible form)<br><br>(INIT)<br> @R2      // Initialize product (R2) to 0<br> M = 0<br><br> @MASK    // Initialize MASK to 1111...1110<br> M = -1   // which is -2<br> M = M - 1<br><br> @R0      // Check if R0 is negative<br> D = M    // If so, R1 is Multiplier<br> @R0GER1<br> D ; JLT<br> @R1        // Same if R0 &gt;= R1<br> D = D - M  // This minimizes the number of times<br> @R0GER1    // through the main loop.<br> D ; JGE<br><br> @R1      // Initialize Multiplicand to copy of R1<br> D = M<br> @MULC<br> M = D<br><br> @R0      // Initialize Multiplier to copy of R0<br> D = M<br> @MULP<br> M = D<br><br> @LOOP    // Jump to top of loop<br> 0 ; JMP<br><br>(R0GER1)  // R0 &gt;= R1 or R0 &lt; 0, so R1 is MULP<br><br> @R0      // Initialize Multiplicand to copy of R0<br> D = M<br> @MULC<br> M = D<br><br> @R1      // Initialize Multiplier to copy of R1<br> D = M<br> @MULP<br> M = D<br><br>// Efficiency note: We could place a check here to see if MULP is 0 and<br>// exit immediately. This costs 2 instructions on every multiply. Omitting<br>// this check means that if MULP is 0, we&#39;ll go through the loop once (20<br>// instructions), so this is only a win if we expect MULP to be 0 more<br>// than 10% of the time.<br><br>(LOOP)    // D = MULP and non-zero at this point (unless it starts as zero).<br><br> @OMULP   // Save a copy of MULP as it currently is<br> M = D<br><br> @MASK      // MULP = MULP &amp; MASK. Because MASK is a negative mask, only the<br> D = D &amp; M  // bit we currently care about is set to 0 if it is 1. We save<br> @MULP      // the *changed* version back into MULP<br> M = D<br><br> @OMULP   // if MULP == OMULP, nothing to do on this round<br> D = D - M<br> @NEXT<br> D ; JEQ<br><br> @MULC    // R2 = R2 + MULC<br> D = M<br> @R2<br> M = M + D<br><br>(NEXT)<br><br> @MULC    // MULC = MULC * 2 (Shift Left 1 bit)<br> D = M<br> M = M + D<br><br> @MASK    // MASK = MASK * 2 (Shift left 1 bit)<br> D = M<br> M = M + D<br><br> @MULP    // Load up MULP again<br> D = M<br> @LOOP    // and loop if non-zero<br> D ; JNE<br><br> @END<br>(END)<br> 0 ; JMP</pre><p>OK, so what else could we do? Well, if we are not worried about space, and want to go for pure speed, we can consider unrolling the loop. Apart from getting rid of the loop overhead, we don’t have to recompute the mask, since we’ll know what it should be at any particular point. The starting point for this is the unrolled version of the original simple multiplication code.</p><pre>// Multiplies R0 and R1 and stores the result in R2.<br>// (R0, R1, R2 refer to RAM[0], RAM[1], and RAM[2], respectively.)<br><br>// IMPORTANT: DOES NOT TRASH R0,R1 (even though the test allows it,<br>// it&#39;s terrible form)<br><br>// Unrolled simple multiplier<br><br>(INIT)<br> @R2     // Initialize product (R2) to 0<br> M = 0<br><br> @R0     // Initialize Multiplicand to copy of R0<br> D = M<br> @MULC<br> M = D<br><br> @R1     // Initialize Multiplier to copy of R1<br> D = M<br> @MULP<br> M = D<br><br>(BIT0)<br><br> @MULP   // D = MULP &amp; 0000 0000 0000 0001<br> D = M<br> @1<br> D = D &amp; A<br> @BIT0E  // if masked bit is 0, no add<br> D ; JEQ<br><br> @MULC   // R2 = R2 + MULC<br> D = M<br> @R2<br> M = M + D<br><br>(BIT0E)<br><br> @MULC   // MULC = MULC * 2 (Shift Left 1 bit)<br> D = M<br> M = M + D<br><br>(BIT1)<br><br> @MULP   // D = MULP &amp; 0000 0000 0000 0010<br> D = M<br> @2<br> D = D &amp; A<br> @BIT1E  // if masked bit is 0, no add<br> D ; JEQ<br><br> @MULC   // R2 = R2 + MULC<br> D = M<br> @R2<br> M = M + D<br><br>(BIT1E)<br><br> @MULC   // MULC = MULC * 2 (Shift Left 1 bit)<br> D = M<br> M = M + D<br><br>… lots and lots of unrolled components omitted …<br><br>(BITE)<br><br> @MULP   // D = MULP &amp; 0100 0000 0000 0000<br> D = M<br> @16384<br> D = D &amp; A<br> @BITEE  // if masked bit is 0, no add<br> D ; JEQ<br><br> @MULC   // R2 = R2 + MULC<br> D = M<br> @R2<br> M = M + D<br><br>(BITEE)<br><br> // no need to shift MULC anymore!<br><br> @END<br>(END)<br> 0 ; JMP</pre><p>This is a pretty good improvement; the invariant part goes from 16 instructions per bit down to 9. However, we’re executing the entire string of code regardless of what the numbers are. We could do the same swap MULC and MULP and test to see if we have more work to do, but there is a catch — each test that we do slows us down. As it turns out, each test takes 6 cycles, so if we put one on each element in the unrolled loop, we’d have an invariant part of 15 instructions (as opposed to 20 cycles in our negative mask example). This is still an improvement, but note that we don’t have to put the check on each element; if we have statistics on what numbers typically get multiplied, we can place the checks to minimize the average number of cycles.</p><p>In my test, I decided to put the checks after bit 3 and bit 7, like this:</p><pre>(BIT3E)<br><br> @MULP    // Short-circuit check to see if remaining<br> D = M    // bits of MULP are zero<br> @32752   // D = MULP &amp; 0111 1111 1111 0000<br> D = D &amp; A<br> @END<br> D ; JEQ  // If remainder bits are 0, we&#39;re done<br><br> @MULC    // MULC = MULC * 2 (Shift Left 1 bit)<br> D = M<br> M = M + D</pre><p>I worked through a couple of other techniques that might shave instruction cycles but the 6 cycle/test limit is hard to beat. For example, if you can set a variable to 0 or an address, then you can do an indirect jump in 3 instructions:</p><pre> @ADDR    // address of var with address to jump to<br> A = M    // a = address to jump to<br> A ; JNE  // but only jump if A != 0</pre><p>The problem is that you need to set/clear the address variable based on some prior test, and doing this test in &lt; 3 cycles per test is not possible, so there’s no gain in this instance.</p><p>The other major possibility is to borrow from our second example and use a variable to hold a mask. This adds 3 instructions to update the mask, a total of 45 instructions:</p><pre>(BIT0)<br><br> @MULP    // D = MULP &amp; MASK<br> D = M<br> @MASK<br> D = D &amp; M<br> @BIT0E   // if masked bit is 0, no add<br> D ; JEQ<br><br> @MULC    // R2 = R2 + MULC<br> D = M<br> @R2<br> M = M + D<br><br>(BIT0E)<br><br> @MULC    // MULC = MULC * 2 (Shift Left 1 bit)<br> D = M<br> M = M + D<br><br> @MASK    // MASK = MASK * 2<br> D = M<br> M = M + D</pre><p>However, it means that if we can compute the position of the top bit in less than 45 instructions, we can then jump directly into the middle of the unrolled loop at the correct position so that only the right number of sections get executed (ie: if there are 3 bits in the multiplier, only the last 3 sections run). We can definitely do this by using a 4-level binary tree search, and each node would look like this:</p><pre> @MULP         // D = MULP &amp; some mask value<br> D = M<br> @&lt;Some Mask Value&gt;<br> D = D &amp; M<br> @&lt;Some Node&gt;  // if result is 0, branch<br> D ; JEQ<br><br> // fall through to another node</pre><p>Half the time, we’d fall through and wouldn’t have to reload the multiplier, so it’s an average of 5 cycles per node = 20 cycles plus a jump (2 cycles) = 22 cycles. So we can do this with an overhead of ~22 + 3 cycles per bit in the multiplier. This is probably better than just checking after bit 3 and 7, but only profiling will tell you for sure.</p><h3>Using Lookup Tables</h3><p>Replacing a whole calculation with a simple lookup in a pre-computed table is always a big win. For example, here’s the code from my <a href="https://github.com/RJWoodhead/Nand2Tetris-Life/tree/main">Life implementation</a> that computes the address of a cell given the X and Y coordinates:</p><pre> @Life.y         // Cell Address = Board.Row[Life.y] + Life.x<br> D = M<br> @Board.Row<br> A = A + D<br> D = M<br><br> @Life.x         // Add in X value to get the address<br> D = D + M       // of the cell we want to toggle</pre><p>The problem is that the Hack machine doesn’t have any easy way to preload tables, since the instruction memory isn’t directly readable by the machine. So in order to use tables, you have to write code to initialize them and run it when your program starts.</p><p>In my first implementation of Life, I just wrote a Python script to generate the code, but when I decided to really optimize the code and expand to a 128x64 grid size, I ended up writing an <a href="https://github.com/RJWoodhead/Nand2Tetris-Life/blob/main/assembler.py">improved assembler</a> that lets you predefine tables; it then generates some simple code to initialize the tables and injects it into the program.</p><p>So you get to write code like this:</p><pre>$BlinkMask(4)=0b0000000000000110,0b0000000001100000,0b0000011000000000,0b0110000000000000</pre><p>Basically, every time I ran into a limitation of the stock assembler, I added a feature to address it; stuff like simple expression arithmetic, variable initialization, symbol tables, memory allocation, bitmap import and so on. If you decide to do some heavy-duty programming in Hack, you may find it useful.</p><h3>Sleazy Assembly Language Tricks</h3><p>One of the fun things about assembly code is that you can break the rules anytime you want — just be sure to clearly document your crimes against good coding practice so that the next poor soul who has to read your code won’t want to hunt you down and murder you (note that this person is often future-you…).</p><p>For example:</p><ul><li>If the last thing a called function does is call another function, you can just jump to it instead, and have it return to the original caller.</li><li>If you have a big switch statement where everything ends with calling a function (for example, decoding a keypress and deciding what to do), just set up the stack first, then decide what function to call. But remember to clean up the stack if you end up not calling anything.</li><li>You can often eliminate a loop variable if you have a way of detecting an “end of array” state. For example, if you have an array that always contains non-negative values, you can append a -1 value to the array, and if you ever load a negative value (which is a simple thing to check) you know you’re done.</li><li>Loop unrolling is a big win, and the smaller the loop body, the bigger the win is.</li><li>Since the Hack machine has only two registers, rearranging your code to avoid having to reload a register is a win — and since loading a value into the D register requires two instructions, it’s worth paying an instruction to avoid this.</li><li>Since you can only directly load 15-bit numbers into A, if you want to set A or D to a 16-bit unsigned quantity (one with the high-bit set), load A with the inverse of the desired number (which will be 15-bit) and then NOT it (which will always set the high-bit).</li></ul><p>If you read through the Life.asm code in the github repo, I’ve documented most of the hacks I used to squeeze out cycles in the critical code paths. Enjoy!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f378700d0096" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Rapidly Rebooting Roamio and the Flashing Lights of Doom]]></title>
            <link>https://medium.com/@MadOverlord/rapidly-rebooting-roamio-and-the-flashing-lights-of-doom-59e25951c527?source=rss-9e002cee8dfd------2</link>
            <guid isPermaLink="false">https://medium.com/p/59e25951c527</guid>
            <category><![CDATA[roamio]]></category>
            <category><![CDATA[tivo]]></category>
            <category><![CDATA[repair]]></category>
            <dc:creator><![CDATA[Robert J Woodhead]]></dc:creator>
            <pubDate>Mon, 10 Oct 2022 06:31:26 GMT</pubDate>
            <atom:updated>2022-10-10T06:31:26.083Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/800/1*r4ZyxMysMR1aYtUUikJxqA.jpeg" /></figure><p>This weekend, our beloved TiVo Roamio started repeatedly rebooting every few seconds. Occasionally it would “catch” and continue to reboot, only to end up showing the dreaded “four flashing lights of doom” that indicates a hard drive failure.</p><p>This post is my way of documenting the troubleshooting process for “The Next Poor Bastard.” I’ve gathered together everything I learned in an evening’s “adventure”.</p><h3>Step The First — More Power</h3><p>A common cause of booting problems on the Roamio is insufficient power. The stock power brick is a dainty little 12V, 2A, (+) tip / (-) ring device. Over time, the Roamio (and especially the hard drive) can require more power during startup than the brick can provide.</p><p><em>If your Roamio is continually rebooting every few seconds, this is almost certainly the problem.</em></p><p>To address this, you will need to get another power brick with <strong>the same voltage, polarity and plug size</strong>, but a higher amperage rating. With any luck, you may have such a brick in use on another device; in my case, I had an external hard drive enclosure that had a 3A brick.</p><p>Swap in the beefier brick and see if the TiVo starts working again. If so, great! If you need a permanent replacement, here is a <a href="https://www.amazon.com/gp/product/B07KR392XQ/ref=ppx_yo_dt_b_asin_title_o00_s00?ie=UTF8&amp;th=1">5A adapter available on Amazon</a> that another Roamio user had good results with. Rumor also has it that if you call TiVo and complain, they’ll send you a replacement 3A brick.</p><p><em>I initially swapped in another 2A brick, which was just enough of an improvement to get the Roamio to the Flashy Lights of Doom stage. So I went down a blind alley for a while, but learned some stuff that might help you.</em></p><h3>Step The Second — The Flashy Lights of Doom</h3><p>If your Roamio reboots, but after a minute or so all the front panel lights start flashing, the most likely problem is a bad hard drive.</p><p>Here is a <a href="https://www.youtube.com/watch?v=mMDf28vdcdM">decent Youtube video</a> about swapping/upgrading your Roamio hard drive. I happened to have a leftover 500GB hard drive, so I plugged it in.</p><p><em>Apparently, the Roamio will reformat a new drive automatically, though in my case I reformatted it using the Mac Disk Utility and gave it an Apple Partition Map (this was because I was trying different things before I realized it was a power problem after all). If you want to zap a drive back to basics in Windows, you can use </em><a href="https://winaero.com/securely-wipe-disk-diskpart-windows-10/"><em>DiskPart</em></a><em> to to this.</em></p><p>Once you pop the old drive out, you may want to check it with a drive utility like Hard Drive Sentinel on Windows. If it is still readable, there is a community utility called <a href="https://www.tivocommunity.com/threads/dvr-backup-and-restore-software-for-windows-dvrbars.503261/">DVRBars</a> that might let you copy all your programs and settings onto a new drive (also handy if increasing the size of your hard drive).</p><p>If you have an older TiVo, you can also use DVRBars to format the new hard drive with the correct initial software. <a href="https://www.tivocommunity.com/threads/tivo-restore-image-archive.582020/">Here is an archive of images for various TiVo models</a>.</p><p>If you end up with a new drive and can’t copy over your prior settings, you will have to go through the setup process again, enter your season passes, etc. Oh well.</p><h3>Step The Third — CableCard Conundrums</h3><p>As it happens, we have a CableCard / Tuning Adapter in our Roamio, and when it rebooted properly after being down for 24 hours, the CableCard was no longer authorized. I have no idea if it would have come back on its own, but the natives were restless so it behooved me to get it back working ASAP.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/1*r4ZyxMysMR1aYtUUikJxqA.jpeg" /></figure><p>Our service provider is Spectrum, and they are not making it easy to get support for CableCards anymore. All of the CableCard support pages on their website have useless contact links that don’t get you to people who can actually do anything, and in one case a rep told me that CableCards were no longer supported and that I needed to get their DVR instead. 1-Star for you.</p><p>However, a little google-fu found the cunningly hidden <strong>Spectrum CableCard Support Phone Number : 866–532–2598</strong>. One call, and the very helpful gentleman on the other end of the line sent some magic packets that got everything working. 5-Stars for him.</p><p>Now <strong><em>She Who Must Be Obeyed</em></strong> has her precious TV-Japan again (which, btw, is the only reason we haven’t cut the cord yet).</p><h3>Step The Fourth — It didn’t work! Now what?!</h3><p>If after all this your TiVo isn’t back and running, it’s time to engage the services of a real expert. You should consider contacting <a href="https://www.weaknees.com/"><strong>Weaknees</strong></a>; they can do all sorts of TiVo repairs, and were helpful during my initial wailing and gnashing of teeth stage.</p><p>In any case, I hope this will be helpful to someone down the line. If so, let me know!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=59e25951c527" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Hacking Autocomplete Priority in Thunderbird]]></title>
            <link>https://medium.com/@MadOverlord/hacking-autocomplete-priority-in-thunderbird-c79093e56d8?source=rss-9e002cee8dfd------2</link>
            <guid isPermaLink="false">https://medium.com/p/c79093e56d8</guid>
            <category><![CDATA[thunderbird-support]]></category>
            <category><![CDATA[email]]></category>
            <category><![CDATA[thunderbird]]></category>
            <dc:creator><![CDATA[Robert J Woodhead]]></dc:creator>
            <pubDate>Mon, 11 Feb 2019 20:42:51 GMT</pubDate>
            <atom:updated>2019-02-11T20:42:51.276Z</atom:updated>
            <content:encoded><![CDATA[<p>Mozilla Thunderbird has a useful autocomplete feature when entering email addresses; it displays all the partial matches to whatever you’ve typed in, sorted by how often the email addresses have been used. This means that the most-used email addresses tend to be at the top of the list.</p><p>Unfortunately, sometimes you want to force a particular email address to be the top search result, and there is no way to do this in Thunderbird itself. I ran into this problem when I did a little cleanup on my address book and accidentally deleted the listing for <strong><em>She Who Must Be Obeyed</em></strong>.</p><p>Until this unfortunate event, since I email her many times daily, all I had to do to enter her email address was type “n” and hit tab. But after recreating the address book entry, it now had a low usage count, and a mindless n-tab sent email to the wrong person, who was no doubt perplexed by my sudden profession of undying love and devotion.</p><p>To fix this, I had to hack the <strong>abook.mab</strong> file in my <a href="https://www.lifewire.com/thunderbird-profile-directory-1173093">thunderbird default profile</a>.</p><p><strong>Mork from Ork</strong></p><p>The file is a text formatted file (yeah!) encoded in a very complex, obscure, and largely undocumented format called <a href="https://wiki.mozilla.org/Address_Book">Mork</a>. As far as I can tell, the header of the file is a long list of <strong>&lt;hex-number=text string&gt;</strong> listings that basically contain all the unique strings in the address book. This is followed by a series of address book entries that are encoded as sparse vectors of <strong>(^name^value)</strong> pairs that reference those unique strings or <strong>(^name=value)</strong> pairs that specify an actual value. But with a little digging you can tweak the file to bump up the priority of an address book entry.</p><p><strong>Safety First</strong></p><p>Quit Thunderbird. Make a copy of abook.mab in case you screw up. <a href="https://www.lifewire.com/thunderbird-profile-directory-1173093">Find and open</a> abook.mab in a good text editor (one that won’t mess up the encoding when it saves!)</p><p><strong>Decode the Alien Language</strong></p><p>Search from the start of the file for the string “=PopularityIndex”. You’ll find an entry that looks like “<strong>(8F=PopularityIndex)</strong>”, though the hex prefix will probably be different. Write down this number.</p><p>Search from the start of the file for the string “=PrimaryEmail” and record the number. In my case it was 89. Near it you will find numbers for LowerCasePrimaryEmail, SecondEmail, and DefaultEmail. Write these numbers down as well.</p><p>Search from the start of the file for the email address you want to prioritize and note the number. In my case, I found 901.</p><p><strong>Prioritize!</strong></p><p>Now do a find-all for “^E)” where E is the email address number. So I searched for “^901)”. You’ll probably find more than one hit.</p><p>Address book entries are easy to find. They are contained between [brackets] and start with a sequence number followed by (^name^value) pairs. Just check that one of those pairs means “email address=the one you want”. So something like (^89^901) in my case. Once you’ve confirmed this, look for the popularity index value in the entry. In my case it was (^8F=6). Change the value to a largish decimal number. For example, (^8F=9999).</p><p>If there are more than one matching address book entries, you probably have to change only one per email address so that it defaults to the top.</p><p>Repeat the process for each email address you want to prioritize. Save the file, invoke the blessings of your favorite deity, and relaunch Thunderbird.</p><p>You should now be able to invoke the correct email address with a single keypress.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c79093e56d8" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Fallout 76 Optimal Mutation Farming Strategy]]></title>
            <link>https://medium.com/@MadOverlord/fallout-76-optimal-mutation-farming-strategy-c69277355a7f?source=rss-9e002cee8dfd------2</link>
            <guid isPermaLink="false">https://medium.com/p/c69277355a7f</guid>
            <category><![CDATA[fallout-76]]></category>
            <category><![CDATA[gaming]]></category>
            <category><![CDATA[fallout]]></category>
            <category><![CDATA[bethesda-softworks]]></category>
            <dc:creator><![CDATA[Robert J Woodhead]]></dc:creator>
            <pubDate>Thu, 10 Jan 2019 23:10:00 GMT</pubDate>
            <atom:updated>2019-01-10T23:10:00.494Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*kO4xnbKl_TsWoI2XUCTHjw.jpeg" /></figure><p>Fallout 76 has a feature called <a href="http://fallout.wikia.com/wiki/Fallout_76_mutations">Mutations</a>. A player will <strong><em>randomly</em></strong> gain mutations (there are 19 of them currently) when exposed to radiation, and <strong><em>randomly</em></strong> lose mutations when the radiation exposure is healed (either by taking Radaway™ or using a decontamination shower). In addition, there is a perk called <strong><em>Starched Genes</em></strong> that freezes the player’s mutational state, preventing the gain or loss of mutations.</p><p>Mutations have both positive and negative effects, and the negative effects can be partially ameliorated by the use of the <strong><em>Class Freak</em></strong> perk. This means that, depending on your current character build, there are some mutations that are good, some that are bad, and some that are neutral.</p><p>Finally, it is possible to buy serums at some vendors that will add a specific mutation. These are quite costly however, so there is a time vs. cost tradeoff (including the cost of grinding the caps needed to buy the serums).</p><p>The question then becomes, “if there are <strong>G</strong> good mutations, <strong>B</strong> bad ones, and you are willing to pay for <strong>S</strong> serums, what is the optimal strategy to acquire ≥ (G-S) good mutations, 0 bad mutations, and any number of neutral mutations?”</p><p>Two strategies immediately come to mind…</p><p>The “<strong>Broad</strong>” strategy: Acquire mutations until you get a bad mutation, then remove mutations until the bad mutation is no longer present. Repeat until you have the required number of good mutations and no bad mutations. This strategy ensures that you never have more than one bad mutation.</p><p>The “<strong>Deep</strong>” strategy: Acquire mutations until you have the required number of good mutations, then remove mutations until you have no bad mutations. Repeat until you have the required number of good mutations and no bad mutations.</p><p>Curious, I wrote a quick <a href="https://github.com/RJWoodhead/MutationFarmer">python script</a> to do a Monte-Carlo simulation of the two strategies. I’ve <a href="https://docs.google.com/spreadsheets/d/1aVIOGFClutjMhnN-XTdiXSVXJBlmKUyE_Ui7Wunqdqk/edit?usp=sharing">posted the results in a Google Sheet</a>. Given any number of good mutations, bad mutations, and allowable serums, it will tell you the average number of mutation/demutation cycles you will have to perform to get the desired results.</p><p>TL/DR: The Broad strategy is almost always better, except when there are no bad mutations, in which case they are (as you would expect) equivalent.</p><h3>The Fastest Way to Farm Mutations</h3><p>Fallout 76 limits the rate at which you can get mutations, so after each mutation is obtained, you need to log out of the game and back in again (aka “server-hop”) in order to get another mutation. Since you don’t want to continually suck down Radaway to repair radiation damage, the best places to farm mutations are those that have both radiation sources and a decontamination shower.</p><p>While it is possible to build a CAMP with a decontamination shower near a radiation source, there is an existing game location that is just as convenient — the Emmett Mountain Disposal Site. It has the radiation source, decontamination shower, and as a bonus a power armor spawn, all right at the entrance. The following instructions assume you are using that site.</p><p><strong>Broad Mutation Strategy</strong></p><ol><li>Run in and enter the site. Kill all the Mole Miners in the entry area (hallway, locker room, power room). Equip <strong><em>Ghoulish</em></strong> if you have it (Heals you if you are radded up)</li><li>Unequip <strong><em>Starched Genes</em></strong>. Say “Starched Genes Off” aloud to remind yourself of the state. It sounds stupid, but trust me, it’ll help you avoid mistakes.</li><li>Rad up to 75% or so.</li><li>If you got no mutation, equip <strong><em>Starched Genes</em></strong>. Say “Starched Genes On”. Go to the decontamination shower and clean off the rads. Go back to step 2.</li><li>If the mutation is good or neutral, equip <strong><em>Starched Genes</em></strong>. Say “Starched Genes On”. Go to the Decontamination shower and clean off the rads. Go forward to step 7.</li><li>If the mutation was bad, leave <strong><em>Starched Genes</em></strong> unequipped. Say “Bad Mutation, Starched Genes Still Off”. Go to the decontamination shower, turn it on, and quickly dip into and out of it. Wait a few seconds to see if you lost a mutation. Repeat step 6 until you have lost the bad mutation (you will probably lose several other mutations in the process).</li><li>Check to see if you have the required number of good mutations (you should have no bad mutations). If so, <strong>Mission Accomplished™</strong>. Otherwise, server-hop and go to step 1.</li></ol><p><strong>Deep Mutation Strategy</strong></p><ol><li>Run in and enter the site. Kill all the Mole Miners in the entry area (hallway, locker room, power room). Equip <strong><em>Ghoulish</em></strong> if you have it (Heals you if you are radded up)</li><li>Unequip <strong><em>Starched Genes</em></strong>. Say “Starched Genes Off” aloud to remind yourself of the state. It sounds stupid, but trust me, it’ll help you avoid mistakes.</li><li>Rad up to 75% or so.</li><li>If you got no mutation, equip <strong><em>Starched Genes</em></strong>. Say “Starched Genes On”. Go to the decontamination shower and clean off the rads. Go back to step 2.</li><li>If you do not have the required number of good mutations, equip <strong><em>Starched Genes</em></strong>. Say “Starched Genes On”. Go to the Decontamination shower and clean off the rads. Server-hop and go to step 1.</li><li>If you have any bad mutations, leave <strong><em>Starched Genes</em></strong> unequipped. Say “Bad Mutations, Starched Genes Still Off”. Go to the decontamination shower, turn it on, and quickly dip into and out of it. Wait a few seconds to see if you lost a mutation. Repeat step 6 until you have lost the bad mutation (you will probably lose several other mutations in the process).</li><li>Check to see if you still have the required number of good mutations (you should have no bad mutations). If so, <strong>Mission Accomplished™</strong>. Otherwise, server-hop and go to step 1.</li></ol><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c69277355a7f" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[The Hitch-hiker’s Guide to Colonizing the Galaxy]]></title>
            <link>https://medium.com/@MadOverlord/the-hitch-hikers-guide-to-colonizing-the-galaxy-8e678d6d9d84?source=rss-9e002cee8dfd------2</link>
            <guid isPermaLink="false">https://medium.com/p/8e678d6d9d84</guid>
            <category><![CDATA[science]]></category>
            <category><![CDATA[space]]></category>
            <dc:creator><![CDATA[Robert J Woodhead]]></dc:creator>
            <pubDate>Wed, 20 Sep 2017 03:24:05 GMT</pubDate>
            <atom:updated>2017-09-20T03:24:05.399Z</atom:updated>
            <content:encoded><![CDATA[<h4>All it takes is patience… lots of it. No, really, you have no clue how much…</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/512/1*zvx8IGwfxOPFSEcKX-PVCw.png" /></figure><p>I was thinking the other day about how horribly unfair it was that (absent some causality-mangling loophole in the laws of physics) we’ll never have a fancy warp drive, which makes colonizing the galaxy a serious pain in the ass.</p><p>But then I did a little research, and realized the problem isn’t as daunting as it appears at first glance.</p><p>The basic problem with interstellar travel is the distances involved; in our neck of the galaxy (aptly described by Douglas Adams as being in “the uncharted backwaters of the unfashionable end of the Western Spiral arm”), stars are on average multiple light-years apart. Assuming we can get our Golgafrinchan Space Arks up to 1% of the speed of light, we’re talking centuries of travel time — and if you think teenagers are a pain in the ass, teenagers born in the middle of a 500 year voyage (<em>literally</em> in the middle of nowhere) are going to be completely insufferable.</p><p>However, there is a way around this problem: We don’t have to go to the stars, we just have to wait for the stars to come to us! For you see, as our star and its neighbors wobble around the galactic core (about once every 240 million years), occasionally one comes fairly close to us.</p><p>A quick bit of research reveals an <a href="http://lesswrong.com/lw/ofj/x_risk_update_gliese_710_will_pass_thru_oort_in/">estimate</a> that we get an encounter as close as .21 light-years about once every 36 million years, and in fact we are going to get one with <a href="https://www.aanda.org/articles/aa/abs/2016/11/aa29835-16/aa29835-16.html">Gliese 710 in about 1.35 million years</a>.</p><p>At 1% of the speed of light, .21 light years is about a 25 year trip. That’s a much more reasonable travel time, and will result in much less stress on the long-suffering parental units.</p><p>Of course, I’m assuming that humans (or whatever we evolve into) are still around in 1.35 million years, and that we’re still a spacefaring species. But if we are, we’ll certainly have learned how to live off the resources in a solar system even if it doesn’t have any earthlike planets.</p><p>OK, now we’re in two solar systems. And roughly every 36 million years, we’ll get another encounter. So after another 36 million years (give or take), we’ll have populated four systems. After another 36 million years, 8 systems, and so on.</p><p>If we hop onto a star that tends to be heading deeper into the galaxy, we’ll tend to get more encounters; if we get one one heading out, fewer. But for the purposes of the back-of-envelope calculations, we can assume a constant encounter rate.</p><p>The current estimate is that there are 100–400 billion stars in the <a href="https://en.wikipedia.org/wiki/Milky_Way">Milky Way</a>, so let’s take the high end of that estimate. Remarkably, if we double the number of systems we inhabit every 36 million years, it takes only 38.54 doublings to reach them all — about 1,382 million years.</p><p>Now, of course, the more systems we inhabit, the more likely we are to get an encounter with a star we’ve already occupied. So let’s bump up our estimate to an even 2 billion years.</p><p>Heck, that’s not really very much time in cosmic terms. But we’d better get off our asses and get a move on.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=8e678d6d9d84" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Make an Eclipse Telescope in 10 minutes!]]></title>
            <link>https://medium.com/@MadOverlord/make-an-eclipse-telescope-in-10-minutes-a00ba5a166c8?source=rss-9e002cee8dfd------2</link>
            <guid isPermaLink="false">https://medium.com/p/a00ba5a166c8</guid>
            <category><![CDATA[science]]></category>
            <category><![CDATA[astronomy]]></category>
            <category><![CDATA[kids]]></category>
            <category><![CDATA[eclipse]]></category>
            <dc:creator><![CDATA[Robert J Woodhead]]></dc:creator>
            <pubDate>Thu, 27 Jul 2017 13:49:31 GMT</pubDate>
            <atom:updated>2017-07-27T13:51:09.967Z</atom:updated>
            <content:encoded><![CDATA[<p>Here’s my take on building a simple pinhole telescope for viewing the eclipse next month. This should be a fun project for science-inclined kids of all ages — but given the subject matter, it isn’t a rainy-day project!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*j64TDYffTDCZwsb6-QdKlQ.jpeg" /></figure><p>You will need a mailing tube (the longer the better), aluminum foil, a white paper plate, strong scissors, and hot glue.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*3vXA92N1TTuRSpWHqSszdQ.jpeg" /></figure><p>Cut a trapezoidal slot near one end of the tube. This will be your viewing port. You may need to use a razor knife or hand-saw if the tube is thick.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ecMQ1N-tCxNSdLLHYPbhvg.jpeg" /></figure><p>Trace the end of the tube on the paper plate.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*dvYwY9YAD0nNO_yuNczNlA.jpeg" /></figure><p>Cut out a circular white end-cap. This will be your viewing screen.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*2nkqyjW1Hdhz5cDO0eBpgw.jpeg" /></figure><p>Hot-glue the screen in place onto the end near the hole you just cut. Start with a few dots of glue at the top, carefully position the end-cap, and then glue the edge a few inches at a time. If you try to do it all at once, the glue may cool too much.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*MIMZ-YfB1BO9Y0F9Bssg-w.jpeg" /></figure><p>Cover the other end of the tube with foil, and poke a tiny hole in it with a pin. The smaller the hole, the sharper the image of the sun.</p><blockquote>This is just my first shot at a good pinhole, and I used tinfoil because it was handy. Experiment with other materials and different hole-making techniques — if you find something that works really well, let me know!</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*V4ESl87-qOD58iLizfHl7Q.jpeg" /></figure><p>Mount the telescope on a tripod for ease of aiming. I just rigged a mount using two chopsticks and some scrunchies stolen from <em>She Who Must Be Obeyed</em>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_D0X-OiBnqBYPJzyzzYmKA.jpeg" /></figure><p>Take your telescope outside and point the pinhole end at the sun. You can use its shadow to roughly aim it; when the shadow of the telescope tube is circular, it’s pointed in the right direction.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Vo9uNN00GvusmQvSchelXg.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*7xu0se9n5CLsHSv1ulGJiQ.jpeg" /></figure><p>Look into the viewing port and you should see the image of the sun on the paper plate. The longer the tube, the larger the image will be.</p><blockquote>You can calculate the size of the image this way: Take the diameter of the sun (864,576 miles) divided by the distance to the sun (92,960,000 miles), which equals 0.0093. The image size will be 0.0093 times the length of the tube — in my case, 31.5 inches. So the image is .293 inches wide. The inside diameter of my tube was 4&quot;, and I quickly measured the pixel size of the tube and image — 53 out of 718 pixels, multiply that by 4&quot; and you get .295 inches.</blockquote><p>How long can you make your telescope? I’ve got some PVC pipe in the garage… Hmmm… :)</p><p>PS: if you want to go a little higher-tech, Meade is selling a simple reflector with an eclipse filter and two eyepieces for about $80. You can get it on Amazon.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a00ba5a166c8" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Casting a 1:24 Scale Model of Riding Bean’s Buff the Roadbuster, Part 2]]></title>
            <link>https://medium.com/@MadOverlord/casting-a-1-24-scale-model-of-riding-beans-buff-the-roadbuster-part-2-d4668b09addc?source=rss-9e002cee8dfd------2</link>
            <guid isPermaLink="false">https://medium.com/p/d4668b09addc</guid>
            <category><![CDATA[casting]]></category>
            <category><![CDATA[anime]]></category>
            <category><![CDATA[3d-printing]]></category>
            <category><![CDATA[scale-models]]></category>
            <dc:creator><![CDATA[Robert J Woodhead]]></dc:creator>
            <pubDate>Wed, 14 Jun 2017 15:43:24 GMT</pubDate>
            <atom:updated>2017-06-14T15:43:24.615Z</atom:updated>
            <content:encoded><![CDATA[<p>Continuing our story from <a href="https://medium.com/@MadOverlord/casting-a-1-24-scale-model-of-riding-beans-buff-the-roadbuster-part-1-abe88f01c019">Part 1</a>, the next step was to cast the wheels.</p><p>Since my 3D printer didn’t have high enough resolution to handle the fine details of the tires, I shipped off the 3D files to <a href="http::/shapeways.com/">Shapeways</a> for printing in resin. I also printed the rear spoiler because it was only a few bucks extra and would require less cleanup than printing it at home.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*S3OAIkpfyBVyqSpazMuNpg.jpeg" /></figure><p>Cleanup on these parts required soaking them in soapy water to remove leftover support wax, and very gentle sanding with an Air Eraser (an airbrush accessory) using baking soda as the abrasive.</p><p>Figuring out the right way to cast the wheels turned out to be more difficult than I expected. After a handful of different attempts, I stumbled upon using foil tape (basically, aluminum foil with adhesive on one side) to separate the two halves at the inner edge of the tire.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*0gHobSNwfNBD5L98YV9Vzw.jpeg" /><figcaption>Base, with holes for the axles.</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*P29HutgF5ljwloGuIMmSNg.jpeg" /><figcaption>Foil tape (adhesive up) separates the two halves.</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*3tSImMj9CKbPdIsUHpuhsw.jpeg" /><figcaption>Silicone applied to the tread and fine details of the hub with a brush, to ensure coverage.</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*PQWIfH8o3Mglx-dnzfmDkA.jpeg" /><figcaption>First half has keys cut into it. Note how the crinkled foil also provides a good mating surface for the second part of the mold. Small screws were hot-glued to the rim to make sprues to allow air bubbles to escape.</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*wP9n95Ln2xMZf-UrRJFcFA.jpeg" /><figcaption>When mixing small amounts of resin, using syringes helps you get the quantities exact. You can reuse them, just make sure you can tell which syringe is for part A and which for part B.</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*K0_4dWjsy1NrqhSSzRgzgQ.jpeg" /><figcaption>Casting success rate is about 90%. I have the mold slightly tilted (sprues higher) during the pour to help the air go in the right direction. Then I lay it flat and add a little more plastic.</figcaption></figure><p>The spoiler was made with a similar technique, using the foil to make a seam that makes it easy to get the part out of the mold.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*UAaWUkCLhyXysVj2yoWf9w.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*bz1FnUnPcpK2S9aKrGUwqw.jpeg" /></figure><p>Since I had some time while Shapeways was making the parts, I decided to improve the body model by adding some details and sharpening up the lines. I used <a href="https://www.amazon.com/gp/product/B00MQ7EHHC/ref=oh_aui_detailpage_o08_s01?ie=UTF8&amp;psc=1">Kneadatite</a> epoxy putty as filler material in a lot of places.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*7F8s4U1nV8HPF5EWf8taAQ.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*E2FHjNN-W_KNzs85xE6aFA.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Uvy4PobpEKyi-AcECqf75Q.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*tSSFacJienJB8rrkP7HmZQ.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*vR-5Al5bcPhEGBvvk7ShIw.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*T47Ne8sU9H_k6hJZZPngMw.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*WyCXfOjnv-Ui3vZf_lECeg.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*L2CsOPZZc-Ojp1mRzKzGvQ.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*E77-55er7cAwNz3OqkTtxA.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*VsTTh2V6MYGbUFixWwwMiA.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ba-BZ3ueGjdKhscnQ1CPEQ.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*o7P5fdZHuPyJ9JGKl-xSBg.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*zWxVeuJrweb4hakve-fWMQ.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Xr6yaZ-PSRb1QLIaj64eLw.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*8kWuecsKgwbdMZFO4ZFNjQ.jpeg" /></figure><p>Then I trimmed the new spoiler part and attached it to the body with UV-cure resin. This is the stuff that comes with a blue UV LED that will instantly turn the liquid resin solid; you just apply it, get the parts into the correct position, and shine the light on them to lock them together. It files and sands nicely, which also makes it a perfect filler material for fixing small imperfections in the casts (like the one in the spoiler).</p><p>Here’s the original casting and the new one, side by side:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*pNzzPgU3oMf_5EVd6vjtHg.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*K6nQohnAj3sHhstFIaS9Qg.jpeg" /></figure><p>My next challenge will be painting the model. If there is no part 3 to this build report, you may assume it is because the results were horrific.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d4668b09addc" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[The Rationalist’s Prayer]]></title>
            <link>https://medium.com/@MadOverlord/the-rationalists-prayer-4b81b3e80f86?source=rss-9e002cee8dfd------2</link>
            <guid isPermaLink="false">https://medium.com/p/4b81b3e80f86</guid>
            <category><![CDATA[humanism]]></category>
            <category><![CDATA[humor]]></category>
            <category><![CDATA[philosophy]]></category>
            <category><![CDATA[rationality]]></category>
            <category><![CDATA[science]]></category>
            <dc:creator><![CDATA[Robert J Woodhead]]></dc:creator>
            <pubDate>Wed, 07 Jun 2017 10:03:11 GMT</pubDate>
            <atom:updated>2017-06-07T10:03:11.807Z</atom:updated>
            <content:encoded><![CDATA[<p><em>Inspired by a Facebook post of an acquaintance, I got a little poetic.</em></p><p>Science is my shepherd; I shall not want.</p><p>It makes me embrace rigor; it leads me towards the truth.</p><p>It enlightens my mind: it leads me in the paths of knowledge, for humanity’s sake.</p><p>Yea, though I walk through the valley of the shadow of ignorance, I will fear not the dark: for Science is with me; its methods and accumulated knowledge comfort me.</p><p>Someone presents a paper before me that appears statistically significant, but my acceptance is bayesian; more research is needed.</p><p>Surely doubt and uncertainty shall walk with me all the days of my life. But they are my friends; they guard me from error. I cherish them.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4b81b3e80f86" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Casting a 1:24 Scale Model of Riding Bean’s Buff the Roadbuster, Part 1]]></title>
            <link>https://medium.com/@MadOverlord/casting-a-1-24-scale-model-of-riding-beans-buff-the-roadbuster-part-1-abe88f01c019?source=rss-9e002cee8dfd------2</link>
            <guid isPermaLink="false">https://medium.com/p/abe88f01c019</guid>
            <category><![CDATA[anime]]></category>
            <category><![CDATA[3d-printing]]></category>
            <category><![CDATA[casting]]></category>
            <category><![CDATA[scale-models]]></category>
            <dc:creator><![CDATA[Robert J Woodhead]]></dc:creator>
            <pubDate>Sat, 20 May 2017 22:50:20 GMT</pubDate>
            <atom:updated>2017-10-14T09:47:57.841Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/573/1*4_OYK4pQDyG5amjYfmYk4g.jpeg" /></figure><p>On each of our <a href="https://www.animeigo.com/crowdfunding">Anime crowdfunding projects</a>, I like to do interesting and unusual things. For the <a href="https://www.kickstarter.com/projects/madoverlord/riding-bean-high-octane-edition-anime-blu-ray">Riding Bean</a> project, since one of the main characters is arguably an awesome car, I decided to make a scale model of Buff the Roadbuster for the backers who pledged at the Nitrous-Injected level.</p><p>Natsumi and I engaged a well-known Japanese garage-kit sculptor, Yoshiyama Haruki, to make us a model of Buff, working from the original design drawings as well as feedback from the creator of Riding Bean, Sonoda Ken’ichi.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*xBaECmCx4F857x9KmoPZkw.png" /></figure><p>The end-result was a 1:64 scale model of Buff, which was the starting point for all the delightful insanity that ensued.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*i8sL1cm3o4CL4bt_NRt--Q.jpeg" /></figure><p>So far, so good. But one of the interesting things about these projects is that we continue to let people sign up after the crowdfunding campaign concludes, and those extra signups mean that we can increase the production budget (we try to spend about 50% of the proceeds on the actual production and pre-production costs). And I thought, “wouldn’t it be cool if we could make Buff in a larger size?”</p><p>So I got the model 3D-scanned, and had a bunch of cleanup work done by Mark Bell (a project backer, who even reconstructed the wheels and tires from scratch) and my son James Ueki, resulting in…</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/640/1*Jw7QqUkEPkOF_k_XuUbxtA.png" /></figure><p>After consulting with both Mr. Sonoda and our pocketbooks, we had the parts printed in 1:43 scale by <a href="https://trenchworx.com/">Trenchworx</a> on a very high-resolution resin 3D printer…</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*FSrSYMKhzQxZYkHm09fPAg.jpeg" /></figure><p>…and sent of to the pros at <a href="http://www.on-the-lamb.com/content/">On-The-Lamb</a> for casting.</p><blockquote>They know what they’re doing; I most definitely do not! So they’re probably laughing their asses off while reading this. :)</blockquote><h3>1:43? Didn’t the headline say 1:24?</h3><p>Indeed it did, astute reader. All of this digital and physical modeling had piqued my interest in the whole process of making molds and castings, something I had never done but that related to my family history — my father was a chemist who specialized in resin-coated sand, which is used to make molds for metal casting.</p><p>In addition, Mr. Sonoda had mentioned how it was a pity we couldn’t produce Buff in 1:24 scale, since he really would like one…</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/640/1*UQCTHjG4VLWOLIcL5gtgRw.jpeg" /><figcaption>(Artist’s impression of Sonoda Ken’ichi)</figcaption></figure><p>So I decided to make a big Buff.</p><h3>Printing</h3><p>I’ve had an Ultimaker 3D printer for several years, and it’s a lot of fun. So the first step was to print out the parts in 1:24 scale. As it happens, in 1:24 scale, the main body of Buff just barely fits on the Ultimaker stage — with only a few millimeters to spare! But only if you print it diagonally!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*IQs-DphARqsfdnR1uuas-A.jpeg" /><figcaption>This was a 40-hour print!</figcaption></figure><p>At this point I hadn’t decided on whether I was going to mold and cast the main body as a single part or as a separate body and chassis. If the latter, then I would want the body part to be as thin as possible to save on casting resin, but just scaling up the original part would make it thicker. So I used some free 3D modeling tools (<a href="http://www.meshmixer.com/">Meshmixer</a> and <a href="https://www.netfabb.com/blog/netfabb-basic-now-just-netfabb">Netfabb Basic</a>) to cut away the inside of the body and then recreate the shell with the proper thickness.</p><p>By the time the body print had completed, I decided I’d combine the body and chassis and make a rotacast. This involves making a hollow mold cavity, adding the casting plastic, and then rotating and tumbling the mold while the plastic cures to evenly coat the interior, resulting in a hollow shell — again, saving on casting resin.</p><p>I also decided to make a brush-on mold, which meant that I needed some way of fixturing the model so I had easy access to every side of it. Fortunately, I had a really nice magnetic base, so I epoxied some nuts onto the inside of the chassis print…</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*BkolXE8X9fWDgZ0XXhWTqA.jpeg" /></figure><p>…and drilled some access holes. These would also give me a way of getting the resin into the eventual mold.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*3zff-nnjAP6inRl-UuQRSw.jpeg" /></figure><p>Finally, I filled the entire interior with expanding foam…</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Flkj6UxKU6jZHgnTbElqwg.jpeg" /></figure><p>…and then sculpted the wheel-wells with air-dry clay.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*tkTbXznTlraxWva98R7V1w.jpeg" /></figure><h3>The Hell of Perpetual Sanding</h3><p>Then it was time to get rid of the 3D printing layer lines. This involved rubbing in some Bondo sealer, and sanding…</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*1rl4dXKq5Tey8qH8UKFOyA.jpeg" /></figure><p>…and then adding some more Bondo and doing some more sanding.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Fc1I3F1XybBXD3YWBc4Lrg.jpeg" /></figure><p>Basically, every time I took a break from Real Work, I’d sand the damn model for 10–15 minutes. I think it took 4–5 days of several hours a day, but thankfully I have little memory of this time.</p><h3>You Can’t Cast a Donut</h3><p>One issue I had to address was the geometry of the model, in particular the rear spoiler, which forms a loop. This makes the car topologically equivalent to a donut, which means that the model would get locked into the mold unless the mold was cut in a line that goes through the spoiler (thus breaking the loop). I wanted any mold lines to be hidden on the bottom of the chassis, so I had to eliminate the loop.</p><p>There were two ways to do this: break the model into two parts (the top of the spoiler and everything else), or put a barrier inside the spoiler so the loop wasn’t connected (which would require a little cleanup on each casting to restore the loop). I decided to try the latter approach, and so I created a custom gasket to fit inside the spoiler.</p><p>First, I printed out a slice of the model through the spoiler in exactly the right size, and cut out some thin plastic scavenged from some hard-drive packaging…</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*oiW39n82XstjfCEzFXeAkQ.jpeg" /></figure><p>…and then I laid down a coat of silicone rubber on some foamcore, let it cure, put the plastic cutouts (I made 2 in slightly different sizes) on top of it, and brushed on another thin layer of silicone, encapsulating the cutouts.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*JxPO995GWN5Nzs0kQ-LjnA.jpeg" /></figure><p>The result was a custom gasket that I could push into the spoiler to seal it and break the loop.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*heWXAN_W9rFUMNroAM6KQg.jpeg" /></figure><p>Unfortunately, when I inserted the gasket, the extra pressure it put on the spoiler cracked it at the weakest point (the vertical section) and pretty cleanly separated the top of the spoiler from the main body! This was because thin 3D prints are weak vertically — the layers can separate.</p><p>So physics had decreed that the actual solution was to break the model into two parts. After a little cleanup, I quickly made a 1-part mold for the top of the spoiler…</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*EQKZVAUsBf474r4HUNRuVQ.jpeg" /></figure><p>…and did a test casting. Problem solved.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Uqyw_qQ59C23V_J2Ix6oGQ.jpeg" /></figure><h3>Making the brush-on mold</h3><p>At this point I should mention that I was using <a href="https://www.smooth-on.com/">Smooth-on</a> molding supplies. They have a ton of products for molding and casting, and several handy starter kits. They also have a <a href="https://www.youtube.com/user/SmoothOnInc">ton of instructional videos on YouTube</a> that are very helpful.</p><p>So I started building up the layers of my mold…</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_j5H_SqNzKzG9ou9spl8cw.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*HvIoNwEysFDp2yj_0oxtHw.jpeg" /></figure><p>…and then I prepped and made the support shell.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*IkyNSIn24ZgY-0oVlkr4Fg.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*lKJFcVovGHwDPo5xENbFJA.jpeg" /></figure><p>Finally, I separated the parts, cut the mold (on the bottom on a bevel, to hide any resulting mold marks), and removed the model.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*CJu1TJjAcdjGSsLeJe86Xw.jpeg" /></figure><p>Now it was time for a test casting. For a rotacast, you want to use a resin that cures slowly, to give time for it to get into all the nooks and crannies of your mold. Smooth-on recommends using Smooth-Cast 65D, but I only had some Smooth-Cast 300, which is a snap-cure resin — once it reaches the end of its pot life, it goes from liquid to solid in just a few seconds.</p><p>But since the 65D was one <em>AmazonPrime</em> away (a quantum unit of spacetime that has a high probability of collapsing to 2 days), I decided to give it a test with the 300.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*C9Q0yjtv9yOckEfF9MSoqw.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*7dV5xLWP3uVv2LwEKZNkgQ.jpeg" /></figure><p>Not bad for a first test, but there were some issues. First, I’d washed the mold but apparently didn’t let it try enough, so the plastic couldn’t get to some areas. Also, the snap cure caused some surface imperfections.</p><p>However, the biggest issue (which isn’t visible in the photo above) was that the entire casting had a very slight twist to it. I think this means that my support shell wasn’t doing a good enough job, or perhaps the mold wasn’t seating into the shell properly.</p><p>Whatever the reason, it wasn’t acceptable. So while the 65D was en-route, I decided to try another approach— a simple box mold. This would require more silicone than a brush-on mold, but would be simpler and hopefully harder for me to screw up.</p><p>I got some 6x1 board from Lowes and quickly constructed a solid box. In addition, I made a base plate (the same size as the box bottom) and attached the model to the plate using a trapezoidal prism of non-sulfurous sculpting clay (sulfur inhibits the silicone curing process). Everything was sealed using Super-Seal and then sprayed with Ease Release 200.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*BoJMtyA2hAR6qZZnJ-D5qQ.jpeg" /></figure><p>Here’s how it works. The base and model, along with a few legos that serve as positioning keys, go into the bottom of the box mold…</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*0tmx8B-Nie-ieREfuct-rA.jpeg" /></figure><p>…and then OOMOO 30 silicone is poured on top of it.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*O2WLEQ6WiecWIXhtrh5pzw.jpeg" /></figure><p>Oh damn, ran out of OOMOO goo!</p><h3>Another AmazonPrime Later…</h3><p>As I was saying, OOMOO 30 is poured on top of it (unless you use mold release, it will stick to itself, even after its cured). The result is the first half of our mold.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*lGQpLoZYPicJQApbK1zWOQ.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*DrNI96-sGO_apY9TVlTDoA.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*pXfDeMhvE9vUGyBL1w9iQg.jpeg" /><figcaption>Note the line marked on the box as a guide to how high I needed to fill it</figcaption></figure><p>After the silicone cured, I dropped the top of the box mold into the box so it rested firmly on the silicone rubber, marked the location, drilled a few screw holes, and firmly attached the top.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*C7EYsCWTuAUU3zz0KVaFhg.jpeg" /></figure><p>When the box is turned upside down, the newly attached top now supports the silicone. I then removed a side and the bottom, which let me extract the base plate, clay, and legos, exposing the bottom of the model.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*uZph_WiSOor82UzwCr3TGg.jpeg" /></figure><p>The next step is to cast the second half of the mold. Note how the trapezoidal prism shape and lego keys are going to allow us to precisely reassemble the mold halves, and the prism will support the part of the mold that contains all the chassis details.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*tGxWd0T4-WbdGVIUriqodw.jpeg" /></figure><p>I filled in the bolt holes with some clay, sealed them, and then applied Ease Release 200 to all surfaces; this prevents the new silicone from sticking to the first half of the mold.</p><p>After drilling some filling holes in the bottom plate (forgot to do this earlier), it was reattached to the box mold…</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*u2WbuGs8Gscp_xlkZLHP8w.jpeg" /></figure><p>…and the resulting space is filled with more OOMOO 30. <em>And damn if I didn’t run out again!</em> However, I had enough left to completely cover the model; I just didn’t have enough to fill up the box to where I’d like it to be. I popped in some legos to take up some space, and I’ll try using some other filler material as support. Worst case, I can just get some more OOMOO and add to the mold.</p><p>After it cured, the box was disassembled, the model removed, and now we have our two mold halves!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*IuhSwO-52R8xLoMeDyd2Yw.jpeg" /></figure><p>One mistake I made at this point — my mold walls were on the thick side (which means the mold can’t stretch as easily), and the overhanging edges on the bottom were too wide (I should have just inset a couple of millimeters around the entire bottom perimeter). This meant that I couldn’t extract the original without a little surgery…</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_2nZ6fPPECVGIlnwPIjV9g.jpeg" /></figure><p>Also, while it wasn’t a big issue, my lego keys were rotationally symmetric; only one of them should have been in the “diamond” orientation.</p><p>I also trimmed a bit of the edge of the bottom mold so that I could easily combine the two molds while the top mold was already in the box, and I did a test fit and found that 3 layers of cardboard nicely filled the gap between the bottom mold and the bottom of the box.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*MZQIZsN9ep0Jrm4vAFENxA.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*4SdtVPNTtC941HF_Wl3iVA.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*j0XHHNfEYOwncuh3FbFtCQ.jpeg" /></figure><h3>Cast Away!</h3><p>Now we make a casting. The box was reassembled with the first half of the mold in place. Everything was sprayed with mold release.</p><p>Smooth-Cast 65D was prepared and carefully poured into the mold. The pot life of 65D is 2½ minutes, so I had to move fast. I swished it around a little to make sure it got into all the small areas, like the side view mirrors, then added the second part of the mold and the cardboard, and locked the base in place with screws. Elapsed time: 1:45! Whew!</p><blockquote>I figured out a cute way to estimate the amount of resin I would need. One of the things NetFabb will tell you is the surface area of a model. I used the surface area of the body shell (which has an inside, so it’s roughly twice the surface area of the outside) as a rough estimate of the total surface area of the body + chassis: 1281 cm². I multiplied this by the desired thickness (2mm) to get the volume of resin needed: 256 cm³. The resin weighs 1.05 g/cm³, so I needed 269 g of resin. The two resin parts are mixed in a ratio of 100:93 by weight, so I needed 139.4 gm of Part A and 129.6 gm of Part B.<br> <br>After the casting was done I drilled a hole in the base to test the thickness: 1.67mm. Close enough.</blockquote><p>Then I spent the next 10 minutes slowly tumbling the entire assembly by hand. Given how heavy it was, this was a pretty decent upper-body workout. When the resin residue in the mixing cup turned white and hard, I knew the 65-D had solidified, but I gave it a couple of extra minutes out of pure paranoia, then left everything to fully cure for an hour. And the result was…</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*c-pS-4f0e-qPeRe1HbuEJg.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*mVWx4k6uSNfcchXo1NF_ow.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*8XOZ5_ag_k5DnkPDIHPmfQ.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*VLUeS6gDvzChmX9FoXUwUQ.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*eq1DADGL2zTXbUdwsobJow.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*4ZCjkc4iQh3u4TPTjbAvjQ.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*9__B6LgYlpEQ-bzZfhLJ2Q.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*uDi3Ls8xjBTNOmsvHc2ssw.jpeg" /></figure><p>…pretty good. There was a minor imperfection in the grille and one of the tailpipes, but those should be easy to fix. There was also a minor problem on the axle where I had to do the surgery, which I believe was caused by movement of the the flap I had to create. I did a quick experiment and found that viscous superglue can be used as a temporary silicone adhesive, so I am going to try and use that to lock down the flap in future casting attempts.</p><p>In the upcoming Part II, I’ll cast the wheels. These will be pretty simple, but I didn’t want to do them until I was sure I could do the body because they have a lot of fine detail, so I’m going to get the models printed at a higher resolution than my printer can achieve. No sense paying for that until I was sure I would need them.</p><p>The saga continues in <a href="https://medium.com/@MadOverlord/casting-a-1-24-scale-model-of-riding-beans-buff-the-roadbuster-part-2-d4668b09addc">Part II</a>, and remember to 💚 this article if you enjoyed it.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=abe88f01c019" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Conway’s Game of Life in Elm]]></title>
            <link>https://medium.com/@MadOverlord/conways-game-of-life-in-elm-4ef8f58a6ab0?source=rss-9e002cee8dfd------2</link>
            <guid isPermaLink="false">https://medium.com/p/4ef8f58a6ab0</guid>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[elm]]></category>
            <category><![CDATA[bootstrap]]></category>
            <category><![CDATA[elm-lang]]></category>
            <dc:creator><![CDATA[Robert J Woodhead]]></dc:creator>
            <pubDate>Tue, 14 Feb 2017 01:35:28 GMT</pubDate>
            <atom:updated>2017-02-14T01:36:53.789Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/960/1*ufCkAIwLaD6WdKtICcrm7Q.jpeg" /><figcaption><a href="http://www.madoverlord.com/Elm/Life/#">So as not to bury the lede, you can play with the app here…</a></figcaption></figure><p>I’m always on the lookout for new and interesting programming environments, and for the last few months I’ve been noodling around with <a href="http://www.elm-lang.org/">Elm</a>.</p><p>Elm is a really interesting functional programming language for writing web applications. What makes it particularly attractive is <a href="https://guide.elm-lang.org/">The Elm Architecture</a>, which embeds your purely functional Elm code into a simple and clever loop:</p><ul><li>The user does something on the webpage, which…</li><li>Causes messages to be sent to an <strong>update</strong> function you write, which…</li><li>Updates a <strong>model</strong> that describes the complete state of your application, which…</li><li>Is passed to a <strong>view</strong> function you write that computes what the page should now look like, which…</li><li>Causes the page to be efficiently updated, ready for the user to do something else. <em>Lather, rinse, and repeat!</em></li></ul><p>The Elm language has a simplicity and elegance that appeals to me on an aesthetic level. It’s strongly typed and the compiler bends over backwards to be helpful in pointing out your mistakes. In fact, if your code compiles, it will run — <em>no exceptions!</em> And by that I mean: your code will not generate any exceptions at runtime.</p><p>Needless to say, even though you can rely on your code to do what you <strong><em>tell</em></strong> it to do, it may not do what you <strong><em>want</em></strong> it to do. However, since the complete state of your application is in the model, Elm can implement a <strong>time-traveling debugger </strong>— you can literally rewind the app state at will!</p><p>Recently, I decided I wanted to dig a little deeper and “grok” Elm better, so I decided to implement <a href="https://en.wikipedia.org/wiki/Conway&#39;s_Game_of_Life">Conway’s Game of Life</a> in Elm. Implementing Life has for many years been one of my go-to test exercises when getting used to a new programming language, so it was nice to return to familiar territory.</p><p>I ended up with an app that can:</p><ul><li>Single-step or free-run life generations at various speeds. The board can be set to automatically expand or have edges that wrap.</li><li>Edit, shift, rotate, minimize, zoom, clear and “soup” the board.</li><li>Import boards in .cell and .rle formats, export in .cell.</li><li>Load prestored patterns.</li><li>Detects if running on a touch device and respond accordingly.</li><li>Autoresize.</li></ul><p>Along the way, I learned a lot of intermediate techniques in Elm, including using application flags, javascript ports, subscriptions, currying, pipelines, pattern matching, mapping, filtering and folding, and using the Random library. I also got a lot more familiar with the <a href="http://getbootstrap.com/">Bootstrap.css</a> framework.</p><p>The <a href="https://github.com/RJWoodhead/elm-life">source code is available on GitHub</a> — profusely commented both for the benefit of fellow newbies and the amusement of more experienced Elm programmers. I’m also <a href="http://www.madoverlord.com/Elm/Life/#">hosting the built application here</a>.</p><p>Enjoy! And suggestions, bug-reports, etc., are always appreciated.</p><p>PS: I found the <a href="http://knowthen.com/">KnowThen.com online courses</a> very helpful in learning the basics of Elm. Check them out, the first one is free.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4ef8f58a6ab0" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>