Book Review: The Apollo Guidance Computer: Architecture and Operation

Like most programmers I have spend my entire career working with general purpose “do anything” computers. Every machine I’ve touched from $3 micro-controllers to $3000 servers has been based around the same basic design: A processor that supports universal math and logic combined with a chunk of flexible memory that can hold whatever code and data you want to put in it.

Need your universal computer to do something new? Just load different code into the memory and suddenly your spreadsheet machine is a web server or a fluid simulator.

But what if your computer only ever had to do one very specific thing? What if you your only goal was to get a spaceship to the moon with near-perfect reliability? And what if you had an entire team of engineers willing to build you a custom computer from scratch? How would your one-thing-only computer be different from a generic off the shelf processor and memory combo?

That is the question answered by The Apollo Guidance Computer: Architecture and Operation, a four hundred page book dedicated entirely to the design and programming of the computer that sent the first man to the moon.

As you’ve probably guessed the aspect of the book I found most interesting was how profoundly weird the guidance computer was compared to the generic mass produced machines we use for 99.999% of computation.

For example, normal computers have flexible memory that lets the user program whatever they want. After all, the manufacturer has no idea whether their customers are going to be building stop lights, washing machines or air conditioners. But the guidance computer was only ever going to be used for flight calculations. It didn’t need to be flexible. But what it did need to be was reliable in the harsh, slightly radioactive void of space. So instead of programmable memory it stored it’s code in the form of wires woven around and through hundreds and hundreds of tiny magnets, creating an extremely reliable form of read only memory.

Or what about mathematics. In normal computers a lot of silicon and logic is spent on making sure processors can gracefully and accurately work with numbers both extremely large and extremely small. But implementing that sort of mathematical power in a machine with as many constraints as the guidance computer would have been difficult.

The solution? To not solve the problem. After carefully studying the physics problems they needed to solve it became apparent that they never needed to multiply a very very large number by a very very small number. That meant they didn’t need a full range of flexible numbers. They could instead save processor complexity and instruction space by just doing relatively simple math and leaving it up to the programmers to just remember which equations were working in dozens of kilometers instead of fractions of seconds. Magnitude is relative and as long as the computer fires the thrusters at the right moment it doesn’t really matter whether that it was doing 10 +3 instead of 10,000,000 + 3,000,000.

These design decisions, and hundreds of other, were meticulously described over the course of hundreds of pages of thorough technical description. Technical enough that following along might be difficult if you’ve never taken a class or done some readings on the fundamentals of computer architecture.

So overall a very niche book, but for someone with the right background it’s a true pleasure to read. It’s always interesting learning about the technical accomplishments of NASA and thinking about the design decisions of a very specific computer really helps highlight that modern computer architecture, while very powerful, isn’t actually mandatory or universal.

Let’s Program a 3D Browser Game: Index and Code

Did you know that modern browser support full 3D graphics?

Most people don’t. Probably because most websites don’t use it. Probably because it’s not really a useful feature for the average news site or online shopping center.

But it’s still a really cool technology and definitely something to keep in mind in case you ever find yourself needing to offer users a degree of interactivity or visualization above and beyond 2D text and images. I can imagine all sorts of scenarios where being able to offer a 3D model viewer or simple simulation would go a long way to making a complex topic understandable.

So let’s dive into the topic by building a simple 3D maze based off of old school first person dungeon crawlers. We’ll be using a library called three.js to handle the nitty gritty details and will cover enough of the basics of user input and game loop logic to at least give you a starting point for any interactive 3D websites you may find yourself needing to build.

Show Me The Finished Code

You can find the final product here. Play around with it to get a feel for what we’re going to build or save the page to your local machine to look at the source code. It’s all Javascript so need for compilers; the whole program is right in the <script> tags of that single page (although you’ll need to download a copy of the three.js library as well to get it working locally).

Show Me The Articles

Let’s Program A 3D Browser Game Part 1: You Can Do That?!

Let’s Program A 3D Browser Game Part 2: Three.js To The Rescue

Let’s Program A 3D Browser Game Part 3: Feeling Boxed In

Let’s Program A 3D Browser Game Part 4: A Different Kind Of Software Architect

Let’s Program A 3D Browser Game Part 5: Before You Can Learn To Walk You Must Learn To Dungeon Crawl

Let’s Program A 3D Browser Game Part 6: Forward To Tomorrow!

Let’s Program A 3D Browser Game Part 7: You Shall Not Pass

Let’s Program A 3D Browser Game Part 8: Dungeon Maintanence

Let’s Program A 3D Browser Game Part 9: Look, Shiny

Let’s Program A 3D Browser Game Part 10: Sometimes I Surprise Myself

Let’s Program A 3D Browser Game Part 11: Hunting For Treasure

Can We Buy The Internet Back From Advertisers?

Recently people have become a little disturbed by how much of their personal information is being collected and processed by big Internet companies like Google and Facebook.

But the only reason those companies care about collecting all that personal data is because it’s the most efficient way to sell advertising.

And the only reason they care about advertising is because selling ads is the most effective way to make money off of a free service.

And the only reason their services are free is because no one is willing to pay a monthly fee for access to social media and search engines.

Or are they?

It’s true that when these technologies first went mainstream people weren’t really sure what to do with them. They were reluctant to spend real money on virtual products. As a result giving access away for free was pretty much the only way to get any users.

But now? People know how valuable an effective search engine is. People have seen how helpful social media is for keeping up with friends and family (and arguing with strangers). People believe the Internet is a genuine necessity of modern life ranking only slightly behind food and water.

And now that people understand how useful these services are, maybe they are also finally willing to directly pay for them. Maybe even pay enough money to make ads unnecessary and make data mining less lucrative.

The big question is: How much would Google or Facebook or Whatever Inc. have to charge to survive without any ads? And how many people would be willing to pay that?

Casual research (a.k.a. some random articles I found on the web) suggests that the average user provides Google with $200 worth of ad revenue per year, and about half that much to social media companies like Facebook and Twitter.

That’s… really not that bad. Less than phone service and about the same as other major software as service platforms. With that in mind I bet a lot of people would gladly pay $200 a year for a “pro” level Google account with no ads or $100 to keep in touch with family on some sort of genuinely “privacy-first” social media platform.

In some ways I think this transition is already happening. Netflix has made paying for software as a service a mainstream idea and a lot of other websites already offer the choice to remove ads with a paid membership. Now that data privacy is also becoming a mainstream concern I really wouldn’t be surprised to naturally see more and more “free (with ads)” products offering privacy enhanced “pro” membership options.

So while a lot of people are worried we’re rapidly hurtling towards some sort of distopian corporate panopticon it’s also very possible that we’ve reached peak digital insecurity and that things are going to start getting better as more and more companies shy away from unpopular advertising tactics and instead tap into the growing wave of customers who place a premium on responsible data handling.

Let’s Illustrate Morrowind Part 8: Cheap Source Of Protein

Our next fighrer guild task is a bit harder: We need to dispose of a couple poachers that have set up shop in the local egg mine. That’s right, egg mine. Apparently Morrowind is home to a species of giant ant-monsters that hollow out mountains and fill them with giant eggs. The eggs are very nutritious and can be safely mined as long as you don’t take too many or attack any of the worker insects. These eggs basically form the backbone of the region’s food chain and export economy. World building!

Ant farms are pretty hardcore in Morrowind

Ant farms are pretty hardcore in Morrowind

Anyways, the hardest part of stopping the poachers is just tracking them down through the winding insect filled mazes. Once Fault finds them it’s a simple matter to don her demon helm, call up a spear and stab in the name of justice.

Let’s Illustrate Dark Souls 3 Part 25: No One Expects The Lordric Inquisition

After a few tries and a few burnt embers Fault emerges victorious from her battle against Aldritch. Having defeated the third Lord of Cinder she is magically transported back to the High Wall and receives a final desperate quest from a dying priestess: Find Prince Lothric and remind him that he really needs to go be a Lord of Cinder too.

Clever players might have noticed that there were four empty thrones, not three. I was not clever.

Clever players might have noticed that there were four empty thrones, not three. I was not clever.

While I suppose being teleported here is nice (since that means we don’t have to find this cutscene on our own) it’s also kind of annoying because with Aldritch dead we can go loot the empty throne room of Anor Londo for a ring of fast healing which is great since most of Fault’s current rings are kind of lame. So we ignore the dying woman’s last request and run off to the nearest bonfire.

A few minutes later, ring in hand and souls well spent, Fault returns to the high wall and attempts a ritual meant to open the path to Lothric castle. She also, coincidentally, finally finds the Lothric Knight Leggings she was looking for way back at the beginning of her quest for pants. But too little too late, I already have better stuff.

What was I talking about? Oh right, the Lothric castle ritual. Starting the ritual summons the Boreal Dancer, a giant armored gypsy looking monster with a pair of sweeping swords that let her threaten pretty much the entire room all at once. Her back story is kind of sad. Apparently she was a noble who got on the wrong side of Sulliman and was “rewarded” with an assignment to become a traveling warrior. Even got some sweet magic equipment out of the deal. But the curse of the Pontiff eventually drove her made and remade her into a beast just like what happened with good old Voldt.

Speaking of Voldt, remember how he kept killing Fault due to having a two hit combo that she didn’t have enough health to survive? Well the dancer is that fight all over again but worse. Her more powerful combos are deadly enough to knock away Fault’s shield and kill her in two hits which means that even though I can dodge it 90% of the time the other 10% finish me off.

Looks like now is a great time to run around exploring older areas in hopes of finding cool treasure (that Fault probably can’t use) and earning enough souls to level up a few more times.

Let’s Illustrate Dark Souls 3 Part 20: The Enemy Of My Enemy

The good news is that Fault managed to kill a gimmick boss Lord of Cinder. The bad news is that he was the last gimmick boss in the main game and from here on out we have to actually fight enemies to win. Fault is probably going to need some new levels.

That means it’s time to explore one of the optional bonus dungeons! Fault warps back to the catacombs and makes her way to the rickety old rope bridge. A single poke causes the whole thing to fall apart. While this originally might seem like a trap designed to punish anyone caught fighting the dozens of skeletons in the area it actually serves a deeper purpose. Give the broken bridge a moment to stop bouncing around and you can actually use its remains as a ladder to descend to the Smoldering Lake.

On the way you have to fight Diablo, Lord of Terror. Or at least his generic mini-boss cousin. Fault’s attacks barely dent the thing’s health bar but I eventually win with the following clever strategy.

1) Watch the demon accidentally charge it’s way into a pit full of skeletons

2) Come up with a plan for using Fault’s newly gained high ground advantage for endless dive attacks

3) Stare in confusion as the skeletons friendly fire the demon to death before I jump even once

Must be that luck score at work.

As long as I still get the XP...

As long as I still get the XP…

Let’s Illustrate Dark Souls Part 13: Power Underwhelming

Last time Fault looted all the obvious treasure from the outskirts of the Chapel of the Deep. This time it’s back to the road of sacrifice to poke around the various ruins and swampy corners we ignored before. This yields some awesome treasure including the Farron Coal (which I completely forget was hidden here).

Bringing coals back to Andre unlocks new weapon upgrades and one of the Farron Coal upgrades is poison. Poison is one of the few weapon stats that supposedly scales with luck so we’ll be taking advantage of this as soon as we can find a poison stone to work with.

So we take the second exit out of the Road of Sacrifice and end up in the swampy Farron Keep which is full of poison slugs and toxic swamp water (But no leeches. Yay!). Fault then stabs her way through about twelve slugs and lo and behold one of them drops a poison stone. I must say that farming with a luck score is pretty neat.

Back at base Fault has Andre infuse her old bandit knife with poison. This not only adds the poison effect, it improves the existing bleed effect. Damage per-hit unfortunately takes a bit of dive but that’s what the fire rapier is for. Our new poison dagger will be for hit and run tactics against tough targets that we don’t want to fight outright.

Or at least that’s the plan. I have no idea how well poison works in Dark Souls 3 but it scales off of luck so this would be a pretty sad luck build if I didn’t try it at least once. (Update: It’s not that great. Most normal enemies are faster to just kill than to poison while most bosses are virtually immune to status ailments. Fault will be sticking with her rapier.)

This zombie feels mildly inconvenienced by having been poisoned.

This zombie feels mildly inconvenienced by having been poisoned.

Let’s Illustrate Dark Souls Part 11: How Magical

Fault has been doing a surprisingly good job of carving her way through the road of sacrifice without dying every three steps so I decide it’s time to head to the next boss. On my non-gimmick file I got lost and didn’t fight this boss until much later in the game when I was severely overpowered, so fighting it at the level I’m supposed to is actually kind of nice and gives me an opportunity to see all of the boss’s attacks! On the downside I wind up dying half a dozen times or so before winning but by Luck Knight standards that’s a roaring success.

Anyways, the boss here is a big old wizard who shoots you with crystal magic and teleports away every time you land a good combo on him. When he gets low on health he’ll start summoning clones that die in a single hit but spam magic attacks until then. Try to avoid getting caught in their crossfire and don’t get so focused on hitting the true boss that you neglect to watch your back for clones firing surprise crystal lasers.

This is actually one of the clones. The real boss is RIGHT BEHIND YOU RIGHT NOW!

This is actually one of the clones. The real boss is RIGHT BEHIND YOU RIGHT NOW!

Let’s Illustrate Dark Souls 3 Part 6: Performance Enhancing Embers

Last time Fault the thief forged herself a +1 fire rapier and then died repeatedly to the game’s first non-tutorial boss: Vordt of the Boreal valley.

The basic problem is that Fault doesn’t have enough armor or HP to survive more than one attack in a row, which is unfortunate because Vordt’s fighting style involves a lot of combos where he uses one attack to knock you over and then hits you a second time while you’re standing up. All the estus in the world won’t do you any good if you go straight from full health to dead without a chance to drink it.

The obvious solution here is to just avoid getting hit in the first place but my fire rapier only does 40 points of damage per poke, dragging the fight out and giving Voldt lots and lots of time to pull off a two-hit combo. I manage to work myself up to something like a 90% successful dodge rate but that’s just not enough when the other 10% is lethal.

I finally burn one of my precious early game embers which gives me just enough bonus health to survive the occasional two-hit combo. Fault can now survive long enough to fire poke Voldt to death.

This victory gives Fault a ton of XP souls which, according to my build rules, I have to use to level up luck. Bummer. But at least my luck is finally high enough I can start boosting my vitality for some extra HP!

This was much funnier in my head.

Let’s Illustrate Dark Souls 3 Part 5: A Burning Question

Last time Fault found enough upgrade materials to give one of her weapons a +1 bonus.

Equally important is the fact that she still has the fire stone she selected as a starting gift. This can be used to imbue a weapon with fire, which removes normal stat bonuses in exchange for a set amount of fire damage. Ex: A normal axe does extra damage based on how strong you are but a fire axe does the same damage no matter what your stats are.

Our luck build means that our stat bonuses are all horrible anyways so we should come out ahead in this deal. In fact, that’s why we picked this starting gift.

Most people can't draw hands, but I really have no excuse for also failing to draw a simple cube.

Most people can’t draw hands, but I really have no excuse for also failing to draw a simple cube.

But Fault only has enough materials to upgrade on of her weapons, meaning we have to decide between our rapier and our bandit knife. The rapier does more damage and has longer range but the bandit knife has a bleed effect that does bonus damage if you hit the same enemy enough times in a row.

In the end Fault goes with the rapier. It turns out that a fire bandit knife does slightly less bleed damage than a normal bandit knife and it seems a shame to mess with the weapon’s gimmick. Of course, neglecting to upgrade it means we won’t use it as often which means we won’t see the bleed effect anyways but, meh, decision making is hard.

With our shiny new +1 Fire Rapier in hand we go to tackle the first non-tutorial boss which, of course, absolutely destroys Fault over a dozen times in a row despite the fact that I’m doing a better job at dodging his attacks and exploiting his openings than ever before. Tune in next time to find out why.