Thursday, January 03, 2008

Blogaday 6 of 20

Day Six. Still kicking!

Tonight marks yet another circumstance that makes blogaday such an interesting endeavor. It's 11 PM and I'm entirely awake. I took a large nap today, so I know that I've got at least two good hours in me before I start to get tired. I don't plan on using them, but I'm ready to run at 100 percent for 120 minutes if I really have to.

Tonight's challenge is that I'm entirely capable of writing a good post, but I don't have anything I'm dying to talk about. The last five nights have been very easy from a content perspective. I sat down and stuff started to flow out.

Tonight isn't quite like that. I'm going to roll with it though, and see where it all takes me.

This is one of the reasons that I love blogaday so much though. It's an opportunity to explore myself. Nick always comments on how very stream of consciousness my posts are, and he's right. That's the way that I write posts. It's going to be interesting to see where this post goes tonight. We all know it'll be stream of consciousness, but where will it take me? I usually have some sort of goal that I'm shooting for, some point that I want to get across. Tonight doesn't necessary have a goal, and I find that both frustrating and refreshing.

I worked a lot on that Micron scholarship that I'm applying for today, and that felt pretty good. It was nice to get some work done on it. I really think that I've got a decent shot at it. It's only awarded to two individuals per state; one guy and one girl. It's only for Utah, Idaho, and Virginia too.

But it's cool because it's a technology scholarship, and it's not need based or race based or any other kind of based. It's based on achievement and academics.

And maybe I don't really have as good of a shot at it as I like to think I do. As my Sterling Scholar portfolio will attest to, I don't have much extracurricular activity in the realm of science and mathematics. I'll be going up against every other applying male in the whole state for this baby. Statistically speaking, I'm dead in the water.

I think what I love so much about the scholarship is that I've got a straight shot at it. There's no jimmying around that isn't my fault here. Everything that goes into this application will be entirely my fault. This application has nothing to do with what my dad makes in a year. It's just about me and what I've accomplished, and I really love that.

Part of the application asked about work experience. The only job I've ever really held was those summers ago when I ran mad carpet for Sharpe. I wasn't sure on years or months, so I had to dig back through my journals to figure it out. I love opening my old journals, it's so very invigorating. It's so cool to trace the person I am now to the person that I was then. A lot of important stuff happened those two summers. It was the summer between eighth and ninth grade that I worked the first time. It's so fun to go back and remember what I was doing back then and what was important to me.

That summer, 03-04 I think, I still wanted to be a programmer when I grew up. That was the summer that I really worked hard on snake. For those that don't know the story (there's only like, two that do, and I think they stopped reading a long time ago), I used to program in Visual Basic. Michael hooked me up with the software and some introductory knowledge, and I just played around and made some cool business. He'd suggest little applications for me to build, and I'd try and build them. They were usually little retro games, really easy stuff to pull off.

I'm not sure if it was he or myself, but one of us decided that I should try to do snake. I sat down and whipped up a functioning single-player snake in a day I think. It wasn't a ton of fun to play, but it functioned with all of the game mechanics correctly, so it was a success. I decided after how much fun that was to program that I'd try my hand at multi-player snake. I'd make the arena bigger, and spawn two snakes instead of one. They'd race to get the food wherever it spawned, and any time a bigger snake ran into a smaller snake the bigger one would steal a bite off of the littler guy.

The game mechanics of the multiplayer were kinda cool. It still wasn't a terribly fun game to play, but it was cool to go through the process of trying to balance it all out so it wasn't incredibly boring. Because the bigger snakes could eat the littler ones, once one snake got significantly bigger than the other one the game would never change from that point on. He'd always be big enough to steal from the little guy, so he could just tail him and break the game. To counter that, I had to introduce the idea of decay, whereas if a big snake didn't eat a food unit in x number of seconds, he'd lose one off the back of the tail. The number of seconds that would pass before he'd lose one was determined by how big the snake was. The bigger the snake, the more often he'd have to eat. I had to change it so that instead of dying when a snake ran into a wall, they'd just lose a piece of their tail. So then I had to deal with the original food spawning at random locations, as well as decay pieces that were edible and wall-break pieces that were edible. It got a little complicated, and I never did finish it the way I wanted to because I shot way too high into the sun.

See, around this time my brothers (who are both programmers) were working at a call center together. Work was tedious and incredibly boring, so they decided to program a little game to keep them occupied. They programmed dots, the game where you make a grid of dots and then take turns drawing single lines to make boxes. He who has the most boxes at the end wins. The challenge they had was that they were obviously on separate computers, so the game had to bust out some networking so they could play against each other. It had to be passive enough that when they were actually in a call they could ignore it, but when it was ringing or on dead time, they could open it and play. They also needed it to run undetected, just in case supervisors came by or anything like that, so they made it fairly sneaky. It took quite a bit of troubleshooting, because they had never worked with the winsock protocol before (that's how your make your applications network around in VB) and they were used to C++ instead of VB. In the end they pulled it off, and it was way cool.

So, I saw that, and I also saw that playing multi-player snake on one keyboard was super super tedious. One person would have the arrows as their classic control system, but someone else would have to use WASD, and that got cramped really fast. So I'm thinking, hey, they pulled the networking off, why can't I? So I tried it, and had a lot of preliminary success. I ran into problems later though, problems that would lead to the demise of the whole project.

I figured out how to do TCP/IP connections (the TCP/IP protocol, by the way, just celebrated it's 25th birthday on the 1st of January) through winsock after much trial and agony, and so I was effectively communicating through the network. The problem that I eventually ran into though was that I was sending a ton of messages really really fast. The snakes were moving squares a few times a second, and I was supposed to be sending their location on the board across the wires every single time. TCP/IP is great for sending bytes and all that, but it's a fairly secure deal, so it'll send the message to the receiving party, the party will get it and send a message back saying they got it, and then the original sender will acknowledge that they got the acknowledgment. It happens incredibly fast, but just not that many times a second fast.

There is a protocol that would have done it for me, UDP, but I didn't know how to use it. I kept trying with TCP/IP for a really long time, but got frustrated and quit when the time was right. I tried to start the project again a million times, but never did get back into it.

So why the long story about snake? It was an important era of my life, and it's interesting to look back and think that I really wanted to be a programmer one day. It was cool to see that I was actually working towards my career goals way back in the day. I did invest quite a bit of time into learning it, and I'm happy about that.

I never did graduate from VB. The plan was that I'd learn visual basic first, because it's extremely easy to jump into, and then I'd graduate to C++ and eventually Java. I tried to learn C++ at least twice, but never got past the first week of the "learn C++ in 21 days" book.

I'm not going to be a programmer, but I don't think that any of the time I spent learning C++ or tooling around in VB was wasted. See, programming is so cool because it's extremely mathematic. Everything must follow the rules exactly. There is absolutely no room for any creative interpretation on the part of the computer. You have to be exact, or things don't happen the way you want them to.

The stuff I was doing in VB gave me a lot of trouble with that initially. Because I was dealing with little retro games, I'd start with a box, and that box would generally move depending upon stuff that you did. In VB, a box is only identified by it's name, height, width, and the locations of it's top side and left side. The bottom and right side were never really stored as info. That ended up being way cool, because in order for me to find out when my box would run it's right side into a line I had drawn, I'd have to draw an equation up that says something like

if box1.left + box1.width = line1.x1 then...

With snake and a few of the other things I did, there was a ton of that going on. I had to check and see if the snake1's head's left was the same as snake2's head's left, and then make sure their tops were both lined up, and then I'd say that yeah, one just ate the other. It really wasn't that big of a deal, but it really forced my brain to begin to visualize everything very spatially and algebraically. When I'd go through and debug, I'd look at those lines of code and have to figure out what was going on weeks after I'd initially written the particular line. Box1.left + 135 wasn't just the right side of the box to me, it was literally the box's left x-coordinate plus 135 units. I got pretty smooth at understanding how that baby was running.

And to this day I blame much of my love and understanding of algebra on those days spent messing around in VB. Having to manipulate variables, and then having to use variables to manipulate variables, got that stuck in my head before I ever took an algebra class.

So that's reason one that I love my days programming, because it made me love and appreciate and understand algebra.

The second reason I love and appreciate those days is because of the problem solving skills that it instilled in me. I think that's one of the main draws of programming to me, the fact that you're always (well, not always....) faced with problem solving. Successful programmers are those that are clever problem-solvers.

It was really quite cool, because I'd be faced with an issue, and I'd only have x many tools that I knew how to use, and I'd have to find a way around it. I remember when I first wanted to find out where the bottom of the box really was. I could see it when I ran the application just fine, but there was no way that I knew how to say "When the bottom of the box hits that line, oh boy, do something good!" I remember considering putting an invisible line one box length above the line I was shooting for, so I could just say "When the top of the box hits the invisible line, then do something great!" It wasn't until Michael showed me that I could just solve for the bottom of the box algebraically that I really got it. I'll admit, I didn't think of that one. It was cool to see though, that as time went on, I started needing less and less input from my mentor to solve problems. Problems would loom, and I'd look at my toolbox and then patch seven of them together in order to solve the problem. It was a beautiful thing.

Rahaha, I'm remembering all of this stuff for the first time in years, so excuse me while I go giddy over it.

I remember when I was working on snake, trying to get around the fact that the TCP/IP thing was holding me up. I had been sending the location of the snake across the wires every single "turn", or time the snake moved. So, a fifth of a second would go by, and one app would say to the other app, "Hey, snake 1's top is at 0," and another would say, "and snake 1's left is at 100. Have a great day." The other app would respond in kind. I'd grab those messages and then the app would say "Alright, put snake 1's top at 0 and snake 1's left at 100. I am having a great day." And that made a lot of sense to me. Both app's needed to know where the snakes were, so I was telling them. It was basic, and it worked aside from the time constraint.

But once the time constraint kicked in, I realized that I needed to find a way to send fewer messages that told the same story. I thought about it a lot, and realized that I could actually send one message, just a big old number, and then have the receiving app decode it to make sense. I'd take all the info and put it into a number in a certain order. I'd take the top, we'll say it was 100, and the left, we'll say it was 300, and make a number like 100300, which is just the two values put right next to each other, and send that instead. The app would get that number in the mail and divide it by 1000. It'd take the answer and from there know that 100.3 meant that the top was at 100. I'd then do a mod division to deal with the 300, and figure out the left was at 300. It was brilliant, and I effectively cut my message sending in half.

I was really proud of that, but it still didn't solve the problem. I kept thinking about it, and I figured out later that instead of always sending the exact coordinates to the other guy, I could figure out both of their starting positions and just say what direction they're traveling in. That was a pretty big breakthrough, and I was way proud of it. I'd just assign a direction a number value. 1 was up, 2 was right, 3 was down, and 4 was left. Any time it changed a message would be sent across, and the app would send it in the right direction.

That solution still didn't do the trick, but it was cool because it was a completely separate and foundationally different solution to my previous attempt. Before I had been using math to simplify a complex message set, and now I was using logic to simplify a complex necessity and make it a much simpler problem to tackle.

For having nothing to talk about, this post is extremely long.

The moral of my story? Programming helped me be a better person. I'm more able to solve problems, and my spatial reasoning is much sharper than it would be had I not done it. I am extremely glad that I did it. Even though I never plan on becoming a programmer, I know that the time I spent programming will help me in my schooling and in my professional career. The things I did back in junior high are still having a big effect on how I'm doing right now.

And I think that's really the thought I've been hitting against most of this evening. Every time I'm asked to make a list of clubs I've participated in or anything like that, I'm always reminded of how diverse and rich it's all been. I really have had a lot of opportunities to gain skills through this public education system. Nerd team, journalism, engineering (*cough* slave labor *cough*), cross country, jazz band, choir stuff, seminary council, PLC, carpet work, etc. etc. It's interesting to note how very much "all over the place" I've been. I ran for four years, but I'm not doing it this year. Nerd team would have made me an amazing FBLA kid, but I never transitioned into it. I worked on the trombone for a lot of years, but am no longer doing it. I did journalism is junior high, but not in high school. I sing now, who saw that coming?

One could accuse me of being a quitter, or perhaps a flip-flopper. But I don't see it like that. I love the fact that I've learned so much from each of these activities. I think that I take a lot away from them, still. I wonder if I'd stayed with stage crew in high school, how things would be now. Would I have taken even more from it? Yeah, probably.

But I think that's my style, my approach. Get skills all over the place instead of being profoundly good at one thing. Yeah, it does mean that I'm not profoundly good at "one thing", but maybe I can solve problems that require more than "one thing." I think it's a bit like the snake thing. There are problems that are going to come up, and there are going to be a lot of ways to get around them. I have a toolbox here that allows me to bust out any number of skills and traits I've picked up over the years and apply them. The best part is that I'm able to tape skills to other skills in the event that I need to.

Maybe it's that I've been working on that application today, and maybe I'm just trying to sell myself as a good investment for Micron. I kind of feel like I'm making my own sales pitch, not gonna lie. But you know, it's been good to write about it. It's blogaday, I'm allowed to go a little tangential, aren't I? But maybe that's something that I could do, just go through and talk about each one of those activities I used to do and what I learned and what it meant to me. I always thought I could write a book about nerd team. I just wrote a novella about programming, why not?

So maybe you'll see some of that in some future days. We've got a ton left, we'll see what comes up.

Moral of the story? I've been picking things up for a really long time. The things I've picked up in the past are helping me out right this very minute.

More importantly though, this teaches me that I need to be picking things up today. If what I did back then was so important, what I'm doing today is going to be incredibly important tomorrow. I need to get out there and stretch myself, like I've done in the past. I think that I've been able to do a little bit of that with mads this year and council and some various other stuff.

Oh how I love self-improvement. I know I'm not that great at it, but I can't help but feel happy when I work on it.

Ladies and gentlemen, this has been blogaday day six. Thanks for reading. I hope things are well for you all. If there's anything I can do, let me know. I do appreciate you all, for the people that you are. While I'm not positive I'm aware of all the people who read my blog, I've got a pretty idea of who's out there. You guys are cool, and I appreciate you. Keep up the good work.

3 comments:

Nathan said...

Was this the same Snake that was available for download from Minimac around that time? If so, I actually played it and found it entertaining. Small world, eh?

And "tangential" is a freakin' awesome word. I will start using it.

Anonymous said...

Wow, your posts are amazing!

Jaron Frost said...

0_o...

I think I once drew a turtle in visual basic, in like second grade. I was simply following directions and had no idea what I was doing, but still.

That snake game actually sounds really fun... haha. It's like... Supersnake. Sometimes I like the simple little games, but other times, the far-left-brained geek in me comes out and I have to sit down and play something incredibly complex and orderly like Final Fantasy Tactics. Oh, sweet statistics! You have an allotted number of squares you can move in one turn, and then you can perform one action, each with a set area of effect that takes elevation into account... and you have a certain jump number, and for every square over you try to jump, it takes a certain percentage from your base jump stat, so in order to jump across one square (say you're jumping across a river) you'd need to have a jump score of x... I don't know the actual stats but it was that sort of thing. So dang organized. It was awesome. Every battle took like half an hour.