Monday, March 5, 2012

AI Challenge

I recently took part in a nice contest hosted at aichallenge.org. For those of you who don't know about it, it's a series of coding contests revolving around AI.  This particular game was 'Ants'. Basically, you controlled an ant colony while they tried to raze enemy hills, collect food, and protect your own ant hill. It was a very good idea and I have nothing but praise for those who organized it :) I did quite well in my country finishing 2nd, but my code was poorly written and choppy so I'm not going to share it unless people ask for it.
The first thing I did was restructure the "starter bot" you were given. I completely tore it apart and re-implemented it. This helped me a lot more as I continued and I think I'll ignore the starter bot next time around and just go with my own code.

If you didn't compete in this one, do compete in the next one. They're great fun and I learned a staggering amount while I was going along. There's a great sense of community, especially on the IRC channel (who always helped me out :) ) and I can't wait for the next one. (Psssst, rumor has it it could be Asteroids ;) )

---NotMyFault

Tuesday, January 3, 2012

ProjectEuler Problem 8

No posts in a long time, but this will now become a blog about projecteuler :) This problem was very easy to do in C++ (Or any other language). Just throw the big number into a string and get substrings of it. here it is:

#include
#include
using namespace std;

int main() {

    string big_number = "7316717...........52963450";

    unsigned long long biggest = 0;
    unsigned long long test_biggest = 0;

    for(int i=0; i        string convert_me = big_number.substr(i, 5); //Get the substring


        for(int j=0; j<5; j++) {
            if(convert_me[j]-'0' == 0)
                break;

            if(test_biggest == 0) {
                test_biggest = convert_me[j]-'0';
                continue;
            }

            test_biggest *= convert_me[j]-'0';

            if(j==4)
                biggest = ( (test_biggest > biggest) ? test_biggest : biggest);
        }

        test_biggest = 0;
    }

    cout << biggest << endl;
    return 0;
}


time: 0.002s



Optimizations would be simple but not needed as its such a simple problem. (e.g, increment i by 4 if it finds a zero)

      --NotMyFault

Tuesday, January 25, 2011

Kingdoms Game

   It's been a while again, but I do mean to post more often. I got exams and stuff happening at the moment however, so it's not that easy to do so...

 So I decided to write this post so you could find out a bit of what I'm doing. I got in touch with this guy through GameDev who was looking for some help with an RPG he's making. I got on board and now I'm helping him out with some small things on the site. It's a pretty good game I must say, and fair deuce to Mutant who created the whole thing himself from scratch! A fine achievement might I say!

   So the game is found at www.kingdoms-game.com and I'd encourage _everyone_ to check it out!

   Anyways, Back soon,
      NotMyFault

Saturday, December 4, 2010

Updates

   So first of all, an apology. I'm sooo sorry but I've just had so much stuff going on right now. School exams, family stuff and more but I'm back now.

   So first of all, OS. I've gone from the Debian  beta distro back to Fedora 13.
Learning about networking and stuff like that at the minute and I finally made a start on image programming with C++ using SDL. LazyFoo is the best resource going for learning SDL in my opinion!

   Making a Perl IRC bot for part of a competition *spoiler!!!* but I can't really say anything about that at the moment... Needless to say, it's something you'll hear more about in the future!

   I've also started on some free-lance work using vWorker. Seems good but I don't like having to under-bid on everything to gain some rep...

   Anyways, I have a few ideas coming up for the future. It involves  bit of game programming with C++ and SDL, a bit of AI in Perl *spoiler!!!* and who knows what else ;P

   I'll be back soon!
      NotMyFault

Wednesday, September 1, 2010

Perl IRC Bot

    So I've decided to learn Perl. It seems like a good language to learn as it's what is usually used for small hacks and quick and dirty scripts. So after the usual small, useless projects (Calculator, Guess my Number, etc) I decided to make an IRC bot.
    I spend most of my day on IRC channels. Mostly #HBH on hellboundhackers.org! I decided to make a bot to log everything while I'm away at school (Which starts tomorrow :() I've made good progress and all I have to do is make it connect via ssl and it'll be ready to go! Some of it's functionality is giving/taking ops, saving all conversations to a file, greeting and saying goodbye to people and sleeping and waking.
    Anywhoo, that's all with me! If anyone knows about connecting via ssl in perl, the comments are open.
       NotMyFault

Friday, August 27, 2010

My Venture to Linux

    So, I got a new laptop about a month ago. Previously, I was using my Dad's laptop or the family desktop. I had a _big_ accident with the family computer but that's all covered in another post ;D Now that I had my own laptop, I wasn't scared of destroying something I didn't own!

    Now, due to some influence and advice on my favourite irc channel, #hbh on hellboundhackers.org, I decided Debian 5.0.5 was the distro for me. I downloaded an iso then burned it to a CD and tried to boot. Couldn't read from the CD-ROM was the error. Kinda stupid because it was reading from the CD-ROM when it booted... I was talking to some guys and they said it might have been because Debian doesn't get updated too often, that Lenny mightn't have been updated recently and since my laptop is new, the CD-ROM mightn't have been recognised!

    Annoying, but nothing I could do about it. I then moved on to my second favourite distro, Fedora. Fedora 13 Gnome downloaded to a Live USB and I'm away. I partition, la di da di da. Then when I have it installed I realised that it was _slow_! It would take at least 20 seconds to open up a web page in FF. I then inquired on #hbh and was told the problem could have been because I was using 32-bit Fedora on a 64-bit lappy. Even more annoying.

    By now, I had made a nice file system and everything formatted nicely. Now when I installed fedora, and subsequently formatted that partition I un-intentionally left GRUB installed. This caused some _serious_ problems when I tried to boot back into windows to make a new live-cd! Basically, I could boot nothing. Luckily, I had a live cd of Xubuntu so I could boot into that. Then I had to install Xubuntu and use that version of GRUB so I could boot into windows (Thanks to #hbh!) Made a live USB of a 64-bit Fedora and then installed that. Problems solved! (finally)

    Now that I'm happily in Linux, I want to get onto Debian. #hbh recommended netbootin and I'm trying out that now :D So two mottos, find people you can trust (Most of #hbh) and then, more importantly, trust them! Shout out right here to all my friends at #hbh, especially Spyware, Ynori7, Drewid[rogue], Moshbat (sometimes trustable ;P) and yhrei_43 who frequents occasionally!
       NotMyFault

Thursday, August 26, 2010

Back Again!

    So I'm back again! I haven't posted in a _long_ time so sorry guys! Lots has happened in the last couple of weeks so I might as well tell everybody.

    Well I found out about hackerspaces. They are class and to make things even better, there's one in my area :D They're running a Linux workshop sometime soon so I think I'll make it my business to attend that.

    Speaking of Linux, my laptop is now dual-booted with Fedora 13 but my whole conversion to Linux deserves a post itself so watch this space!

    My house has also been completely re-done. Well, not completely but a decent portion of it. My parents decided it was bes to get it done before school comes back again which is in less than a week :) If you think I don't post often enough now, hopefully some routine will help me post more regularly, I doubt it though ;P

    Along with my goal that I set 3 weeks ago for myself which was to finish reading C++ Primer (Failed btw) I've also taken it upon myself to learn AJAX, Javascript and JQuery properly so I can finish that damn app on the sidebar <_> It's really starting to annoy me. What should have been a simple, week long project has turned into a month long drag of nothing getting done on it.

    More happened but I'll tell everyone about this later. Glad to be back!
       NotMyFault