Matt Hackmann

Arduino Project #1 - Taiko March

Posted On
Tags
arduino
code
game

I've been wanting an Arduino microcontroller for some time and last week I finally broke down and bought one. I've been dicking around with some simple projects, but on of the things that I've been eagerly looking forward to doing is a computer controlled Christmas lights setup. There are some selfish reasons, I'll admit, like winning the company Christmas decorations contest. But, I digress.

To that end, I horked some code from a Taiko no Tatsujin clone I'd been writing a few years ago and tossed the output at the Arduino via serial data. Here's the result:

Code is after the break!Read More

Today's Post is Garbage

Posted On
Tags
code
daily

Today, I was having an argument with my brother about multidimensional arrays and coordinate systems. The specifics are a bit complex to go over here, but at its core, he wasn't mentally picture the structure of an array correctly and so was reading his array's wrong causing them to display as if they were rotated 90 degrees.

I don't really remember having any issues when dealing with arrays, though these days, I generally stick to single dimensional arrays and use math if I need to convert from, say, a screen coordinate to its corresponding spot in the data structure. Particularly, and in the case of our argument, we were talking about reading in a map file. That got me thinking about this trinket I wrote several years ago.

So majestic

Download Source

If I recall, this test was more about scripted AI and platform physics, but there was a loadable map aspect as well. Maps are something I've played around with for a very long time, one of my first programming mental puzzles being how to generate one that wasn't gibberish programatically. This was something that baffled me for the longest time, but I eventually did figure something out and even wrote a tutorial about it.

But, really, this whole little tale and code offering are because I had no idea what to talk about otherwise. I suspect I shall have less issues tomorrow (for reasons that will become clear), but that hardly helps me in the here and now.

Calculate Moon Rise and Set in PHP

Posted On
Tags
code
daily
release

If you've been paying attention to my Twitter account, you've probably seen a reference or two about how I've been calculating the positions of astronomical bodies. Well, today I release part of that to you.

Download: Source

The above code is pretty much a direct port of Keith Burnett's implementation here. Outside of porting, my only changes were some code clean up and having the timezone be calculated automatically for the longitude given. This means that you will always get back a time stamp that is local to the point of origin.

How to Use

Moon::calculateMoonTimes(month, day, year, latitude, longitude);

Code: php
  1. <?php
  2. date_default_timezone_set('America/Chicago');
  3. include('moon.php');
  4. print_r(Moon::calculateMoonTimes(6, 28, 2011, 36.754478, -96.110291));
  5. ?>

The above code will output the following result:

Code: output
  1. stdClass Object ( [moonrise] =&gt; 1309246800 [moonset] =&gt; 1309300560 )

Moonrise and moonset, as stated previously, are a Unix time stamp local to the latitude and longitude given.

How Many Times Can One Man Code the Same Thing?

Posted On
Tags
code
daily
tetris attack

I mentioned some days ago my intent to create Tetris Attack clone worthy of its source material for the iPad. This got me to realizing that I've coded this particular game to some varying level to completion five times now, six if you include the yet to be written iPad version.

Six times. And now you'll get the code for a good many of those.

First Attempt

Bask in its shittiness

Source: Download

My first shot for a TAttack clone didn't make it too far. It was little more of a see-if-I-could attempt. Written in Visual Basic and using GDI for graphics, there's not much to see here except how terrible it is.Read More

Racing the Clock for a Code Release

Posted On
Tags
c#
code
daily
javascript

Pushing it a bit close tonight, but that's what happens when you go to a once in a lifetime screening of the extended cut of Two Towers in the theater and it's nearly four hours long. But, whatever.

Makes a very nice screensaver indeed

Download: Source

Some time ago, a coworker passed along a link to this very nifty Colour Clock which displays the time and uses the values of said time to drive the background color. It's really quite pretty and nifty. Back when he linked me, there was the flash version on the site and a download for an OS X screen saver. No Windows love.

So, I fired up my copy of Visual Studio and set about correcting this sadness. I never really polished it to the extent I wanted, which is why I'm putting it up as a source code release. There is a binary in there, but no installer or anything.

Also, before I created this version, I also conjured up a JavaScript one as well, which you can see here.