A new wind blows…

Well I promised I’d have my personal blog up soon and it has been longer than I intended but tonight I get a functional website up. Please let me be the first to welcome you to…

http://www.pro-graham.com (Okay, it might redirect here. Go go gadget DNS Server redirect!)

From here I plan to post snippets of code and programming related articles hoping to help people who have found comfort in the same field I currently occupy. My first post should be up this week detailing my advanced AI Battleship application you can play. The application was an extension of an old project I took up with a friend years ago. I recently updated the AI in it for one of my more recent classes as an example of heuristic analysis of grids allowing for advanced play.

Please bare with me as I get my documentation up to snuff and clean the code so I don’t embarass myself too much.

Small Bites & an Announcement!

Things are starting to wind down for me. I’ve been extremely active with my studies and things are coming to a close. Because of this I’ve been absent from the blog and think I want to start contributing something more than just rants and ramblings. From time to time I plan on making a post relevant to a community I participate in and today I’ll make a post to address an issue I’ve been seeing frequently on http://www.reddit.com/r/starcraft2_class

Starcraft2_class is a small subreddit on the site with about 1,400 readers. Its single purpose is for more experienced and skilled players to coach and advise more novice players on the game. As a fairly seasoned player myself I find that I like to spend time coaching others and providing advice on how they can improve their game.

So, what is the topic? Well from the title I’m sure you can guess: Biting off more than you can chew. What I mean to address is an issue in novice players that I’m seeing very frequently that they most often aren’t aware of. The issue stems from players dreaming of reaching the high stars but forget that the path to obtain greatness is one small baby step at a time.

These players watch Day[9] like a religion and have subscribed to every professional tournament streamed online to date. They often follow Idra, Psy, Jinro or Destiny like a cult but all still share the fundamental problem of dreaming too big for what they can obtain (at least at this time).

These players recognize what needs to be done. And that’s the fundamental issue. I don’t want to go too far and say they know too much but it almost comes across as that. They realize the importance of creep spread, saturating bases, maintaining map control scouting your opponent’s movements, teching at a right pace and managing their economy properly but they simply can’t do it all.

They spend a solid phase of their game working their army positioning all the while forgetting entirely to scout the map or expand their vision. They’ll vigorously watch for the larva pop only to neglect the overlord buzzing through the opponent base and once it dies see nothing but partial structures.

And how does one solve this? One step at a time.

It is awesome that players realize everything that needs to be done but it means nothing when you do all of them poorly. If you’re so concerned with your creep spread that you forget to inject larva or research +1 weapons for your roaches you’ve still lost no matter how nice that spread gets.

If you’re a player you feel is guilty of this issue then its better for you to get out there and play some games rather than watch more pro replays. You can keep ramming all the knowledge you want into your head but it will not solve the issue that you don’t have the muscle memory or mechanics to execute it.

I want to stress the importance of practice in this game. More players I see are getting concerned with their rating and it is off setting to them. They abstain from the game to watch professional players and get advice from Mr. Plott but neglect to execute it themselves. I fear it is a mental issue where they believe they’ll get better without actually playing and can return to a shiny Platinum or Diamond rating and once they fail to achieve this are unsettled even further.

So yes, the answer is as cheesy as the 6 pool but the solution is to go play some games. Focus on one thing at a time and don’t get worked up over small details. Broad Strokes (like Day[9] says) are more important than minute details.

But Stank, what’s the announcement?

This is actually unrelated but something I’m quite proud of. I started this post by saying my studies are winding down. What that means is I’ll be entering the workforce ripe with knowledge and ready to get put in my place. I feel however that I have lots to share in the Programming community and have registered a domain to contain these factoids. So, in the future look towards http://www.pro-graham.com for programming blogging, advice, tips and stories. My first post will be regarding a small game AI I wrote for a class this semester. I stand by my work in saying I’ve written the most advanced Battleship AI to date. Such a minor achievement but fun never-the-less.

A new frontier…

I’ve been tasked through one of my classes with designing and implementing an application that relies on a P2P protocol. I’ve done work programming a server for BitTorrent in previous assignments but I’m looking for a little public insight on this as to what I should do.

  • Is there something that people are looking for that they need coded?
  • Is there features in an application that you want but haven’t been able to find yet?
  • Is there a server feature that you wish would just come out already?

Let me know folks. I’m looking for some great ideas for something that I’m really looking forward to doing. Remember, this isn’t limited to BitTorrent’s protocol as P2P encompasses a wide range of applications and features. Shoot and I’ll see what ideas I like most.

That’s Halo, don’t worry

My mind is fried. Seriously. It is so far up my own ass at this moment that I think I need to step back and discuss something a little more light hearted than coding. Surely if you follow SC2 pro gaming in the least you heard about Huk doing an extraordinary rush against Select at MLG in Washington D.C. (I’ll apologise for the video’s voice-over. I linked the video with my sound off). I mean, it sort of is the latest little meme surrounding the scene right now. What you may not be familiar with is how it is being perceived by the fans and other players. I personally want to touch on what Idra has said in response, “It was absolutely idiotic.” And I agree with him.

I mean, Idra is sort of infamous already for his “trollish” attitude towards other players and we’ve all come to terms with it by now. But this comment of his sparked a minor debate between me and other individuals over at Reddit. So why do I agree with him?

Gimmicky/flashy play is not interesting to watch in a competitive environment. It certainly has its place but Huk essentially threw the game with that tech build. Why is it entertaining to observe someone, in all intents and purposes, give up? Sure, there was an off chance that the Mothership pulled through and swung the game in his favour but what were the chances? Incredibly low if you can assume that Select wasn’t going to do something equally stupid.

I equate the scenario to a professional sports team marching onto the field and doing a dance while one player attempts to sneak the puck/ball behind the other team’s defence. Sure, if you manage to completely stun the opponent the strategy might work, but there’s a very slim chance of that occurring.

His choice to go so far off the groomed path didn’t provide any form of innovation to the competitive scene. People speak of the event now as if it was revolutionary; something that changed the way professionals will view the match-up in games to come. Will it? Fuck no! This will be a softly spoken event in a month’s time only being revisited for a short period when they match up against each other again later.

Like I said previously, I took part in a debate on Reddit regarding this topic and seemed to be on the minority. What do you think?

As promised…

Now on my introduction I promised I’d be posting code samples of my work through school to help out students and I’m here to deliver. I’ve done a few things but this one I’m actually sort of proud of. Hardcore coders can find little issues with it (such as error correction) but it works very well. The code posted below is a custom script that you can use (almost) to replace bash on a linux system. I’ve dubbed it GShell and it should be able to handle almost all commands save the “cd” command. It currently doesn’t have any form of memory but we’ll be adding that in a future release.

What I really want to highlight here is the use of the pipe() function which allows us to pipe output from child processes to the parent in/out streams. I fought this one for a good while before correcting my error to get a working release. Take a look and let me know what you think.

#include //strcmp(), strtok(), strlen()
#include //fork(), execvp(), pipe(), dup2()
#include //wait()
const int MAX_SIZE = 255; //Maximum Size of call string currently allowed
const int MAX_ARGS = 8; //We allow up to 8 arguements
void main(int argc, char* argv[])
//Loop infinitely
char input_buffer[MAX_SIZE]; //Buffer for user input to our command line
char *args[MAX_ARGS+1]; //The arguments we pass to the new program. Allow 1 array for NULL
char *command; //String pointing to input buffer section holding command to execute
char *user_input; //String to hold input
int arg_count = 0; //Number of args provided
int ampersand = 0; //Is there an ampersand?
int c_status,status; //Status values for forking
printf("GShell$ "); //Basic output
fflush(stdout); //Flush out output
//Read from input
fgets(input_buffer,MAX_SIZE,stdin); //Get input from stdin up to MAX_SIZE bytes and place in input_buffer
if (feof(stdin)) {
printf("Quitting... Goodbye\n");
//fgets grabs \n as well. We need to remove it and place NULL in there
if (input_buffer[0] != '\n') { //Simply repeat if we receive a blank input
user_input = input_buffer;
user_input[strlen(user_input)-1] = '\0'; //Terminate with a null
//We need to tokenize the input now to retrieve multiple arguments
//First grab the command name
char* token;
token = strtok(user_input," ");
//Quit when command is received
if ((strcmp(token,"exit") == 0) || (strcmp(token,"quit") == 0) || (strcmp(token,"logout") == 0)) {
printf("\nQuitting... Goodbye\n");
else { //This creates a token
command = token;
args[arg_count] = token;
while (arg_count < MAX_ARGS) { //Repeat until we have max arguments or until quit with "break" token = strtok(NULL," "); //Continues to tokenize // //If there isn't any further tokens if (token == NULL || arg_count == MAX_ARGS+1) { args[arg_count] = NULL; break; } else if (strcmp(token,"&") == 0) { ampersand = 1; //Advise that we've detected the ampersand } else { args[arg_count] = token; arg_count++; } } // // We're done tokenizing the input. Time to get to the interesting stuff //Create pipe to fetch our outputs from process int pipeval[2], err; // if (pipe(pipeval) == -1) { perror("pipe error"); exit(1); } char* val[1024]; //First attempt a fork c_status = fork(); // if (c_status > 0) {
if (ampersand == 0) {
else if (c_status == 0) {
//Child process
else {
printf("Fork Error.\n");

In the rear with the gear

We’re operational?

That’s good I suppose. Big thanks to Shuba for setting up the Blog, hope to fill it with revolutionary ideas in the time to come.

I really like this and will try provide content updates on my software projects, gaming ideas as well as some art I can provide. To start things off I’ll simply state that I’m in the home stretch of my Bachelors of Applied Science and Engineering, a.k.a. Software Systems Engineering. I should be done by spring next year and tuned for a life of code and development. In the mean time I’ll post code snippets regarding my assignments and links to stuff I have done to help out current/future students. On top of that I’m an avid Paintball player and casual gamer playing Starcraft 2, Minecraft, Fallout 3 and numerous other games at the moment. I play for my universities CSL team for SC2 but we’ve yet to play a game 🙂

Oh, almost forgot, here’s a small in-browser, java based Battleship game that I constructed with a partner in a software class last year. It’s hosted on her website. Hope you enjoy.

-Capn out