Coding a Parser

By Shamus Posted Wednesday Dec 26, 2012

Filed under: Programming 112 comments

I spent Christmas day coding. That was fun. As part of my efforts to move to Linux, I decided to port some of my code. One of the first things I’ll want in the world of Linux is the ability to read .ini files.

I really like .ini files. You can put any program settings in them in any order. You can edit them with a text editor. You can read and write to them from within your program. This is much better than (say) storing all your settings in binary files. Some people are moving to XML these days, but XML files are massive overkill for a job like this, and end up being incredibly verbose and annoying for humans to read. For context, here is the .ini file for Project Frontier:

Continue reading ⟩⟩ “Coding a Parser”

 


 

Postcards From Linux Part 3:
Mouse vs. Keyboard

By Shamus Posted Monday Dec 24, 2012

Filed under: Personal 88 comments

splash_linux.jpg

My adventure into the world of Linux-using continues. With regard to the holy war of GUI interfaces vs. the POWER OF THE COMMAND LINE, I have to say that I see this as a false dichotomy. A menu lets you know what can be done, where stuff is, and what the options are. Once you know these things, a command line is [sometimes] the fastest way to do them. In the terminal I feel blind. In a windowed situation I feel like it’s too many steps to reach certain options.

You know what interface paradigm I always loved? Games made with id Tech 4 and Source engines. (Doom 3 and Half-Life 2, respectively.) You’ve got your menus and sliders and checkboxes and whatnots, but if you need to get into the crazy stuff you tap tilde and you’ve got sleek command line interface with text coloring, command history, script execution, and autocomplete. Yes, I know operating systems are more complex than videogames, but there’s a lot of value in this hybrid approach.

An interesting problem I like to think about: How can you use the GUI to teach the user to use the command line? I know this is heresy to the purists, but I see a lot of value in it. However it worked, it would have to be like keyboard shortcuts: When you look at a menu it usually lists the keyboard shortcuts for the stuff you’re doing. You can use the menu or the shortcut, and it’s up to the user when they want to make the mental investment of learning to do things the optimal way. If you select the same thing again and again, you’ll get irritated enough to memorize the shortcut. However, you never have to memorize anything and are free to do almost everything with the mouse. Repetition will create a desire for optimization which will create willingness to learn.

For me, a great example of this is MySQL. I use it once every six months or so. These intervals are so far apart that I don’t remember the commands. I have to look up every command, every time. One example of a dozen:

Continue reading ⟩⟩ “Postcards From Linux Part 3:
Mouse vs. Keyboard”

 


 

The Walking Dead EP12: Fork This Guy

By Shamus Posted Saturday Dec 22, 2012

Filed under: Spoiler Warning 115 comments


Link (YouTube)

So, it’s only been three months since the OMGZOMBIEPOCALYPSE event, and already these people have resorted to cannibalism. That’s quite a stretch, particularly since – of all the people we’ve met so far – they seem to be the least likely to go hungry. I mean, they have the ingredients to bake biscuits. I don’t know how long I would have to eat biscuits before I became so bored with them that I felt the need to add people, but I’m pretty sure it would be longer than this.

Also they really are terrible cannibals. I mean, they’re feeding the group, which is going to cost them a lot of food. Also, what kind of idiot would keep their slaughterhouse in this condition? Since they’re slaughtering for food and not for giggles, this place ought to look like a butcher shop and not like a serial killer’s playroom. A butcher who kept his kitchen in this condition wouldn’t live long.

Here is my outcome for episode 2:

Continue reading ⟩⟩ “The Walking Dead EP12: Fork This Guy”

 


 

The Walking Dead EP11: A Salt and Battery

By Shamus Posted Saturday Dec 22, 2012

Filed under: Spoiler Warning 128 comments


Link (YouTube)

So we’re trapped in a freezer. Larry is having some sort of unspecified heart trouble. He might die. Me might already be effectively dead. If he dies, then after some unknown (but short) interval he will rise again as zombiehulk. Lilly is performing CPR on him and wants help. Kenny wants to bash his brains in with one of these salt bricks.

So… what do you do?

The problem here is that the situation is constructed around a few common misconceptions regarding heart failure and CPR. Abnaxis posted a comment in Episode 9, which I will quote here:

[…] you also need to understand that the purpose of (civilian) CPR is not to restart the victim's heart, it is to keep blood flowing to their brain to keep them alive long enough for the professionals with defibrillators and epinephrin to show up and take over. That is why the first priority should always, always be to call pramedics, even if you have to pause resuscitating to do it (preferably you tell someone else to do it while you start resuscitating).

For my reference, I only really have my training, although the first section of this wiki article says what I am going for. Virtually every other CPR training material says the same thing: the purpose of CPR is to keep people alive for a few minutes longer, because brain damage starts after 4 minutes of no circulation, and the average EMT response time is 10-15 minutes.

As for the article you quoted, that is intended for medical professionals in a hospital setting. Doctors don't get to wait for medical professionals to show up, they are the medical professionals, with the training and knowledge required to recognize the (extremely few) cases in which CPR might have a chance to restart a stopped heart.

All of these points do not apply to the situation we are talking about. Lee, et. al., are certainly not medical professionals. There are no EMTs alive, let alone any coming. […]

For my part, I didn’t know any of this. I took the situation at face value, that the CPR could plausibly revive him and we were simply refusing to risk our lives to save his. But regardless of whether or not CPR can actually save his life, all three characters believe that it can and they don’t have access to Wikipedia. Like shocking a flatline , it’s a bit of medical nonsense that has permeated popular culture because of its usefulness as a storytelling device.

There’s no way for them to know that they’re wrong, so they react to the scenario just like most uninformed people do. On the other hand, This is made more complex by the fact that there’s some combination of actions that will result in Larry opening his eyes just as the block comes down. So in the reality we see here, Larry is unrealistically revived by CPR. This makes a mess of the discussion among the audience, since the “what would you do in this situation” is so undefined. What would I do in this situation in the real world (where CPR only staves off brain death until the paramedics arrive) could differ from what I would do in this world (where CPR revives someone with no pulse) and we don’t know the parameters of how zombification works or how long it takes.

Also worth reading is this comment by anaphysik, regarding how nitroglycerin pills work.

 


 

The Walking Dead EP10: What’s Not to Like?

By Shamus Posted Thursday Dec 20, 2012

Filed under: Spoiler Warning 73 comments


Link (YouTube)

Okay, so we suspect something might be amiss at this farm. This suspicion is so strong that we’re willing to behave very suspiciously ourselves, to the point of committing acts that could provoke our hosts to violence. Then we sabotage the fence, which is keeping us safe from walkers. So we’re pissing off our hosts and lowering our defenses against zombies, right as night approaches. If the danger is so strong that we’re willing to risk all of this, then… why are we still here?

Because we’re hungry. Because Larry is a stupid dumb idiot and a horrible judge of character who wants to stay. Because Mark is here and we can’t ditch him.

This game does a really good job of riding that line between “this is a very risky thing to do” and “this is an obviously stupid course of action”. If you don’t go far enough as a writer, the story feels flat and boring. If you go too far then the audience rejects the whole thing as absurd. Right between those points is where you get dramatic tension.

I thought that cutting the power to the generator was a dumb thing to do, but it was plausibly dumb. I could believe that a group of people might behave this way if pushed into this situation. I did sort of resent having to do it myself, though.

In a TV show, you can have the main characters do things while the audience looks at them and says, “This won’t end well.” It’s much harder to do in a game, because the audience is being asked to perpetrate the act that they perceive to be foolish. I don’t claim that The Walking Dead never made any mistakes with this balancing act, but it’s still some really impressive work.

 


 

Postcards From Linux Part 2:
How Do I Work This?

By Shamus Posted Thursday Dec 20, 2012

Filed under: Personal 184 comments

splash_linux.jpg

If I’m going to indulge this pipe-dream of Linux-using, then it’s time to stop fussing around in Minecraft and work on something serious. It’s time to see if I can use Linux to program. If I can’t do that, then I ought to walk away now before I get too comfortable.

Going by the comments yesterday, it seems like Eclipse is the go-to IDE for coders on Linux. (IDE means “Integrated development environment”, and is to coding what a word processor is to writing) I open the Software manager and install it. It seems to work fine, except…

Eclipse IDE for Linux Mint

For a quick test, I input the classic Hello World program to find that Eclipse can’t find <stdio.h>. This is very strange. I expected some confusion and growing pains in moving to Linux, although I didn’t expect them quite this soon or quite this simple. For completeness, I try the C++ variant of Hello World, and discover that it doesn’t know what to make of <iostream>.

This is such a basic, fundamental failure that I don’t know where to begin. Imagine if word processors would only let you use a word if it was in the dictionary. Now imagine a word processor that came without any dictionary. That’s what we have here. This is a C development environment that doesn’t know C.

Is this a problem with Eclipse? A problem with my Linux install? A problem with how I set up this project? I don’t know, and so I don’t know where to look for answers. In bemused frustration (yes that’s possible) I turn to Twitter. My tweeps suggest that code::blocks is a good IDE to use. So I install that.

Continue reading ⟩⟩ “Postcards From Linux Part 2:
How Do I Work This?”

 


 

The Walking Dead EP9: Dangerous In Tent

By Shamus Posted Wednesday Dec 19, 2012

Filed under: Spoiler Warning 112 comments


Link (YouTube)

As Rutskarn blabed at the top of the episode, he’s right now in the depths of the Aunty Paladin’s Kid-Helping Extravaganza, a week-long marathon of tabletop gaming and chicanery, all in the name of helping tiny baby children peoples. I’d suggest you avoid the official webpage, which is nothing more than information and a link to the stream in question where you can watch the endless cavalcade of 24/7 gaming for free. You don’t want that. If you did go to the stream, someone in the chat might be able to explain to you what a “pygmy space moose” is, how it ties into the game they played earlier, and how it relates to me.

So, again, just stay here and watch spoiler Warning and don’t bother with Aunty Paladin’s Kid-Helping Extravaganza.

Also, this post was supposed to go up yesterday but I forgot what day it was. I blame Linux.

I think a big contributing factor to my dislike of Larry was that I played through the first two episodes back-to-back. So for me this conversation at the gazebo took place about an hour after he tried to murder me. If I’d waited weeks in between episodes like most players, then maybe my irritation would have subsided a bit. Also, his whole thing about “just looking out for his daughter” actually made me dislike him more. It made him a jerk and a towering hypocrite, since he wanted to kill someone else’s kid without even making sure Duck had been bitten. And then he never owned up to just how totally stupid and wrong he’d been about the whole thing and about how his wrongness made a tense situation worse. And then the entire group was put in peril trying to get him medicine and someone died as a result. And then he tried to kill me after I saved his life.

So yeah, when I got to the gazebo conversation the whole “he just cares about his daughter” thing just didn’t work for me as an excuse. Ken left someone to die to save his own son, and felt bad about it later. Larry tried to murder someone to protect his not-in-harm’s-way daughter who can take care of herself, and never regretted it.

In short: Larry is a good character but a horrible person.