Category Archives: Programming

Too many languages…

Well, I completely fell apart on that promise… Oh well. Just a quick recap: I graduated, but only one of my degrees has so far been approved (Physics, my secondary degree), so I’ll have a fun meeting later this week in East Lansing to sort that out. Why will I be in East Lansing? I’ll be swinging through on my way down to South Bend to begin my trek for a PhD at Notre Dame. I’ve also spent my few weeks off doing nothing and something at the same time: pounding through episodes of Doctor Who, preparing to move, playing disc golf, and programming.

Yep, programming. I haven’t forgot about you yet! A month ago, I knew the following languages: Python, C/C++, Fortran, and shell scripting (if it’s kosher to include that last one), in roughly that order of fluency. But hey, you can never have enough languages, right? Plus, I might as well start programming for a purpose and not just for fun (although I’m still going to program for fun, of course!). With that in mind, I’m venturing out into a few new fields.

HTML5/CSS3
While technically I have already learned some HTML and CSS, it was never really in a structured manner. I just looked at source code from websites I liked and tried to piece it all together. In general, it worked for what I needed, but it doesn’t hold a candle to what’s out there. So, I’m going to actually sit down and learn the new standard, update my website (but at my fancy, new ND webspace!), and officially add it to my list.

ObjectiveC with Cocoa
For all you Mac-philes out there, this is the language for applications on your lovely Macbook Pro, as well as on the various iDevices that Apple sells. This is the language I’ve worked with the most so far, mostly because I figured that my knowledge of C/C++ would help out on the coding side of things. Plus, making my own applications has been in the back of my mind for a while…

Java
Again, another useful language, only this time for Android devices. Right now, I’m still deciding between what phone to get once I leave AT&T, and since Verizon has both the iPhone and various Droids, I might as well learn both. Plus, since I’m pretty equal opportunity myself, I’d probably write an app in both languages and release it simultaneously for when I get to that point. And hey, another language is another language, especially when I can use this for other things as well. I haven’t even started working with this one yet, though, since the download of the Android SDK took longer than I would’ve liked, plus I’m doing other things with my time too…

Aside from that, I’m still writing a lot of Python (I got bored the other day and started writing a UNIX-like shell in python), since for me it’s the most fun. Plus, the only “learning” I have to do for it is looking up different function calls that I can use for the various modules; I get to focus more on the coding than anything else! Of course, in two weeks, I’ll be starting my summer course down at ND, so programming will again slow down for a bit, but I would mind, given what I’ll be working on!

EDIT | After reading a few articles and posts online, I’ve decided to refocus on just a few of my languages for now. I’ve decided that my first “real” phone will be a droid, but I’m not really keen to start programming for it until I see what’s out there. I’m still slowing going through the ObjC+Cocoa book, but I’m guessing that at the end of it I will be left with very little direction and only a cursory understanding of the language. Not good when a two-month hiatus is upon me. So, I’ve decided to get really fluent in Python and C; the Python portion will just be trying to learn those little things that I never encountered (like generators when discussing the Collatz conjecture HERE and HERE) or simply just different things to do with the language (like Google webapps…). Anyway, hopefully this will help save my brain while I relearn all of undergrad physics in two months!

Grad School Visits

This past week for Spring Break, I spent time with my family and visited the two grad schools I have currently been accepted to: the University of Notre Dame and the University of Connecticut, Storrs. While I’m still waiting to hear back from one school and a job opportunity, both of them were relative long shots, so it looks like my summer and fall (and the next five or so years…) has boiled down to a binary choice: ND or UConn?


This was the first school I visited, and man did things go well! Ms. Shari Herman, the “Second Mom” to everyone pursuing a physics Ph.D. at ND, took out all of the stops in setting up a stellar visit for me. I drove down Monday afternoon, right after picking my little brother up from school and visiting with my high school physics teacher, and it went fine. No traffic, I had money for the tolls, and I found my way to the hotel (the Morris Inn, right on ND’s campus) relatively fine. Once I checked in, I hung out in my hotel room, watching TV and lamenting the fact that I could not yet play Pokémon Black.

I woke up the next morning, showered, ate breakfast, and read through the packet of material that Ms. Herman had given me, then checked out and waited for the actual visit to start. I met one of the roughly 90 grad students, and we took a quick tour around campus before my meeting with the first professor on my schedule. Since this was my first time ever visiting ND, it was great to walk around and see the campus, especially with the student body still there since they weren’t on spring break. We eventually made our way over to Nieuwland Science Hall, home of the department and where I would be spending the next nine hours or so.

For the rest of the day, I went from visiting one professor to the next, sitting down and talking for half an hour about the research they were doing, different things going on around campus, how they got involved with ND and physics, and a bunch of other things. I also got a tour of the nuclear physics accelerator lab, got to sit in on a cosmology seminar (with a free lunch!), and got a glimpse of what I’d be doing my first year of school in the form of the grad TA first year lounge (alongside the end of my career with a few fourth- and fifth-years). All in all, a very full day that got added to twice while I was still there!

To end it, I went out to dinner with two other grad students to Legends, a local bar/restaurant establishment just off campus, all on the physics department’s tab. The food was great, and I didn’t really have to stop on the way back for any more food (huge surprise, but I did have a detour right at the beginning of my return journey…), and I had a good time just hanging out away from the more structured environment I had been in for much of the day. All in all, I had a great time, met some amazing people, and really enjoyed myself while I was there. I got back home around midnight, played some Pokémon Black, then went to sleep.


The next and final trip (so far…) was out to Connecticut to visit the department at UConn. I flew out from Detroit early Friday morning after delays on the runway from some of the freshly fallen snow from the night before. Once we took off, though, the flight was fine, the landing smooth, and the pick-up of the rental car (a relatively new Jeep Compass!) went perfectly. But I was still a little late due to that delay, so I showed up to the offices slightly out of breath from sprinting up the flights of stairs to the top of the building. Thankfully, Prof. Dunne (the person who had set up this visitation) didn’t seem to mind, and we talked before meeting a few grad students and heading out to lunch. Since UConn was on spring break, we didn’t really run into any students at all, but the campus was flooded with middle- and high-school students for some convention, so we still had to contend with a mass of hormone-infused saplings as we ate our meal.

Once the last of my meatball sub was firmly in my stomach, we took a quick tour around campus, which was beautiful! It reminded me a lot of State, since it was a little more open, a little disjointed, roads crossed through and around the buildings, and a couple places were under construction, so I felt right at home! While the campus was much quieter during this tour than ND had been, that was good since I could just focus on the buildings and the scenery and not look at the the students walking past.

We returned to the physics building, and I sat with a half-dozen professors to talk about their research to see how it would fit with my interests, just like at ND. Once that was over, I met again with Prof. Dunne to finalize a few things, then I was off to return the rental car to the airport and spend time with my relatives. I won’t go into that since this is about my grad school visits, but just know that I had a blast, and that it more than made up for missing last summer’s reunion.

From today, I have thirty days to wait for the last few pieces of information and make a decision, although I’m sure that I will be making a decision earlier than that. Unfortunately, ND lost to Louisville during the Big East tourney, so I couldn’t use the outcome of the ND-UConn championship game to make the decision for me!

Game Redux

Remember when I said that I was creating a video game in my spare time? Well, if eight months of inactivity has told you anything, that hasn’t exactly gone to plan for a number of reasons, some of which are programming related (see my last post).

I am happy to say that I’ve gotten back into writing a video game, although as usual the story is completely different, as is my approach to writing the game. Instead of working on visual mechanics like smooth scrolling of the screen and animation of the character sprite, I’m worrying about inventory interaction and item alterations, all of which are done through a network of interconnected modules and classes. It’s a much cleaner approach, plus it’s much easier to test sets of class methods when that’s all I’m working with.

I’m taking a very micro-to-macro approach too, starting with single items, moving onto inventory, moving onto a character shell (which will eventually be greatly inflated, but no need to worry about that now!). Yes, a few important things are missing from the small set of code I have written (items having a special effect on the character or other items, for example), but much of that will flow once I figure out how I want the game to progress. Check out the two (partial) modules I have now:

# Superclass for all in-Game Items
class Item(object):
  def __init__(self, name, amount=1):
    self.name = name
    self.amount = amount

  def adjust_amount(self, amount):
    self.amount += amount

# Subclass to handle key items
class KeyItem(Item):
  def adjust_amount(self, amount):
    pass

# Class to store Items for Player within Game
class Inventory(object):
  def __init__(self):
    self.inventory = []

  def add_item(self, item):
    self.inventory.append(item)

  def remove_item(self, item):
    self.inventory.remove(item)

  def adjust_item(self, item, amount):
    changing_item = self.inventory[self.inventory.index(item)]
    changing_item.adjust_amount(amount)
    if changing_item.amount == 0:
      self.remove_item(item)

  def order_inventory(self, item, new_position):
    temp = self.inventory[self.inventory.index(item)]
    self.remove_item(item)
    self.inventory.insert(new_position, temp)
# Creates Player class to be controlled by user
class Player(object):
  def __init__(self, name, inventory):
    self.name = name
    self.money = 500
    self.inventory = inventory

  def adjust_money(self, amount):
    self.money += amount

  # Controls inventory object changes
  def adjust_inventory(self, item, amount=1):
    if item in self.inventory.inventory:
      pass
    else:
      self.inventory.add_item(item)
    self.inventory.adjust_item(item, amount)

  def change_inventory(self, item, new_position):
    self.inventory.order_inventory(item, new_position)

Pretty simple, and only 40 lines when you ignore whitespace and comments, but the fact that everything works the way I want it to right now is a big deal. I could throw in a few other necessary variables and function calls right now, but I do have my first exam of the semester in… six hours… so I’ll just leave this here for now.

In bashnews, I fixed a problem with grep where no matter what I did, grep just didn’t work. It ended up being some extraneous commands in my .bash_profile that I must have put in while adding aliases and setting the color scheme for ls -G, since the commands came right after those lines. Now it works, and I’m back to being a happy camper!