gwillen: (Default)
Welp, the 2010 ICFP contest happened. I was on team CBV (Cult of the Bound Variable) with a bunch of CMU grad students and otherwise CMU-affiliated people. We placed in the top 5, which is exciting; we won't know how we did beyond that until the ICFP happens and they announce the results.

My part in this included the following:
- Helping to decode the trit-strings. I didn't take part in this until we managed to get to the point of having the server's parser to query as an oracle; then I worked on it with [livejournal.com profile] jcreed, 8, and some other folks, and spent I think a couple hours on it before we got it.
- Writing lots of perl. In particular, I wrote the perl code that drives our Mathematica-and-AMPL based solver; it grabs a car, runs an SML program to get the matrices and output them as a Mathematica program, runs Mathematica to expand them into scalar equations in a format AMPL can work with, then runs AMPL on the result to try to solve it. The only really interesting part here was gross parsing, the ease of which impressed at least one teammate enough that he's talking about learning Perl. Mission accomplished. ;-)
- I played with a lot of matrix math; but this mostly ended up being for my own entertainment.
- I debugged some SML, in particular our car-with-fuel checker. Debugging SML is much easier with exception backtraces turned on, let me tell you. Also, I maintain that a function which takes the product of a list of matrices is Just Wrong if it throws an exception for the empty list, instead of producing an appropriate identity matrix... but making it take an int for size, which is what I did, is admittedly awkward.
- I probably did other stuff I was too tired to remember...

There are probably other interesting things I can say about the contest, but since I just wrote up documentation of the trit-encoding of cars, I wanted to write a basic post so that I could include it. Maybe more will come later; knowing me, probably not.

The following is copied from a blog comment.

"""
As regards the ternary encoding: I was one of the rare people who really enjoyed puzzling through it, and in hopes that I can convince you that the encoding did have an underlying neat organization, I will present to you the schema I worked out for it, written in pseudo-ML-datatypes. Note that the representation of the tuple (‘a * ‘b) is just the representation of ‘a, concatenated with the representation of ‘b.

car = chamber list (* No, we don’t know how to represent ‘a list yet… *)
chamber = tank list * bool * tank list
tank = nat
bool = nat (* restricted to 0 or 1, with 0 being true *)

Now here’s where it starts to get weird:

nat = trit list
trit = 0 | 1 | 2

So a nat is just a list of trits. But how is a list encoded? And how do you convert such a list into a numeric value? Tackling the second question first,

value([]) = 0
value([0]) = 1
value([1]) = 2
value([2]) = 3
value([0,0]) = 4
value([0,1]) = 5
… and so on.

Now, on to how lists are encoded.

EDIT: see below for a better way to do this part.

I will call the encoding of list lengths “wnat” for “weird nat”, since that’s how it looked to me at first.

wnat = 0 | 1 | 22 * nat

Where the numeric value of the wnat is 0, or 1, or the nat plus 2.

And now we represent a list of N elements as the wnat N followed by the elements concatenated together:

‘a list = N : wnat . ‘a ^ N

in very rough made-up notation.


EDIT: After comparing notes with someone in the #icfp-contest channel on Freenode, it seems most elegant to say that we represent lists as a zero (for the empty list), or a one followed by a single item (for a singleton list), or a 22 followed by a number N, followed by N+2 items (for all other lists). Thus:

'a list = 0 | 1 * 'a | 22 * N:nat * 'a ^ (N+2)

As compared to the struck-through encoding I give above, involving an extra type of nats, this one feels much simpler.
END OF EDIT

That together should be enough information to encode and decode cars, and to get a sense of why I, at least, think the encoding is actually pretty elegant.
"""

SON OF EDIT: per [livejournal.com profile] _adept_'s comment below, I had made an error, now fixed, by claiming 22N encoded a list of length N, when it is actually length N+2 (since 0 and 1 already have their own separate encodings.)
gwillen: (Default)
[This is targeted at people in Pittsburgh, obviously.]

My lease is expiring at the end of June, and I have a lot of stuff I don't want to take with me or put into storage; either because it was left by previous residents, or because I don't really need it.

This means I will be looking to unload some used furniture of mixed quality at reasonable prices. Some of it I want to get rid of ASAP; some of it I will want to keep until a week or so before I move out, but will be happy to reserve for people.

For a first cut, the items I want to get rid of include chairs, bookshelves, dressers, tables, desks, and a futon (slightly broken, fixable.)

Let me know if you're interested; more posts to come.
gwillen: (Default)
[Disclamer: The following is a parody of a joke. It didn't actually happen.]

I was walking across the bridge on Forbes the other day, and I saw a man standing on the edge, about to jump. I ran over and said: "Stop. Don't do it."

"Why shouldn't I?" he asked.

"Well, there's so much to live for!"

"Like what?"

"Are you a student?"

He said, "Yes."

I said, "Me too. Do you go to CMU or Pitt?"

"CMU."

"Me too. Which school?"

"SCS."

"Me too. Do you do theory or systems?"

"Systems."

"Wow. Me too. Do you like compiled languages or scripting languages?"

"Scripting languages."

"Me too. Are you a Perl user or a Python user?"

"Perl."

"Me too. Perl 5, or Perl 6?"

He said: "Perl 6."

I said: "Die, heretic scum," and pushed him off.

With apologies to Emo Phillips.
gwillen: (Default)
My most amusing thoughts tend to happen at what might be called "stupid o' clock", so this one is right about on time.

It occurred to me to visualize my daily life as a constant argument between Myself and My Inner Petulant Five-Year-Old. For example:

*alarm rings*
Myself: Okay, time to get up.
MIPFYO: Don't wanna.
Myself: Well, too bad, we're getting up now.
MIPFYO: Don't wanna.
Myself: Okay fine, we'll hit snooze and sleep another ten minutes.

You may note that MIPFYO has a rather limited vocabulary.

On a lark, I decided to google for "inner petulant five year old" (without the quotes). It only occurred to me how stupid a search that was after I had already made it; thus is the power of stupid o' clock. And yet, in the top 10 results, five of them are apparently referring to the same concept I am, one in almost the same words: "my Petulant Inner Five-Year-Old".

I can only conclude that my strange 1 AM thoughts aren't as strange as I thought. I shall have to endeavor to be stranger next time.
gwillen: (Default)
Ass.

I need to pick up a package that was supposed to be delivered to me via USPS. Problem: My post office is in East Liberty, and its hours are stupid. It closes at 2 PM Saturday, 5 PM weekdays, and is closed on Sunday. I made myself a note to go today; when I discovered the note just now at about 10 minutes to 2, my response was as noted in the first line of the post.

Can I pay someone with a car to give me a ride from campus to East Liberty and back sometime before 5PM on Monday?

Snoooooooow

Feb. 6th, 2010 02:03 pm
gwillen: (Default)
I will be playing in the snow outside the entrance to GHC3 at like 3:30. Join me! Civil engineering will be attempted. If you have shovels, or things that function as molds for snow, bring them! Small (1.5ish foot tall) office trashcans work especially well, grad students! ;-)
gwillen: (Default)
Apparently WikiLeaks has suspended operations due to lack of funds.

If you like them, and you have money, give them some money. I am.

ETA: It's also worth noting that they can't use low-bid hosting -- they get constant takedown notices and lawsuit threats, so they have to use so-called "bulletproof" hosting, most often used by spammers, so they don't get shut down every time someone threatens their webhost with a lawsuit. This adds a substantial multiplier to their hosting cost.
gwillen: (Default)
For those on my flist, if any, who support the Court's decision in /Citizens United v. FEC/, I would be interested to know your answers to the following questions:

Is a toaster a person?

Is a corporation a person?

Can you explain the difference?

What would it mean for a toaster to have a right to free speech?

What does it mean, precisely, for a corporation to have a right to free speech? This is not the same as the free speech rights enjoyed by any of the people involved as individuals -- this, as ruled by the court, is a separate right, belonging to the corporation as an entity in and of itself, completely independent of the rights of any of the individuals involved.

Can you explain the difference?

ETA: Justice Rehnquist's dissent in /First National Bank of Boston v. Bellotti/
makes for excellent reading on the subject.
gwillen: (Default)
Please go here:

Manage LJ Account

and check whether your journal is set on "Basic" or "Plus".

If it's set on Plus, that means you get a few marginal features, in exchange for 1) you are seeing a bunch of stupid video ads, and 2) I am being forced to look at banner ads when I view your journal.

If you didn't realize you were on Plus, or you didn't realize the implications: Great. Switch it to Basic and everyone will be happier, and you will no longer have to suffer through video ads when using LJ.

If you are using Plus on purpose: Out of curiosity, why?

If you were using Plus by accident, please comment because I am curious how many people they did this to.

ETA: Apparently if your journal style is 'grandfathered' and is not currently available to free accounts, you will lose it if you switch. I don't know what other settings might be grandfathered in this fashion, so proceed at your own risk.

PSA

Dec. 6th, 2009 11:57 pm
gwillen: (Default)
I will be in Mountain View / San Francisco next week (Monday night through Sunday morning.)

EDIT: That means starting tomorrow. Not a week from tomorrow! Sorry. :-)
gwillen: (Default)
Is there a name for the fallacy of assuming, when one is in the dark, that everyone else actually knows what's going on? I don't mean this in a conspiracy sort of way; just a sort of implicit assumption that, when in doubt, other people have more complete knowledge than oneself.

As an example of this, consider real-time strategy games, i.e. Starcraft. I always inordinately fear what's going on in the part of the map that I can't see; obviously my opponent is building up a massive army and preparing to destroy me with it. (Note that this is typically not true.) But I fail to properly take account, in my own strategy, of the fact that my opponent cannot, in fact, see what I'm up to either, and may well fear that unknown; and that I should be using this to my advantage.

Does everyone do this? Is there a name for it?

PSA

Sep. 19th, 2009 01:00 am
gwillen: (Default)
I am in the San Francisco area until Friday (the 25th). Hang out with me!
gwillen: (Default)
Today I learned what a NOM2 EDGE network is. (It is sadly not related to the nomfunctor.)

http://reviews.cnet.com/8301-19512_7-10115034-233.html?tag=mncol;title

I don't have an iPhone to try this with, but sure enough, T-mobile's EDGE network is Pittsburgh is NOM2, which does seem to explain why my G1 has problems receiving calls when using data.

Since this seems to be well-documented, why is it so hard to find out? >.>

On the plus side, I've heard a rumor that T-Mobile may have 3G service planned for Pittsburgh. Pretty please?

PSA

Aug. 14th, 2009 11:52 am
gwillen: (Default)
I will be visiting Redondo Beach, August 15-19.
gwillen: (Default)
For Unix wizards out there: Here is a neat puzzle I just solved for a coworker. See if you can solve it. :-)

# Pipeline that prints every line in somefile:
cat somefile | while read FOO; do echo $FOO; done

Output:
line1
line2
...


# Pipeline that should do something on a remote host for every line in somefile:
cat somefile | while read FOO; do echo $FOO; ssh remotehost "<some command>"; echo "DONE."; done

Output:
line1
<output of ssh command>
DONE.
<END OF OUTPUT>


Why does the loop only seem to run once? (You can try this on your own system; for an example, try using '/etc/passwd' for somefile, and 'id' for the command. My guess is you will get the same problem; if you don't I'd be interested to hear that.)


EDIT: Wow, time to first complete answer: 38 minutes. I will remember to ask elljay next time I am perplexed. I was wondering aloud to my coworker as I posted this whether anyone on my friendslist did enough shellscripting to care about this puzzle. :-)

(I think it took us about half an hour to figure it out also, because I think that's about the length of the meeting we were ignoring while we fiddled with it.)

PSA

Jul. 16th, 2009 01:09 pm
gwillen: (Default)
Public Service Announcement:

Google is hiring [more]! ;-)

Message me in some fashion for details / to express interest.

Swine flu

Apr. 25th, 2009 03:00 pm
gwillen: (Default)
Apparently there have been some very recent cases of H1N1 swine influenza, a strain not generally seen in humans, with confirmed human-human transmission.

CDC: http://www.cdc.gov/swineflu/investigation.htm says cases have been seen in Mexico, San Diego/Imperial counties in CA, and in San Antonio, TX.

I don't think I know anybody in San Antonio or Mexico, but those of you in San Diego please be careful. :-\

EDIT: Also unconfirmed cases in New York. You guys stay safe too.
gwillen: (Default)
I have a bad feeling I'm going to need an oscilloscope to get my IMSAI back into fully-working order. Anybody have one they want to lend me for a month or two?

Currently it will execute anywhere from a few to a few dozen instructions correctly, then launch itself off into the weeds...

EDIT: Apparently the thing I really want is called a "logic analyzer". But an oscilloscope would be better than a hole in the head.
gwillen: (Default)
Dear lord, it appears that the GNOME developers have completely lost their fucking minds:

http://bugzilla.gnome.org/show_bug.cgi?id=552387

*sigh* This is the sort of bullshit I really hate about open source. You give people lots of power and no accountability, and lo and behold, they do stupid shit. I wish there were a good solution to this.

EDIT: Oh, and I think the only reason that everybody is being so civil on that bug, in light of the developers being COMPLETELY OFF THE RAILS, is that there's a threat at the bottom from the moderators to ban people who rant. Lulz.
gwillen: (Default)
I need a puzzlehunt team for the KGB hunt on March 28!

http://twistytimelines.com/

Difficulty: I have been one of the organizers/writers for each of the previous hunts, so the following restrictions on my participation are suggested, probably vaguely negotiable: If I have any other past writers or past winners on my team, we play as an exhibition team only (we can't win). I would be fine with that. If I play with a team with three people who have never won a hunt or written for one, we would probably be allowed a shot at winning. :-)

Any takers?
Page generated Jun. 7th, 2025 07:39 am
Powered by Dreamwidth Studios