Wednesday, September 8, 2010

C/C++

For today's topic I figured I could teach a little C/C++.

If you already know the language, then this will seem very boring. This is designed for those who know nothing about C/C++.

To begin, C++ is just an extension of C that adds functionality. So to learn C++ you need to learn C first. In both, everything is case-sensitive which means that something named "ABC" is not the same as "abc" or "AbC". All are unique names.

In C, each command is followed by a semi-colon " ; " signifying the end of the command, and extra spaces, tabs, and line breaks (collectively called "white space") are ignored. So, you could put multiple commands on the same line if you wanted.

I.E. the line:
a=3;b=1;c=a+b;
is the same as:
a=3;
b=1;
c=a+b;

But, for simplicity and to make it easier to debug (find and remove problems) you'll want each command on a separate line. You can also create segments of the code that the compiler (what turns the code into a program) will ignore by using a double backslash " // " (which will ignore everything after it on the same line) or by using backslash-star " /* " to start and star-backslash " */ " (which can span multiple lines) to end. These are called comments because they are commonly used for explaining what your code will do in a section.

So we could have written the above code like this:
a=3; //This part is ignored
b=1; /* and so
is this */

c=a+b;

In C, code can be separated into sections called blocks by using the curly brackets " { " and " } " to open and close a block respectively, and each command that you create (function) will need to have a block of code directly following it's name. So, lets create a function shall we:

int Add(int a, int b) //int is a variable type I will talk about in a second
{
  return a+b; /* "return" causes the function to exit with the value that follows it (must be the same type the function is defined as) */
}

Now, I introduced several new things in this so lets review them. First, a function is created by first calling the type of variable the function will "return" followed by its name and a set of "parameters" inside of a set of parenthesis " ( ) ". When you call this function later you simply use the name you provided and fill in the parameters you want (I.E. you could call "Add(1,2);" and it would return "3".

Variables are the places where you store data. When you create a variable you define its type followed by it's name. In our example above we created two variables in the function declaration: int a and int b

int is a variable type that holds a single number (if your on a 64 bit system its range is from –2,147,483,648 to 2,147,483,647). int by default is signed meaning its first bit tells whether it is positive or negative but this reduces its maximum value by about half. If you wanted it to not contain this sign bit, you could call it as unsigned int.

The unsigned keyword changes a variable that is default "signed" to be unsigned. the signed keyword does the opposite.

Other data types are:
void - holds no data at all. (used later)
bool - holds a single bit. (true or false)
char - holds a unsigned number 1 byte long. (0 - 255)
short - holds a signed number half the size of int
long - holds a signed number twice the size of int
float - holds a signed floating decimal point number (1 of 2 only default types that can contain a decimal)
double - holds a signed floating decimal point number twice the size of float (also called double precision)

in C those are the basic types. You may have noticed that they all only contain numbers. "Well how do you store text?" you might ask. The char type can contain a single letter as well by placing single quotes around it. Such as 'a' would contain the number corresponding to "a" (or 61) in ASCII. To store more than one letter you need an "Array" which I'm not going to talk about this time. (next C lesson maybe)

That's enough basics for now. I'll continue with more later.

Until next time. Have fun.

Edit: I forgot the double var type.
Edit2: I forgot the bool and void types as well.

Monday, September 6, 2010

Prayer Vs Work

In my youth I was promised that as long as I was a good person, God would help me when I needed him. But, I always asked, "Where was God when my mother had lost both of her kidneys? Where was God when my father couldn't find any work? Where was God when my mother died?" and, yes, my family was religious and all prayed for help.

Now some of you christfags will say "It was God's plan" but that doesn't mean anything when you also say that if you pray, God will help you. If God just follows his plan, then what is the point of prayer. Because, if you pray, and you believe, God says he will help you. But, if it was part of God's plan, then he wont help even if you pray.

Therefor, even to christfags, prayer does nothing.

Or let me ask another question:
Can God create a rock so heavy not even he can lift it?

If you answered yes, then you just said God can't lift that rock, and is therefor not omnipotent.
If you answered no, then you just said God can't create that rock, and is therefor not omnipotent.

And, if God is not omnipotent then he is not God.

Saturday, September 4, 2010

Another Day ...

and nothing new to report on so how about random wallpapers.

Friday, September 3, 2010

Duke Nukem Forever

Wow! Duke Nukem Forever, for those not in the know, has been long, long, long, long awaited ever since Duke Nukem 3D that came out on the N64. And now, thanks to Gearbox (the makers of Borderlands), there is a playable demo at PAX and it will be coming out in 2011.

Wednesday, September 1, 2010

Oh Noes It's Teh Furriez

Today I figured I would link some of my favorite places to visit (and usually do so once a day)

(WARNING: some of these are not work safe)
Do Not Click any Red links unless you are 18 or over.

First we have Web Comics:
GUComics - started as an Everquest only comic, he now makes fun of all games and gaming news
WTFComics - a long standing comic following the adventures of a few characters in Everquest.
Housepets! - funny furry comic following a few anthropomorphic house pets.
Original Life - Jay Naylor's newest comic. (not everything on site is work safe)
House of LSD - (Not Work Safe) 3 girls start up a porn company.

I also have a few other things I regularly view:
Knotcast - Furry relationship podcast (Not Work Safe)
Fur Affinity - (mostly work safe until you have an account and tell it to show adult content) a place for furs to share art mostly.

Tuesday, August 31, 2010

Metroid: Other M

Now that the game is finally out I wanted to offer my review of the game.

To start with, on the positive side:
  • The graphics were some of the best on the Wii with only a few glitches that I have found.
  • Game-play was fun and fast paced which is a nice change from the slower prime series
  • Cut scenes were excellent and merged with the game nicely.
  • Controls, while sometimes a little clunky, worked pretty well most of the time.
And on the negative side:
  • The game was too short for me. only took me 3 days to beat it while playing a few hours a day. (total about 4hrs)
  • Storyline, while good, made Samas seem like a wimp
  • A few (around 4-5) times after some cut scenes you were forced to look around for one tiny item on the screen with no indication of what it might be. The bad part of this is that you have to hover your cursor over the item your looking for for a few seconds before the game gives you a hint that your looking at the right item.
overall I give it a 4/5

edit: forgot one negative and one positive about the game heh

Pathfinder




Today I got my path finding functions finished. It can find a path through any 2D obstacle course, and rather quickly too. usualy takes about 1ms.








<---- Shows it takes 4 seconds to process 2000 times resulting in about 1-2ms per run.