Archive for March, 2010

NHL ’94 follow-​​up

March 26, 2010 in Personal | Comments (0)

Tags:

This is an addendum to this post where I was try­ing to make NHL ’94 more challenging.

I’ve all but given up on try­ing to give the com­puter an extra use­ful player in shootout mode. Giv­ing the com­puter an extra player who stands and does noth­ing is trivial. Unfor­tu­nately, the “AI” for shootout mode is — maybe not sur­pris­ingly — hard-​​coded — it doesn’t even take into con­sid­er­a­tion the pos­i­tion of the goalie — and rewrit­ing the AI in 65C816 assembly is bey­ond the scope of my free time. This is easy to show by watch­ing the dif­fer­ing beha­viour between when the com­puter gets a break­away (in reg­u­lar mode) com­pared to how it behaves in shootout mode.

So I play in reg­u­lar mode with a 3-​​man han­di­cap. E.g., we play 5-​​on-​​2. If you watched the first video from my last post, you’ll notice that han­di­cap­ping your­self makes the game beep con­stantly. It’s very very irrit­at­ing. Fix­ing this is actu­ally not com­pletely trivial. For those that are impa­tient, here are the memory addresses I’m using:

Address Descrip­tion Example value
7E17A6 Num­ber of play­ers for the home team 3
7E18BA Good ques­tion! See below 12
7E1864 Num­ber of seconds left in the penalty 40

Using the val­ues above will stop the incess­ant beeping.

I haven’t had time to fully explore the implic­a­tions of 7E18BA. Just from obser­va­tion, it seems that that the 7E1860 – 7E18C0 range is an array of player state and 7E18BA is an off­set into that array which per­tains to the pen­alty. By set­ting 7E18BA to 0x12, it seems, you indic­ate which ele­ment of the array from which to draw penalty-​​time-​​remaining inform­a­tion. I only use the value of 0x12 and the asso­ci­ated address 7E1864 because those are what came up for me dur­ing debug­ging (Mike Gart­ner, if you’re curi­ous). I haven’t found any rhyme or reason to the num­ber 0x12 yet, but I don’t really care too much at this point.

As a side note, someone really needs to come up with a bet­ter tool for “RAM cheat­ing”. For those unfa­mil­iar, the gen­eral pro­ced­ure for this style of black-​​box debug­ging — usu­ally used for cheat­ing, though in my case I guess it’s anti-​​cheating — is to snap­shot RAM at vari­ous stages of play. You then com­pare the RAM images accord­ing to what state you’re look­ing for. E.g., if you want to know where the num­bers of play­ers on the ice is stored in RAM, you snap­shot when you have 6 play­ers on the ice a few times and again when you have 5 play­ers on the ice and look for the num­bers “6” and “5” to con­sist­ently appear in RAM.

If you have a hacker men­tal­ity, this way of doing things can be pro­duct­ive, but it’s pretty crude. Gen­er­ally the tools avail­able don’t allow you to com­pare bit-​​values, only byte-​​values, and com­par­ison oper­at­ors are pretty lim­ited. After half-​​heartedly try­ing to fol­low along with Jasna’s AI assign­ments, I’d be sur­prised if this prob­lem hasn’t been solved gen­er­ally and prop­erly in the AI aca­demic com­munity. Oh well.


Grocery store checkouts

March 22, 2010 in Personal | Comments (4)

Tags: ,

For the past year or so, I’ve been tim­ing how long it takes for me to go through the check­outs at our gro­cery store to see which is faster.

The meth­od­o­logy is quite simple. Once I’ve got all my gro­cer­ies, I go to the same spot near the check­outs. To avoid bias­ing myself, I check my cell phone to determ­ine whether to go through the self check­outs or the nor­mal check­outs. Because my cell phone lacks a ran­dom num­ber gen­er­ator, I check the last digit of the time: an even digit means I go through the nor­mal check­out and an odd digit means I go through self check­out. I then start the stop­watch and time how long it takes for me to go through the check­out and leave the store.

I’ve got 31 data points and have finally decided that if one type of check­out is faster than the other, the dif­fer­ence is small enough to not really mat­ter. Here’s the scat­ter­plot:

A sample size of 31 is unim­press­ive, to be sure, but it’s large enough that I can finally rest easy know­ing it would be a waste of time to col­lect more data. Try­ing to get out of the gro­cery store in the fast­est way pos­sible seems to have more import­ant factors, such as the num­ber of jerks ahead of you in line.

As a side note on how that scat­ter­plot is presen­ted, it prob­ably would have made a lot more sense to meas­ure the time taken as a func­tion of how many items I bought, rather than the cash value of the items I bought. I’m far too lazy to count things, though.

So, from now on I’ll be decid­ing on self check­out versus nor­mal check­out based on how social I’m feel­ing. I sus­pect that means I’ll be using the self check­out a lot.


NHL ’94

March 14, 2010 in Personal | Comments (4)

Tags:

As any­one born around 1980 would know, gam­ing reached abso­lute per­fec­tion with the release of NHL ’94. It’s great if you want a 10-​​minute diver­sion and I’ve been play­ing a few minutes of here and there for the past few months.

There’s one ser­i­ous prob­lem with NHL ’94, how­ever: the AI is abso­lutely ter­rible. Play­ing in single-​​player mode is way too easy. Play­ing as the worst team (either Flor­ida Pan­thers or Ott­awa Sen­at­ors) against the best team (All Stars East) I can win 5 – 0 without much effort.

In shootout mode the AI is even worse. If you put the goalie on auto­matic mode (the com­puter con­trols your goalie) then the oppos­ing team does alright, but it’s no fun. If you put the goalie on manual mode (you con­trol your goalie) I’m not con­vinced it’s actu­ally phys­ic­ally pos­sible for the com­puter to score on you.

I had the bril­liant idea that maybe the game would be more fun if the human player were han­di­capped. Maybe shootout mode would be more fun if the com­puter had 2 play­ers instead of just 1? I have my doubts, but it got me thinking.

So one idea was to dis­as­semble NHL ’94, add in some 2-​​on-​​1 shootout code and reas­semble it. For­tu­nately there are people out there who take hack­ing the Super Nin­tendo more ser­i­ously than any sane per­son should, so there are some tools avail­able. Learn­ing 65C816 assembly code, dis­as­sembling the game and then tra­cing through and debug­ging soun­ded like the sort of thing that one does after they’ve fin­ished writ­ing their thesis, so I filed that under “plan B”.

Plan A became to track down where cer­tain deli­cious global vari­ables, such as the num­ber of play­ers on the ice, were being stored in memory and modify them as the game was being played. After about 20 minutes of toy­ing around, I got some­thing to work.

Here’s me in reg­u­lar hockey mode, but with only 1 skater instead of 5:

The con­stant beep­ing (sorry) is due to NHL ’94 fool­ishly think­ing that since I’m down 4 men, the other team is on a power play which is end­ing soon, in 0 seconds to be exact. Note the game mis­takenly gives credit for the goal to Zhit­nik and Hrudey of the LA Kings instead of Schneider and Roy of the Montreal Canadiens. Weird.

Here’s me in shootout mode:

Unfor­tu­nately I acci­dent­ally gave myself an extra player instead of the com­puter, but it still demon­strates that my idea won’t work without a lot more fid­dling. The extra player just stands there doing noth­ing. Sigh.


Alizée

in Personal | Comments (0)

Tags:

I think I’ll work a bit more on the novel today, some­thing I haven’t done in prob­ably a couple months. I always kind of knew, but it’s become increas­ingly obvi­ous that the core of the novel isn’t so much a story as an explor­a­tion of human­ity, the defin­i­tion of human­ity and espe­cially the rela­tion­ship between human­ity and lan­guage. In a nut­shell, it’s a story thread­ing a col­lec­tion of things humans do. I hope it works.

One thing that’s always bothered me about human­ity, and in par­tic­u­lar lan­guage, is the nature of love. Poetry, and art in gen­eral, deal­ing with love tends to be pretty unin­ter­est­ing in my view, more an exer­cise in one-​​upmanship to describe the intens­it­ies of love, focus­ing more on the effects of love than the bare mech­an­isms. There are excep­tions, of course, but rare. We have an embar­rass­ment of words avail­able to use to describe shades of the col­our red but have an awk­ward strait­jacket when it comes to some­thing more com­plex and import­ant, like love. It’s not just Eng­lish that’s the prob­lem, either.

Enter Alizée. She’s not a fant­astic musi­cian and, as one red­dit com­menter so elo­quently put it: “I wish my teeth were as white as her dance moves.” The lyr­ics are fairly asin­ine and for once I’m grate­ful that my French is bad enough that I can only pick out a few bits and pieces of it. For those who are curi­ous, as best I’ve been able to garner, the entirety of the song is about tak­ing a bubble­bath, describ­ing the bubble­bath and how it relates to the exper­i­ence of tak­ing bubble­baths and being lazy.

None of that really mat­ters, though. It’s some­what fit­ting that she’s French as she strikes me as a modern-​​day Nana come to life. Well, except­ing that Alizée’s not a whore. Another extremely, in my opin­ion, insight­ful red­dit com­ment on the topic of how hot Alizée is:

Not just fap hot either. This is exactly what would make me lose in /b/‘s “You fall in love you lose” threads.

That pretty much sums her up. It doesn’t mat­ter what she’s doing oth­er­wise or what she’s singing. Once the spot­light is on her, all it takes is one know­ing smile and a cock of her head and before you’ve even regained cog­niz­ance you’ve fallen in love with her.

It’s not love, of course; I don’t know what it is. I can’t bring myself to call it “love at first sight” since that describes some­thing com­pletely dif­fer­ent to me. The effect doesn’t dimin­ish know­ing it’s just a per­form­ance, but it’s not lust either. But it’s a real exper­i­ence; it’s a spell in a very real sense. The last time I watched one of Alizée’s songs — she’s def­in­itely the sort of musi­cian you watch, not listen to — I think she was all of about fif­teen years old and even at that young age she had the abil­ity to com­mand an entire audi­ence. It seems she’s only become more power­ful since then.

The crown jewel of Nana, in my opin­ion, is the open­ing chapter where she’s first per­form­ing in the opera and where she first wins her ador­a­tion. Even when I was first read­ing it I wished the entire novel could have been the first chapter or two. The destruc­tion of the men around her dom­in­ated the rest of the novel, but the secret of her magic was never really revealed in any sub­stan­tial detail.

The spells of Nana and Alizée are cast every day and I sup­pose it can be taken as noth­ing spe­cial, but that doesn’t sat­isfy me. I’ve never found a nice reduc­tion­ist explor­a­tion of the phenomenon.

I’ve got a bit of a back­log of oddit­ies to write about so I don’t know if I’ll get to it today, but there’ll prob­ably end up being at least a chapter about this.


Environmental eating

March 9, 2010 in Personal | Comments (1)

Tags: ,

I had this crazy idea to start up a new web­site today, spe­cific­ally a wiki.

Jasna’s veget­arian and I’m semi-​​vegetarian (“flex­it­arian”, Wiki­pe­dia informs me), only because I’m a picky eater and the veget­arian options out­side of what we pre­pare at home often aren’t great.

Envir­on­mental reas­ons are cer­tainly the primary reas­ons for both of us. Meat is inher­ently inef­fi­cient: for most anim­als humans eat, it takes some­where around 10 Cal­or­ies of plant mat­ter to make 1 Cal­orie of animal mat­ter and it would make a lot of sense envir­on­ment­ally — and prob­ably eco­nom­ic­ally as well — to cut out the middle man and just eat the 10 Cal­or­ies of plant mat­ter. That inef­fi­ciency leads to increase land usage, water usage, soil erosion, etc. There are other envir­on­mental prob­lems, such as sewage and meth­ane emissions.

Well today I was lament­ing to myself that there really is no resource for find­ing out exactly what the envir­on­mental costs of foods are! To be sure, draw­ing the line at meat is a little arbit­rary. Veget­arian food, espe­cially meat altern­at­ives like TVP, can go through a lot of pro­cessing and, for all I know in my ignor­ance, end up being just as bad as meat. On the other side, for all I know, also in my ignor­ance, there are some meats out there that really aren’t a big prob­lem at all.

So I have a vis­ion: what if there were a wiki that allowed con­sol­id­at­ing inform­a­tion and maybe even ori­ginal research into what the envir­on­mental costs of foods are?

I don’t know if it’s prac­tical at all. To gauge interest I did my best at ask­ing an unbiased sur­vey while keep­ing an eye on the “Envir­on­mental dam­age from hus­bandry” option. My biggest fear is I’d just be cre­at­ing a web­site for myself that no one else will ever read; I already have one of those.

The closest thing I’ve found to what I’m look­ing for is food­ori­gins but it’s not really aim­ing at the same thing.

I don’t know. I’ll mull it over for a while longer. At stake is $10 for a domain regis­tra­tion and how­ever long it takes to set up a wiki these days.


Victory! Almost

March 7, 2010 in Personal | Comments (0)

Tags: ,

After yesterday’s fail­ure I brought a bit of extra duct tape and super glue and got the car back in work­ing order with the cam­era affixed to it nicely. I took it out again this after­noon to see if I could get the cam­era to sur­vive some small jumps off some staircases.

The good news is my duct tap­ing and super glu­ing worked. The cam­era didn’t move an iota — though sadly I had to tilt it a bit to the left to get it seated prop­erly — and the servo con­trol­ler stayed where it was sup­posed to.

Before I get into the down­sides maybe I’ll just show the video.

So the first down­side is that the video ends about five minutes earlier than it should have. When I rolled the car it rolled onto the shut­ter but­ton, unbe­knownst to me. It’s too bad since the crazier/​more abus­ive stuff came after that.

The second down­side is that both the cam­era and car took more abuse than they have before. The metal cas­ing on the cam­era got scraped off on one corner. One of the front shocks on the car came apart, which is espe­cially bad con­sid­er­ing it’s an oil-​​filled shock absorber. I haven’t decided what I’ll do about that.

The third down­side is that since I had to run the car without a body in order to get the cam­era on, it got more water dam­age than usual. Cur­rently it only goes in reverse. I’ll take another look at it after it dries out.

I think I’m going to put this short-​​lived remote con­trolled car video­graphy pro­ject aside until I fig­ure out a way to get things to sur­vive better.


A second stab at videography

March 6, 2010 in Personal | Comments (1)

Tags: ,

The last time I attached a cam­era to my remote con­trolled car the major prob­lem, from my per­spect­ive, was that it was too bumpy, to the point of not being able to see any­thing, really. The solu­tion to this is two-​​fold:

  1. Do it on pave­ment instead of snow.
  2. Attach the cam­era more securely.

Since it’s been crazy nice lately — 4º for the past couple days — we’ve had a lot of dry pave­ment com­ing out, so I took the camera/​car com­bin­a­tion out again today. I attached the cam­era dir­ectly to the chassis with the help of a styro­foam shim, rather than to the body like I did last time.

It star­ted off prom­ising! Up until the last ten seconds I think it counts as a mod­est suc­cess! There’s not so much boun­cing and you can actu­ally see what’s going on.

Sadly, those last ten seconds…yeah, I turned left when I should have turned right. It not only knocked the cam­era off, but it knocked the con­trol­ler off the chassis. The design of the car is rather stu­pid in this regard: the con­trol­ler is just can­ti­levered, held in by adhes­ive, in my case super glue. I’ll re – super glue it and see if I can’t try again tomorrow.

My ulti­mate plan was to take it off some sweet jumps. Now I’m won­der­ing if the cam­era will sur­vive the trip: it was just held in place by the afore­men­tioned styro­foam shim and some duct tape. I’ll try it with more duct tape and see if I can’t get it to sur­vive a jump tomorrow.