The Christmas Spirit
This Christmas was unique for me for a few reasons.
1.) This was my first Christmas as a married man. Jenny and I got married in August, and life together has been wonderful. The Christmas season was tough because of her work schedule (she sells Lladro statues in one of the local malls), but I had plenty of time off after the holiday to spend with her, and she had time off because there's never quite as much returning after the holiday as there is purchasing before it.
2.) This was my first (and last) Christmas in San José. Coming from northern and central Illinois, it just doesn't feel like Christmas unless it's cold and there's a chance of snow. I love snow, and I love cold weather. It's no wonder that the bay area is not my favorite place to live.
3.) My mother, the woman who, along with my father raised me and helped make me the man I am today, nearly drove me to tears two days after Christmas. Apparently I didn't spend enough money on her. It would seem that Christmas really isn't about putting thought into gifts after all. It's about making sure you love everybody exactly the same by spending the same amount of money on them. Never mind that I spent four times as much of my time finding gifts for my mother that I thought she would like while everybody else was finished quickly. Hell, I didn't even buy a gift for my brother. Jenny found something he'd like and picked it up in my stead. I guess next year, I'll just send gift cards with unifrom values (I hope everybody likes Best Buy as much as I do). Then nobody will feel offended that I care enough about them to send gifts.
Programming, etc.
If you like scripting, you really owe it to yourself to check out Python. The forced indentation threw me off a bit at first, but if you tend to indent anyways it's not a big deal. So far I've written three classes (stack, queue, and binary search tree), the same three I always start with because they're handy to have lying around, and they're simple enough to implement that I can concentrate on learning the language instead of wrestling with a complex concept. Since then, I've written a Sudoku verification script, which I gladly share with you all, in its entirety.
"""
Programmer: Justin Last
Language: Python
Purpose: Verify Sudoku solution (9 x 9 variety)
Command Line Usage:
python sudoku_verify.py
python sudoku_verify.py <file name>
Interactive Environment Usage:
import sudoku_verify
sudoku_verify.main()
sudoku_verify.main(['sudoku_verify.py', '<file name>'])
File format 1:
826935147
419627583
735418926
678459231
541263798
293781654
367852419
154396872
982174365
File format 2:
826935147419627583735418926678459231541263798293781654367852419154396872982174365
NOTE: both of the above files represent the same (valid) Sudoku puzzle
"""
import sys
def main(argv = None):
# This allows us to use this script interactively.
# Use sys.argv if called from the command line.
# Otherwise use the interactively passed params
if argv == None:
argv = sys.argv
if len(argv) == 2:
infile = argv[1]
else:
infile = raw_input("Input a file name: ")
# Open, read, and close the file
try:
f = open(infile, 'r')
try:
raw_data = f.read()
except IOError:
print "Error reading file...\nexiting program"
return 2
except IOError:
print "Invalid file name...\nexiting program"
return 1
f.close()
# Strip out anything that isn't 1, 2, 3, 4, 5, 6, 7, 8, 9
processed_data = []
for el in raw_data:
if isNumber(el):
processed_data.append(int(el))
TRIPS = [[0, 1, 2], [3, 4, 5], [6, 7, 8]]
# Construct the rows, columns, and triplets to be tested
rows = [[processed_data[x + y] for x in range(9)] for y in range(0, 81, 9)]
columns = [[rows[x][y] for x in range(9)] for y in range(9)]
triplets = [[rows[x][y] for x in TRIPS[a] for y in TRIPS[b]] for a in range(3) for b in range(3)]
valid = True
for check in [rows, columns, triplets]:
for array in check:
array.sort()
# All valid arrays now hold [1, 2, 3, 4, 5, 6, 7, 8, 9]
if array != [1, 2, 3, 4, 5, 6, 7, 8, 9]:
valid = False
# Create and print the output message
msg = ''
if valid == False:
msg = 'in'
msg += 'valid Sudoku solution'
print msg
return 0
def isNumber(num):
if type(num) == int and num < 10 and num > 0:
return True
elif num == '1' or num == '2' or num == '3' or num == '4' or num == '5':
return True
elif num == '6' or num == '7' or num == '8' or num == '9':
return True
return False
if __name__ == '__main__':
sys.exit(main())
I also downloaded the Popcap games framework. If you don't immediately recognize the name, Popcap are the folks that made Bejeweled, Zuma, and my current favorite, Heavy Weapon. I've coded up a small game of my own using their framework called Lights Out! Trying to make a game of my own really makes me appreciate just how much work goes into these things. Now when I play Prince of Persia: Warrior Within (my current video game obsession), not only am I having a great time, but I have an awesome amount of respect for all of the people that worked on it. The man-hours that go into a project of that magnitude must be astounding.
For those that are interested, some of my programming (including the Lights Out! game) is available on my website. Feel free to use the scripts however you want. I write them to learn, and if you can make use of them, all the better.
New Job!!
For quite some time now I've been trying to transfer away from the land where everything is overpriced to some place that is hopefully a little more sane. Well, it worked. I got a job offer today. I'll be something called a Satellite Systems Engineer. I'm a little scared, as this is the first job I've ever gotten on my own (my uncle passed my name along to my current boss), but I like my new boss, and the description sounds like something that's right up my alley. Also, my salary won't change, but the change of venue means I'll be bringing home around 35% more money every week (if the statistics I found aren't incorrect), and we'll be saving money in rent to boot!
New Year's Eve Resolution
I only made one resolution this year. I'm going to floss my teeth regularly. I've only got two cavities (or is it three?), and I'd like to keep it that way.