Dan's GitHub Pages This is my first stab a Jekyll design. This will change as I get a bit better at it. Look for new updates periodically. https://brianddk.github.io// Wed, 03 Apr 2024 17:56:19 -0500 Wed, 03 Apr 2024 17:56:19 -0500 Jekyll v3.9.5 Bitcoin Lotto! <p>So by now you may have seen <a href="https://youtu.be/tr3KLCDAlnU">the trailer</a> for the <a href="http://www.cbs.com/shows/big_bang_theory/video/">BBT episode</a> on Bitcoin. If you haven’t seen it, then perhaps you’ve seen one of the endless news stories about it droning on all month long. If so, I offer some help in figuring out how to play the Bitcoin Lotto. I’d advise you think of it as a lotto so if you don’t end up making 500% back on your money you’re not disappointed. It even sounds like there are going to be <em>Bitcoin Options</em> so you can insure the position if you’re interested in that kind of thing. Below I’ll lay out in simple terms how to play the lotto for friends and family.</p> <h2 id="bitcoins-and-other-cryptocurrency">Bitcoins and other Cryptocurrency</h2> <p><em>What is a Bitcoin</em> is a valid question. It’s basically a spot in a ledger. A deed if you will. The difference is that the ledger is unlike any other ledger of its kind. It is encrypted and encoded in a way that makes it completely unforgeable. Even for large government actors. In this way, holding a Bitcoin is irrefutable proof that you can unlock some portion of that ledger and give your entry to someone else. All seems rather like <a href="https://youtu.be/CWu7lIpNvCs">trading tulips</a>, and it is, but then again paper money is similar. It’s a hard to forge proof that you hold some amount of stuff. A Bitcoin is a hard to forge proof that you hold some amount of stuff. Money is backed by your governments authority, bitcoin is backed by millions of hours of computing cycles. Both based on some basic level of <em>trust</em>. Trust the government, or trust the cryptography (computing power).</p> <p>Cryptocurrency is the larger field of all Bitcoin like things. After Bitcoin a bunch of other projects started making similar products. After Apple, there was Windows. After Windows there was Linux. Same with Bitcoin. After Bitcoin there was Litecoin. After that Etherium. Just like Apple/Windows/Linux, some like one choice better than others. As far as I’m concerned, Bitcoin is the lotto ticket with the biggest payout, Litecoin is the easiest to buy/sell/give. Ethereum will likely be the most useful of them all one day</p> <h2 id="how-to-get-them">How to get them</h2> <p>There are a few ways, good and bad, to get Cryptocurrency. Some of them are totally above board, some are a bit less above board, and other are just plain sketchy. Keep in mind, as of right now, sending Bitcoin from point A to point B can cost $5-$10. So if you are convinced you only want Bitcoin, keep that in mind. Other Cryptocurrency like Litecoin were made to be cheap to transact in. I’d advice Litecoin until you have a few $100 dollars in Cryptocurrency, then exchange it for Bitcoin. Here are some general options on buying:</p> <ol> <li><a href="https://www.coinbase.com/dashboard">Coinbase.com</a> - The <em>Bitcoin Bank</em>. This is a US regulated and IRS audited bitcoin shop. Since it’s a US shop it falls under US jurisdiction and you’re a bit less likely for them to just pick up and run off with your money. Also understand that the IRS can legally ask for all customer records. You have to keep close notes of what you buy and sell so that you file your taxes correctly. This isn’t a big thing now, but it will be soon. New accounts can take from 2-4 weeks to be approved by the IRS and other regulators. You will pay about a 2% fee to buy over $200, much higher fees below that.</li> <li><a href="https://www.gdax.com/">GDAX Exchange</a> - This is just another Coinbase site, the difference is that this is the <em>Exchange</em>. That means you can buy on the open market at a lower fee. Here you can buy with no fees for orders over $100. This will take another 1-2 weeks above the Coinbase wait in order to transfer money. Could be quicker with a wire, but those are expensive.</li> <li><a href="https://changelly.com/">Changelly.com</a> - This is a Czech based company that will let you buy Bitcoin with Visa / MasterCard (for now). Similar sites have been shut down by Visa / MasterCard in the past, but this one seems to have had a pretty successful run. The advantage is you can create an account and buy fairly quickly. You can also use Chagelly to turn your Litecoin into Bitcoin when the time is right. The downside is that they are a foreign company with your credit card info.</li> <li>Bitcoin Stock - There are two major players here… <a href="https://www.bloomberg.com/quote/GBTC:US">GBTC</a> in the US and <a href="https://www.bloomberg.com/quote/COINXBT:SS">COINXBT</a> out of Sweden. Honestly I like the Swedish one better since it tracks the price closer and doesn’t trade at a premium. It is about $50 / share but it’s hard to find a stock broker that will buy into the Swedish exchange, and when they do, it can be an extra $50 in trading fees. The US one is easy to get at must brokers and can be bought in a ROTH IRA as well. It sometimes trades at insane premiums like 30%-90% above the Bitcoin price. It’s hard to buy at $1500 / share, but <a href="https://www.stockpile.com/buy_for_self/choose_stock">Stockpile</a> is offering it in fractional shares at very low trading fees. In the next year or so there should be a bunch of other Bitcoin stocks, so this market will develop. Do watch out for shady <em>Bitcoin IRAs</em>. These are <em>licensed</em> brokers that take a 100% Bitcoin position. Some might be legit, but I get real nervous looking at some of these shops. Stockpile, Ameritrade, Fidelity, and the other discount brokers are all legit and should offer no worries.</li> <li>Beg / Barter / Trade - You can always sell your XBox for Bitcoin, and you are very likely to find a buyer. If you know someone who has Bitcoin you could also ask if they would sell you some. There are Bitcoin meetups and the such that allow people to buy small amounts.</li> <li><a href="https://btc-e.com/">SketchyExchange.com</a> - There are no shortage of sketchy Bitcoin exchanges… Beware, these are often scams and generally end poorly. If you don’t know much about them, stay away.</li> </ol> <h2 id="how-to-hold-them">How to hold them</h2> <p>In order to hold Bitcoin you need what is called a <em>wallet</em>. This is the term for a software program that keeps track of your coins <em>keys</em>. The keys are very long account numbers where they coins will eventually be deposited. There are public parts of a key called the <em>address</em> and private parts called the <em>private key</em>. The main point here is that you have to keep the <em>private key</em> hidden and safe. Anyone that gains access to the private key has all your coins. If you lose your private key, you have lost all your coins. So ensure you know how to save and secure your keys, because this is literally where your coins are. Here are some of my suggestions.</p> <ol> <li><a href="https://coinomi.com/">Coinomi (Android)</a> - This is a fairly safe Android wallet that has fairly good security. The private key is encoded in set of 15 random words. It’s a sentence that makes no sense, but there is a mathematical rule to it that will generate the keys for your wallet. This nonsense sentence <strong>IS</strong> your private key… keep it safe.</li> <li><a href="https://jaxx.io/">Jaxx (PC/Mac/IOS/ChromeOS)</a> - Similar to Coinomi this is a multi-coin wallet that uses a 12 word nonsense sentence. Be aware that JAXX got a bad rap a while back for leaving the private keys on the hard drive of some systems, so do be careful. Use system encryption if possible, and don’t get a virus, they will look for these keys.</li> </ol> <p>Once you have installed one of the wallets you can add coins to it. Bitcoin / Litecoin / Ethereum. When you do, you will get an <em>address</em> that coins can be sent to. This is how Changelly will be able to send you your coins. Exchanges like Coinbase/GDAX will often offer to hold your coins on thier site, and that is fine, but if the site ever goes down, or they <a href="https://btc-e.com/">get shutdown</a> you could lose your coins.</p> <h2 id="reward">Reward</h2> <p>If you made it this far, know me, and have a Litecoin address…. drop me a line and I can send some coin your way.</p> Wed, 29 Nov 2017 17:04:00 -0600 https://brianddk.github.io//2017/11/bitcoin-tulips/ https://brianddk.github.io//2017/11/bitcoin-tulips/ bitcoin hp42s (35s) Mancala <p>This is a mancala program I wrote for the hp42s (Free42). For those not familiar with mancala, its a very achient game that has become repopularized over the last few years in the US. You can now get a mancala board at most stores that sell board games. This particular ‘flavor’ of mancala kahla(6,4), but it seemed to be the one that is most available in my area. This is a fun game to play, but most mathmatical analysis of possible permutations make this game signifigantly harder for Player 2. Whoever goes first is likely to win.</p> <p>Download <a href="https://github.com/brianddk/brianddk.github.io/blob/d30ab3ccd413f19df80dba37674f87ec6cf85ded/prog/mancala/mancala.raw?raw=true"><code class="language-plaintext highlighter-rouge">mancala.raw</code></a></p> <h3 id="hp-35s-portable">HP 35s Portable</h3> <p>I had originally planned on writting this for the hp35s. I still intend to port it, so I wrote this, basically, in hp35s syntax. The primary listing is in an ‘.asm’ file that I put through a very gentle pre-processor. This is done to keep all the <code class="language-plaintext highlighter-rouge">LBL</code>, <code class="language-plaintext highlighter-rouge">XEQ</code>, <code class="language-plaintext highlighter-rouge">GTO</code> statements synced up since the 35s and 42s handle them different. I also prefer verbose label names, but that has a tendency of poluting your program catalog with all your ‘subroutines’. The pre-processor will take marked-up verbose labels and convert them to 42s local-labels or 35s line-labels. Neither of which will pollute the catalog. I have also choosen to use no named variables for similar reasons. Since I plan to port this to the 35s, I choose to only access registers indirectly. This is the only way that the 35s can access un-named registers, so enforcing this makes the porting a breeze. References to <code class="language-plaintext highlighter-rouge">I</code>, <code class="language-plaintext highlighter-rouge">(I)</code>, <code class="language-plaintext highlighter-rouge">J</code>, and <code class="language-plaintext highlighter-rouge">(J)</code>, are all 35s notation.</p> <h3 id="build-process">Build Process</h3> <p>The build command does the pre-processing with <code class="language-plaintext highlighter-rouge">sed</code>. Once this is done, it feeds the result through txt2raw.pl (by Vini Matangrano). This will both check for syntax errors and produce an hp41s raw-file. My only hp41s is the one simulated through Free42, so no promesses, though I’m not really doing anything special here to cause concern.</p> <h3 id="registers">Registers</h3> <p>Since a real mancala board uses a counter-clockwise rotation in play, I have configured the phisical registers in a similar fashion. This does make gameplay more natural for Player 1 than Player 2.</p> <pre><code class="language-asm">; R00 - P2 'Home' pit ; R01 - P1 pit #1 ; R02 - P1 pit #2 ; R03 - P1 pit #3 ; R04 - P1 pit #4 ; R05 - P1 pit #5 ; R06 - P1 pit #6 ; R07 - P1 'Home' pit ; R08 - P2 pit #6 ; R09 - P2 pit #5 ; R10 - P2 pit #4 ; R11 - P2 pit #3 ; R12 - P2 pit #2 ; R13 - P2 pit #1 ; R14 - P1 Display Vector ; R15 - P2 Display Vector ; R16 - Virtual 'I' register ; R17 - Vertual 'J' register </code></pre> <h3 id="flags">Flags</h3> <p>The flags used are fairly self explanitory. Originally, in the 35s design, I had intended on using the flag indicator as the way for Player 1 and Player 2 to know who’s turn it was. Since the 42s doesn’t have a flag indicator, I had to use <code class="language-plaintext highlighter-rouge">GRAD</code> and <code class="language-plaintext highlighter-rouge">RAD</code> to make that distinction.</p> <pre><code class="language-asm">; FLAG1 - Player 1 turn flag ; FLAG2 - Player 2 turn flag ; FLAG3 - Winner found flag ; FLAG4 - Bad 'pick' choice flag </code></pre> <h3 id="game-display">Game Display</h3> <p>The game display will show a number between 1-million and 2-million, for both Player 1 and Player 2. The fractional part is the player’s score (0.10 = 10 points). The number in the million’th place is purely for alignment and should be ignored, the other numbers represent your 6 ‘pits’. The ‘pit’ to the far left is ‘pit 1’ the pit to the far right is ‘pit 6’. To move, you specify a pit number to move.</p> <pre><code class="language-asm">; Game Display ; ; x: Z,DCB,A98.P2 ; y: Z,123,456.P1 ; ; Where, ; 'Z,' - Ignore the 'millionth' place, its a place holder, nothing more ; 'P1' - The score for Player 1 (in the X vector) ; 'P2' - The score for Player 2 (in the Y vector) ; '1|D' - # of beans in 'pit #1' for P1 and P2 ; '2|C' - # of beans in 'pit #2' for P1 and P2 ; '3|B' - # of beans in 'pit #3' for P1 and P2 ; '4|A' - # of beans in 'pit #4' for P1 and P2 ; '5|9' - # of beans in 'pit #5' for P1 and P2 ; '6|8' - # of beans in 'pit #6' for P1 and P2 ; ; Indicators ; 'GRAD' - Player1's turn when 'GRAD' is displayed ; 'RAD' - Player2's turn when 'RAD' is displayed </code></pre> <h3 id="gameplay">Gameplay</h3> <p>To start the game, simply <code class="language-plaintext highlighter-rouge">XEQ</code> the <code class="language-plaintext highlighter-rouge">MANCA</code> program. The game will show the initial board and set the indicator for Player 1 to take his turn. Player 1 can then study the board and pick a pit to move. Thier pick is given by placing the pick in the level 1 (x) on the stack then hit <code class="language-plaintext highlighter-rouge">run</code> (aka <code class="language-plaintext highlighter-rouge">R/S</code>). The game will then move the beans according to the rules and redisplay the board. It is now time for the next move. The <code class="language-plaintext highlighter-rouge">GRAD</code> / <code class="language-plaintext highlighter-rouge">RAD</code> indicator will light to instruct the players as to whos turn it is. Keep in mind, earning extra turns is a key strategy of the game.</p> <h3 id="bugs">Bugs</h3> <p>I have a few features that I haven’t implented yet, aka ‘Bugs’</p> <ol> <li>Display is base 10, so more than 9 beans in a pit is a problem - For the 35s, I will simply make a modified version of this display in <code class="language-plaintext highlighter-rouge">HEX</code>. This will allow 15 beans in a pit, which by most game permutations is unlikely. For the 42s, I will have to do some <code class="language-plaintext highlighter-rouge">XTOA</code> commands. This is simple enough, but just a hunk of code I haven’t written yet.</li> <li>When a player empties all thier pits, the game should end, but doesn’t - This is another simple fix, but something I just haven’t done yet.</li> </ol> <h3 id="listings">Listings</h3> <p>Here are the listings, but do recall that you will likely need to understand that pre-processors are the key here.</p> <p><a href="https://github.com/brianddk/brianddk.github.io/blob/d30ab3ccd413f19df80dba37674f87ec6cf85ded/prog/mancala/mancala.asm"><code class="language-plaintext highlighter-rouge">mancala.asm</code></a></p> <pre><code class="language-asm">LBL "MANCA" ;Main Mancala program XEQ [INIT] ; Init the game registers LBL [MAIN] ; Main game loop XEQ [CHECK-WINNER] ; Check for a winner FS? 3 ; Flag3 = Winner Found! GTO [DONE] ; Finished when a winner is found LBL [REDISPLAY] ; Come here if we pick bad XEQ [DISPLAY] ; Display the game board XEQ [PICK] ; Pick a move FS? 4 ; Invalid move? GTO [REDISPLAY] ; .. Redisplay XEQ [MOVE] ; Move the beans XEQ [SWITCH] ; Swithch players GTO [MAIN] ; Loop for next move LBL [DONE] ; This is where we finish XEQ [CLEANUP] ; Cleanup we are done RTN ; ; .Init registers LBL [INIT] ; Init the game registers CF 1 ; Clear our flag regs CF 2 CF 3 CF 4 13.0 ; For i in 13..1 STO I ; i 4.0 ; st-x = 4 LBL [INIT-LOOP] STO (I) ; 4-&gt;(i) DSE I ; DSE i GTO [INIT-LOOP] 0.0 ; i now equals zero STO (I) ; 0-&gt;(i), i = 0 7.0 STO I X&lt;&gt;Y STO (I) ; 0-&gt;(i), i = 7 SF 1 ; P1'S Turn GRAD ; 42s Only, P1 indicator RTN ; ; Check for winner LBL [CHECK-WINNER] CF 3 ; Clear winner found flag 0 STO J ; j 7 STO I ; i 24.0 RCL (I) ; (i) X&gt;=Y? GTO [P1-WINNER] X&lt;&gt;Y RCL (J) ; (j) X&gt;=Y? GTO [P2-WINNER] GTO [WINNER-RTN] LBL [P1-WINNER] "Player 1 won!" GTO [WINNER-DONE] LBL [P2-WINNER] "Player 2 won!" LBL [WINNER-DONE] SF 3 ; Set winner found flag PROMPT LBL [WINNER-RTN] RTN ; ; Display the board LBL [DISPLAY] 1.006 STO I ; i 14 STO J ; "$(j)" == "$(14)" 1000000.0 STO (J) ; (j)=1,000,000 LBL [P1-BOARD] ;STOP 10.0 ; WARN Base 10 for now 6 RCL I ; i IP - Y^X ; i^(6-ip(i)) RCL (I) ; (i) x ; i^(6-ip(i)) * $(i) STO+ (J) ; @(j) += i^(6-ip(i)) + $(i) ISG I ; i GTO [P1-BOARD] 15 STO J ; j = P2-vector 1000000.0 STO (J) 13.007 STO I LBL [P2-BOARD] ;STOP 10.0 ; WARN Base 10 for now RCL I IP 8 - Y^X RCL (I) x STO+ (J) DSE I GTO [P2-BOARD] 14 STO I ; i = P1-vector ; ; 42s only code begin FIX 2 RCL 7 ; P1 SCORE 100 / STO+ (I) ; P1 VECTOR RCL 0 100 / STO+ (J) ; P2 VECTOR ; ; 42s only code end RCL (J) ; P2 RCL (I) ; P1 STOP RTN ; ; Pick a pit to move LBL [PICK] CF 4 IP 1 X&lt;&gt;Y X&lt;Y? SF 4 6 X&lt;&gt;Y X&gt;Y? SF 4 FS? 4 GTO [PICK-DONE] STO I ; i=PICK FS? 1 GTO [CHECK-PICK] 14 X&lt;&gt;Y - STO I ; i LBL [CHECK-PICK] RCL (I) ; (i) X=0? SF 4 LBL [PICK-DONE] RCL I ; i RTN ; ; Move beans from selected pit LBL [MOVE] 0 X&lt;&gt; (I) ; (i)= 0 (MOVE BEANS OUT) STO J ; j=VALUE PREVIOUSLY IN (i) LBL [MOVE-LOOP] ; INCI SUBROUTINE-INLINE 1.0 RCL+ I ; i++ (MOVE REGISTER FORWARD) 14.0 MOD STO I ; i=(i+1)MOD(14) FS? 1 ; P1? XEQ [SKIP0] ; SKIP0 IF P1 FS? 2 XEQ [SKIP7] ; SKIP7 IF P2 ; INCI END-SUBROUTINE-INLINE 1.0 STO+ (I) ; (i)=(i)+1 DSE J ; j-- GTO [MOVE-LOOP] 1.0 RCL (I) X=Y? XEQ [WIN-BEANS] RTN ; ; SKIP0 LBL [SKIP0] X=0? ISG I CF 0 ; NOP RTN ; ; SKIP7 LBL [SKIP7] 7 X&lt;&gt;Y X=Y? ISG I CF 0 ; NOP RTN ; ; WIN-BEANS LBL [WIN-BEANS] ;STOP 7 RCL I FS? 1 GTO [P1-WINBEANS] FS? 2 GTO [P2-WINBEANS] RTN LBL [P1-WINBEANS] 7.0 STO J Rv X&gt;=Y? RTN GTO [DONE-WINBEANS] LBL [P2-WINBEANS] 0.0 STO J Rv X&lt;=Y? RTN LBL [DONE-WINBEANS] 14.0 X&lt;&gt;Y - STO I 0 X&lt;&gt; (I) STO+ (J) RTN ; ; Switch to other players turn LBL [SWITCH] 7 RCL I ; i contains the final register of move X=Y? ; if i=7, landed in a bank, free move RTN X=0? ; if i=0, landed in a bank, free move RTN FS? 1 GTO [SWITCHTO-P2] CF 2 SF 1 GRAD GTO [SWITCH-DONE] LBL [SWITCHTO-P2] CF 1 SF 2 RAD LBL [SWITCH-DONE] RTN ; ; Clean up after game LBL [CLEANUP] CF 1 CF 2 CF 3 CF 4 FIX 4 DEG RTN END </code></pre> <p><a href="https://github.com/brianddk/brianddk.github.io/blob/d30ab3ccd413f19df80dba37674f87ec6cf85ded/prog/mancala/build.sh"><code class="language-plaintext highlighter-rouge">build.sh</code></a></p> <div class="language-shell highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="c">#!/bin/env bash</span> get-label<span class="o">()</span> <span class="o">{</span> <span class="nb">grep</span> <span class="s1">'LBL \['</span> <span class="nv">$1</span> | <span class="nb">awk</span> <span class="s1">'{print $2}'</span> | <span class="nb">sort</span> | <span class="nb">uniq</span> | <span class="nb">sed</span> <span class="nt">-s</span> <span class="s1">'s/\[//g;s/\]//g'</span> <span class="o">}</span> make-sed<span class="o">()</span> <span class="o">{</span> <span class="nb">local </span><span class="nv">ivar</span><span class="o">=</span>16 <span class="nb">local </span><span class="nv">jvar</span><span class="o">=</span>17 <span class="nb">local </span>i <span class="nb">echo</span> <span class="s2">"s/^</span><span class="se">\s\+</span><span class="s2">;.*//g"</span> <span class="nb">echo</span> <span class="s2">"s/</span><span class="se">\s</span><span class="s2">(I)/ IND </span><span class="nv">$ivar</span><span class="s2">/g"</span> <span class="nb">echo</span> <span class="s2">"s/</span><span class="se">\s</span><span class="s2">(J)/ IND </span><span class="nv">$jvar</span><span class="s2">/g"</span> <span class="nb">echo</span> <span class="s2">"s/</span><span class="se">\&lt;</span><span class="s2">I</span><span class="se">\&gt;</span><span class="s2">/</span><span class="nv">$ivar</span><span class="s2">/g"</span> <span class="nb">echo</span> <span class="s2">"s/</span><span class="se">\&lt;</span><span class="s2">J</span><span class="se">\&gt;</span><span class="s2">/</span><span class="nv">$jvar</span><span class="s2">/g"</span> <span class="nb">echo</span> <span class="s2">"/^</span><span class="se">\s</span><span class="s2">*</span><span class="nv">$/</span><span class="s2">d"</span> <span class="nb">echo</span> <span class="s2">"/^</span><span class="se">\s</span><span class="s2">*;.*</span><span class="nv">$/</span><span class="s2">d"</span> <span class="k">while </span><span class="nb">read </span>line <span class="k">do </span><span class="nv">i</span><span class="o">=</span><span class="k">$((</span>i+1<span class="k">))</span> <span class="nb">echo</span> <span class="s2">"s/</span><span class="se">\(\[</span><span class="nv">$line</span><span class="se">\]\)</span><span class="s2">/</span><span class="nv">$i</span><span class="se">\t</span><span class="s2">;</span><span class="se">\1</span><span class="s2">/g"</span> <span class="k">done</span> <span class="o">}</span> show-list<span class="o">()</span> <span class="o">{</span> <span class="nb">sed</span> <span class="nt">-f</span> /dev/stdin <span class="nv">$1</span> <span class="o">}</span> get-label <span class="nv">$1</span> | make-sed | show-list <span class="nv">$1</span> <span class="o">&gt;</span> <span class="nv">$1</span>.txt perl txt2raw.pl <span class="nv">$1</span>.txt </code></pre></div></div> <p><a href="https://github.com/brianddk/brianddk.github.io/blob/d30ab3ccd413f19df80dba37674f87ec6cf85ded/prog/mancala/mancala.txt"><code class="language-plaintext highlighter-rouge">mancala.txt</code></a></p> <div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>00 { 476-Byte Prgm } 40 CF 03 80 STO+ IND 17 120 X&lt;&gt;Y 160 GTO 11 200 14 01&gt;LBL "MANCA" 41 0 81 ISG 16 121 X&lt;Y? 161 1 201 X&lt;&gt;Y 02 XEQ 07 42 STO 17 82 GTO 12 122 SF 04 162 RCL IND 16 202 - 03&gt;LBL 09 43 7 83 15 123 6 163 X=Y? 203 STO 16 04 XEQ 02 44 STO 16 84 STO 17 124 X&lt;&gt;Y 164 XEQ 26 204 0 05 FS? 03 45 24 85 1E6 125 X&gt;Y? 165 RTN 205 X&lt;&gt; IND 16 06 GTO 05 46 RCL IND 16 86 STO IND 17 126 SF 04 166&gt;LBL 21 206 STO+ IND 17 07&gt;LBL 20 47 X&gt;=Y? 87 13.007 127 FS? 04 167 X=0? 207 RTN 08 XEQ 04 48 GTO 14 88 STO 16 128 GTO 19 168 ISG 16 208&gt;LBL 23 09 XEQ 18 49 X&lt;&gt;Y 89&gt;LBL 15 129 STO 16 169 CF 00 209 7 10 FS? 04 50 RCL IND 17 90 10 130 FS? 01 170 RTN 210 RCL 16 11 GTO 20 51 X&gt;=Y? 91 RCL 16 131 GTO 01 171&gt;LBL 22 211 X=Y? 12 XEQ 10 52 GTO 17 92 IP 132 14 172 7 212 RTN 13 XEQ 23 53 GTO 28 93 8 133 X&lt;&gt;Y 173 X&lt;&gt;Y 213 X=0? 14 GTO 09 54&gt;LBL 14 94 - 134 - 174 X=Y? 214 RTN 15&gt;LBL 05 55 "Player 1 won!" 95 Y^X 135 STO 16 175 ISG 16 215 FS? 01 16 XEQ 03 56 GTO 27 96 RCL IND 16 136&gt;LBL 01 176 CF 00 216 GTO 25 17 RTN 57&gt;LBL 17 97 О 137 RCL IND 16 177 RTN 217 CF 02 18&gt;LBL 07 58 "Player 2 won!" 98 STO+ IND 17 138 X=0? 178&gt;LBL 26 218 SF 01 19 CF 01 59&gt;LBL 27 99 DSE 16 139 SF 04 179 7 219 GRAD 20 CF 02 60 SF 03 100 GTO 15 140&gt;LBL 19 180 RCL 16 220 GTO 24 21 CF 03 61 PROMPT 101 14 141 RCL 16 181 FS? 01 221&gt;LBL 25 22 CF 04 62&gt;LBL 28 102 STO 16 142 RTN 182 GTO 13 222 CF 01 23 13 63 RTN 103 FIX 02 143&gt;LBL 10 183 FS? 02 223 SF 02 24 STO 16 64&gt;LBL 04 104 RCL 07 144 0 184 GTO 16 224 RAD 25 4 65 1.006 105 100 145 X&lt;&gt; IND 16 185 RTN 225&gt;LBL 24 26&gt;LBL 08 66 STO 16 106 э 146 STO 17 186&gt;LBL 13 226 RTN 27 STO IND 16 67 14 107 STO+ IND 16 147&gt;LBL 11 187 7 227&gt;LBL 03 28 DSE 16 68 STO 17 108 RCL 00 148 1 188 STO 17 228 CF 01 29 GTO 08 69 1E6 109 100 149 RCL+ 16 189 Rv 229 CF 02 30 0 70 STO IND 17 110 э 150 14 190 X&gt;=Y? 230 CF 03 31 STO IND 16 71&gt;LBL 12 111 STO+ IND 17 151 MOD 191 RTN 231 CF 04 32 7 72 10 112 RCL IND 17 152 STO 16 192 GTO 06 232 FIX 04 33 STO 16 73 6 113 RCL IND 16 153 FS? 01 193&gt;LBL 16 233 DEG 34 X&lt;&gt;Y 74 RCL 16 114 STOP 154 XEQ 21 194 0 234 RTN 35 STO IND 16 75 IP 115 RTN 155 FS? 02 195 STO 17 235 END 36 SF 01 76 - 116&gt;LBL 18 156 XEQ 22 196 Rv 37 GRAD 77 Y^X 117 CF 04 157 1 197 X&lt;=Y? 38 RTN 78 RCL IND 16 118 IP 158 STO+ IND 16 198 RTN 39&gt;LBL 02 79 О 119 1 159 DSE 17 199&gt;LBL 06 </code></pre></div></div> <p>Download <a href="https://github.com/brianddk/brianddk.github.io/blob/d30ab3ccd413f19df80dba37674f87ec6cf85ded/prog/mancala/mancala.raw?raw=true"><code class="language-plaintext highlighter-rouge">mancala.raw</code></a></p> Wed, 04 May 2016 17:20:00 -0500 https://brianddk.github.io//2016/05/hp-42s-mancala/ https://brianddk.github.io//2016/05/hp-42s-mancala/ calc hp42s hp35s hp35s Software <p>This is a small collection of useful hp 35s program listings (aka software) for use by 35s owners. Some are from the hp-32 or hp-33, but should be usable with only very minor modifications. Most of these are obviously found at <a href="http://www.hpmuseum.org/">The Museum of HP Calculators</a>. Hats off to that great group of enthusiasts.</p> <ol> <li><a href="http://www.stefanv.com/calculators/hp35s_curve_fitting.html">Curve Fitting</a></li> <li><a href="http://www.stefanv.com/calculators/hp35s_matrix_multitool.html">Matrix Multi-tool</a></li> <li><a href="http://www.namirshammas.com/NCSStatPac/NCSSTATPAC.htm">NCS35TB Stat Pac</a>, (contains a set of statistical programs for the HP-35s)</li> <li><a href="http://www.hpmuseum.org/forum/post-44542.html#pid44542">Stat Student t distribution</a></li> <li><a href="http://www.hpmuseum.org/cgi-sys/cgiwrap/hpmuseum/archv018.cgi?read=140944">Complex-&gt; Real Coefficents</a></li> <li><a href="http://www.hpmuseum.org/cgi-sys/cgiwrap/hpmuseum/archv017.cgi?read=121176">Complex Conjugate</a></li> <li><a href="http://www.hpmuseum.org/software/35derivp.htm">Derivative in a point</a></li> <li><a href="http://www.hpmuseum.org/software/35hacksl.htm">Hack and Slash Adventure Game</a></li> <li><a href="http://www.hpmuseum.org/software/35moonla.htm">Moon Lander Game</a></li> <li><a href="http://www.hpmuseum.org/software/35nim.htm">Game of NIM</a></li> <li><a href="http://www.hpmuseum.org/software/35cowbul.htm">Mastermind Game</a></li> <li><a href="http://www.hpmuseum.org/software/32blkjck.htm">Blackjack Game</a>, (Change <code class="language-plaintext highlighter-rouge">GTO A</code> to <code class="language-plaintext highlighter-rouge">GTO A001</code> for <code class="language-plaintext highlighter-rouge">GTO/XEQ</code> for all labels).</li> <li><a href="http://www.hpmuseum.org/software/35polrec.htm">-&gt;P and -&gt;R Conversions</a></li> <li><a href="http://www.hpmuseum.org/software/35quadrt.htm">Quadratic Roots</a></li> <li><a href="http://www.hpmuseum.org/software/35seprop.htm">Section Properties for Composite Body</a></li> <li><a href="http://www.hpmuseum.org/software/35sumfun.htm">Sum Function</a></li> <li><a href="http://www.hpmuseum.org/software/33miller.htm">Miller Indices for Cubic Crystal</a>, (Change <code class="language-plaintext highlighter-rouge">GTO A</code> to <code class="language-plaintext highlighter-rouge">GTO A001</code> for <code class="language-plaintext highlighter-rouge">GTO/XEQ</code> for all labels).</li> <li><a href="http://www.hpmuseum.org/software/33prifac.htm">Prime Factorization</a>, (Change <code class="language-plaintext highlighter-rouge">GTO A</code> to <code class="language-plaintext highlighter-rouge">GTO A001</code> for <code class="language-plaintext highlighter-rouge">GTO/XEQ</code> for all labels).</li> <li><a href="http://www.hpmuseum.org/software/33smotn.htm">Bodies in motion</a>, (Change <code class="language-plaintext highlighter-rouge">GTO A</code> to <code class="language-plaintext highlighter-rouge">GTO A001</code> for <code class="language-plaintext highlighter-rouge">GTO/XEQ</code> for all labels).</li> <li><a href="http://www.hpmuseum.org/software/34fibon.htm">Fibbonacci Function</a></li> <li><a href="http://www.hpmuseum.org/forum/thread-3785.html">Great SW Thread</a></li> <li><a href="http://www.hpmuseum.org/forum/thread-5207.html">Survey SW for 35s</a></li> </ol> Thu, 28 Apr 2016 08:30:00 -0500 https://brianddk.github.io//2016/04/hp-35s-software/ https://brianddk.github.io//2016/04/hp-35s-software/ calc hp35s hp35s Observations <p>Recently, much to my joy, my son got to that special level of mathematics that require a calculator a bit more powerful than Window’s <code class="language-plaintext highlighter-rouge">calc.exe</code>. I knew I wanted the kids to learn RPN, primarily as a way to deconstruct problems and segment them. I found that using RPN in college helped me see calculus equations a bit differently, and as such, I did a much better job and avoiding sign inversion (my kids biggest problem). So since I had a captured audience, I started with the RPN indoctrination before a Casio or TI could object. Before there could be the chance for suggestions on the matter, I went for my old hp48gx from college. This did not go over well. After a bit of reflection on the matter, I decided that the hp48gx was a bit too much for his current workload, so I started looking for some smaller options</p> <p>Here’s some of what I stumbled on:</p> <ol> <li><strong>Android Free42</strong> - By far, one of the best hpCalc simulators I have found to date. The software is all open sourced, and doesn’t use any pirated hp ROMs. I was very impressed with this effort and pleased to see it is receiving active development, and seems to have a huge following. Best of all, the hp42s is the perfect size to simulate on a smart-phone. Although the hp48sx emulators/simulators seem solid enough, they are just a bit too busy for my tastes. I immediately installed this on all the kids smart-phones. Of all the options, this was the best fit, except for the fact that no algebra teacher would ever allow a kid to take a test with a smart-phone. That aside, this product is very solid. Nice features include: <ul> <li><em>Program Import / Export</em> - Fantastic feature. I can write programs on my smart-phone then import them on the kids.</li> <li><em>Program Listing / Printing</em> - Good for sharing programs with others… like you guys.</li> <li><em>Program ‘Compiler’ in Perl</em> - Haven’t dabbled with it much, but seems solid enough.</li> </ul> </li> <li><strong>Used HP 42s</strong> - After falling in love with the Free42 project, I figured I just get him a throwback HP 42s. <em>MISTAKE</em>. Although they retailed for $100 back in the late 80s, these things go for $500 today. <em>INSANE</em>. OK, I like the 42s, but not that much.</li> <li><strong>HP Prime Calculator</strong> - If the 48gx didn’t work for them, the Prime wouldn’t either, but since I was on the calc page, I looked it up. This one seems to be their flagship calculator and and has a pretty big following. I just about bought one for myself, purely on calculator nostalgia, but noticed the HP Store was sold-out (<em>panic</em>). I was not pleased, and this raised some alarms. Is HP leaving the calculator market? Are they discontinuing their flagship? I did see some on Amazon, but wasn’t going to shell out that kind of money.</li> <li><strong>HP 50g</strong> - Yes, I had to get one. Partly for nostalgia, and partly from the panic of seeing the <code class="language-plaintext highlighter-rouge">HP Prime</code> sold-out. I figure, if I force my kids into the RPN mindset, I better make sure they have a calculator for Calculus. So my <code class="language-plaintext highlighter-rouge">50g</code> is my backup plan. No complaints. Looks and feels a lot like my ‘48gx’ with some impressive ‘CAS’ capabilities that the <code class="language-plaintext highlighter-rouge">48gx</code> did, but reluctantly.</li> <li><strong>HP 35s (WINNER)</strong> - This was the right form factor, handled complex numbers, equations, programmable, and most other stuff I thought the kids might need for the next few years. Although this is a newer calculator than the 42s, it is not nearly as featured, but since I was looking for a smaller option, it was perfect for my needs. Few likes and dislikes: <ul> <li>Likes: <ul> <li><em>800 Indirect Variables</em> - At first I didn’t dabble with the indirect variables, but as I began to write more programs on it, they became very useful. I generally leave these variables to programs and I don’t have to worry about clobbering them. I also consider <code class="language-plaintext highlighter-rouge">I</code> and <code class="language-plaintext highlighter-rouge">J</code> as volatile and assume that any program may clobber them.</li> <li><em>User Flag Annunciator</em> - This allows me to work around some of the dislikes I have. I can light a user flag annunciator ant that lets me know certain conditions happened in my program, and how to remedy it.</li> <li><em>Programmable</em> - This, above all others, fixes any shortfall. Almost anything the calculator “can’t do” can be fixed with the right program. Almost…</li> <li><em>Complex Number Support</em> - This solves so many problems and am grateful for it’s inclusion in this model, though it is a bit kludgey.</li> <li><em>Fraction Display</em> - I could care less, but my son loves this feature above all others. I include it for his sake.</li> <li><em>Form Factor</em> - Frankly, this is why I got it. It looks like a standard puny Casio. No real indication of the power within.</li> <li><em>Full HP Support</em> - Full set of manuals, full set of features, full warranty. Everything a father could ask for.</li> </ul> </li> <li>Dislikes: <ul> <li><em>Single Letter Program Names</em> - I thought this would be a nightmare, but my solution was simple. Write a program to display what the other programs are. I call this program <code class="language-plaintext highlighter-rouge">H</code> for [H]elp. It requires a bit of extra work to add a entry in the Help program whenever I write a new one, but this is simple enough.</li> <li><em>No Export</em> - Would have been nice to have a USB cable. I’ve written about 5-6 programs and would have liked an export capability, but as it stands, I’ll have to transcribe. Not a really big deal, but an annoyance.</li> <li><em>Kludgey Complex Support</em> - Complex math is only supported on a few functions. X^Y supports complex but X^2 doesn’t. Silly really. OK, so I just have to do X^(1/2) then. Ohh well.</li> <li><em>No Continue On Error</em> - Previous HP calcs have <code class="language-plaintext highlighter-rouge">Overflow Halt</code> and <code class="language-plaintext highlighter-rouge">Overflow Status</code> flags, but on previous ones clearing them had a wonderful side effect. Previous generations would allow you to <code class="language-plaintext highlighter-rouge">Continue On Error</code> if <code class="language-plaintext highlighter-rouge">Overflow Halt</code> was cleared. This means you could trap errors and recover in your programs. Try as I might, I could not get the <code class="language-plaintext highlighter-rouge">HP 35s</code> to do this. Overflow is only for Overflow, nothing else. What I did settle upon was to make programs <code class="language-plaintext highlighter-rouge">Restartable</code>. Before I do operations that could trigger an error, I set a flag (and clear it after). If the error halts the program, I restart it and can tell what error happened and then jump to some trap code. Kludgey but workable.</li> </ul> </li> </ul> </li> </ol> <p>All in all, I love the HP nostalgia and have had a lot of fun recalling all my <code class="language-plaintext highlighter-rouge">RPL</code> mad skills. Even went through a few program listings with the kids. They were patient, but not really that interested. Ohh well. I still have some toys to fool around with.</p> Sat, 23 Apr 2016 23:50:00 -0500 https://brianddk.github.io//2016/04/hp-35s-observe/ https://brianddk.github.io//2016/04/hp-35s-observe/ calc hp35s Welcome to Jekyll! <p>You’ll find this post in your <code class="language-plaintext highlighter-rouge">_posts</code> directory. Go ahead and edit it and re-build the site to see your changes. You can rebuild the site in many different ways, but the most common way is to run <code class="language-plaintext highlighter-rouge">jekyll serve</code>, which launches a web server and auto-regenerates your site when a file is updated.</p> <p>To add new posts, simply add a file in the <code class="language-plaintext highlighter-rouge">_posts</code> directory that follows the convention <code class="language-plaintext highlighter-rouge">YYYY-MM-DD-name-of-post.ext</code> and includes the necessary front matter. Take a look at the source for this post to get an idea about how it works.</p> <p>Jekyll also offers powerful support for code snippets:</p> <figure class="highlight"><pre><code class="language-ruby" data-lang="ruby"><span class="k">def</span> <span class="nf">print_hi</span><span class="p">(</span><span class="nb">name</span><span class="p">)</span> <span class="nb">puts</span> <span class="s2">"Hi, </span><span class="si">#{</span><span class="nb">name</span><span class="si">}</span><span class="s2">"</span> <span class="k">end</span> <span class="n">print_hi</span><span class="p">(</span><span class="s1">'Tom'</span><span class="p">)</span> <span class="c1">#=&gt; prints 'Hi, Tom' to STDOUT.</span></code></pre></figure> <p>Check out the <a href="http://jekyllrb.com/docs/home">Jekyll docs</a> for more info on how to get the most out of Jekyll. File all bugs/feature requests at <a href="https://github.com/jekyll/jekyll">Jekyll’s GitHub repo</a>. If you have questions, you can ask them on <a href="https://talk.jekyllrb.com/">Jekyll Talk</a>.</p> Sun, 13 Mar 2016 14:12:07 -0500 https://brianddk.github.io//2016/03/welcome-to-jekyll/ https://brianddk.github.io//2016/03/welcome-to-jekyll/ jekyll update