If statements are all you need

Started by
12 comments, last by Nypyren 8 years ago

Before you open the link, the file is over a 100K lines!

https://gist.githubusercontent.com/alessonforposterity/832da4fab11e10609dad/raw/258df12378399919ae088ba8731a7571d9c2c947/drgn.txt

I'm actually amazed at how he turned this into functional software, that's dedication right there.

Advertisement

Before you open the link, the file is over a 100K lines!

Lines of Code are a terrible metric, as we all know: http://hg.icculus.org/icculus/lugaru/file/97b303e79826/Source/GameTick.cpp#l5300

Well, it's a game about a dragon. If you zoom all the way out, out, out, tilt your head to the right, and squint your eyes, you can almost see the dragon.

At first I thought it would just be if statements instead of other control flow techniques. But no, it's much worse than that.


if (printHPMax - 90 >= 0)
{
    hpTen = 9;
}
else if (printHPMax - 80 >= 0)
{
    hpTen = 8;
}
else if (printHPMax - 70 >= 0)
{
    hpTen = 7;
}
else if (printHPMax - 60 >= 0)
{
    hpTen = 6;
}
else if (printHPMax - 50 >= 0)
{
    hpTen = 5;
}
else if (printHPMax - 40 >= 0)
{
    hpTen = 4;
}
else if (printHPMax - 30 >= 0)
{
    hpTen = 3;
}
else if (printHPMax - 20 >= 0)
{
    hpTen = 2;
}
else if (printHPMax - 10 >= 0)
{
    hpTen = 1;
}
else if (printHPMax - 10 < 0)
{
    hpTen = 0;
}

It looks like something someone would write who had a very, very basic understanding of C#, and both a lot of time on their hands, and an unwillingness to learn more about C#.

It looks like something someone would write who had a very, very basic understanding of C#, and both a lot of time on their hands, and an unwillingness to learn more about C#.


This. 10-year-old me wrote code like this in QBASIC before he knew any better. Kudos are due for actually releasing it AND getting positive reviews.

Hah, that was my thought, I think I've written similarly bad code when I was young, though I'd like to think I'd have been more lazy about all that typing and have wanted to look up how to use arrays and whatnot. Luckily I have no code that old to look back upon.

It's actually looks generated.

Good luck maintaining that :/

This. 10-year-old me wrote code like this in QBASIC before he knew any better. Kudos are due for actually releasing it AND getting positive reviews.


Wow, yeah, same start here. :)

btw, did anyone else read this thread's topic as a question? "If statements are all you need, then ...?"

Sean Middleditch – Game Systems Engineer – Join my team!

Not sure if the following quote is true as I couldn't find the source, but it's from an image on twitter.

How long was the development period?

C: I started work on the game in the middle of March 2012, so... two and a half years now?

What has been your hardest struggle with development?

C: Aside from marketing? Programming, definitely. That's the one thing I don't really have experience with. Until this game, the only education I had in writing code was when I took a 100-level Java course from a community college, and I straight-up got an F. Failing out of a hundred-level course in a community college, that's a special kinda shame :v

Lines of Code are a terrible metric, as we all know: http://hg.icculus.org/icculus/lugaru/file/97b303e79826/Source/GameTick.cpp#l5300

Hehe true that, but it was actually a warning for mobile phone users :P.

btw, did anyone else read this thread's topic as a question? "If statements are all you need, then ...?"

If statements are all you need, then you're happy as a programmer? This could be a game for the lounge.

This topic is closed to new replies.

Advertisement