Jay McGavren's Journal

2010-05-28

Posting this from my new Droid!

Actually it’s my wife’s old Droid! That I inherited after she got a Droid Incredible! But I don’t care! Because the Incredible interface is flaky!

Read more...
2010-05-20

RubyOnAcid version in progress...

Ditched the idea of “tuples” because they complicated the API, and I realized I could do what I want without ‘em. Behold, a LissajousFactory filtered through a RoundingFactory, and feeding into a ProximityFactory:

screen-shot-2010-05-20-at-81348-pm.png

Read more...
2010-05-17

Someone's been there...

you’ve got to be the best

you’ve got to change the world

and use this chance to be heard

your time is now

don’t,

let yourself down

don’t let yourself go

your last chance has arrived

–Muse, “Butterflies and Hurricanes”

I don’t really like the song, but they’ve got another one titled “Thoughts of a Dying Atheist”.

Read more...
2010-04-24

Phoenix IGDA Game Jam - Lava Game

Our in-progress game for Android phones, where you move a character around and dig trenches for lava to flow through. Surprisingly easy work once you have the SDK installed and configured. Works great on both an emulator and the hardware.

We have the character movement and grid of dirt squares going. Artwork is, um, a placeholder. :)

lava_in_progress.png

Read more...
2010-04-18

Ruby tweets!

A while back I stumbled across a page of JAPHs, or Just Another Perl Hacker scripts. This was an ongoing competition Perl users had years ago to print the phrase “Just Another Perl Hacker” in the most convoluted way possible, utilizing little-known tricks of the language. They usually stuffed these mini-scripts into their Usenet signatures. I had always admired JAPHs, and decided to try my hand at a Ruby version. But I needed a forum, and I hadn’t been on Usenet in years.

So what’s the modern version? Why, Twitter, of course! The 140-character limit would provide an extra level of challenge, enough so that I didn’t feel a need restrict myself to printing “Just Another Ruby Hacker”.

I started simple, printing a wave to STDOUT.

ruby -e "i=0;loop{puts ' '*(29*(Math.sin(i)/2+1))+'|'*(29*(Math.cos(i)/2+1)); i+=0.1}" #ruby

Copy-paste that to a terminal, and hit Enter. (If you copy from Twitter, there’s no need to worry about line breaks or the Favorite star; the browser strips them.) You get something like this:

               |||||||||||||||||||||||||||||||||||||||||||
                   ||||||||||||||||||||||||||||||||||||||||||
                       ||||||||||||||||||||||||||||||||||||||||
                          ||||||||||||||||||||||||||||||||||||||
                            ||||||||||||||||||||||||||||||||||
                             ||||||||||||||||||||||||||||||
                             |||||||||||||||||||||||||
                           |||||||||||||||||||||
                        ||||||||||||||||||
                     |||||||||||||||
                 ||||||||||||||
            ||||||||||||||
        |||||||||||||||
     ||||||||||||||||||
  |||||||||||||||||||||
|||||||||||||||||||||||||
||||||||||||||||||||||||||||||
 ||||||||||||||||||||||||||||||||||
   ||||||||||||||||||||||||||||||||||||||
       |||||||||||||||||||||||||||||||||||||||||
          ||||||||||||||||||||||||||||||||||||||||||
               |||||||||||||||||||||||||||||||||||||||||||
                   ||||||||||||||||||||||||||||||||||||||||||
                       ||||||||||||||||||||||||||||||||||||||||
                          |||||||||||||||||||||||||||||||||||||
                            ||||||||||||||||||||||||||||||||||
                             |||||||||||||||||||||||||||||
                             |||||||||||||||||||||||||
                           |||||||||||||||||||||
...

Here’s a more-readable version:

#Have to initialize i before incrementing.
i=0;

#loop{} is a few characters less than 1000.times{}.
#People know where Ctrl-C is on their keyboards. :)
#Brackets cost less characters than do/end.
loop {

  #sin() and cos() range -1 to 1.
  #We change result to range 0 to 1.
  left_width = Math.sin(i) / 2 + 1
  wave_width = Math.cos(i) / 2 + 1

  #Indentation of wave's left side.
  print ' ' * (29*left_width)
  #Wave's width, which decides placement of right side.
  print '|' * (29*wave_width)

  print "n"

  #Increasing input for sin()/cos() makes wave undulate.
  i += 0.1

}

That’s still among my favorites. But anybody can use puts(). The next was more ambitious…

Read more...