Hi!

I've been trying to create an amoeba program that is smart enough to beat me. So far I didn't really succeed. Please read how I approached the problem, and if you have other ideas of solving it or suggestions, tell me!

OK, so basically in amoeba the program looks for 28 different patterns (e.g. 5 in a row; 4 in a row with two ends open, 3 in a row, etc...). For every square, based upon which patterns appear there if an X/O is placed, a score is given. The 28 patterns have different scores for when you create that pattern or when the enemy creates it. I was hoping that a correct combination of the values of these 28 patterns might lead to an AI that can beat me, but I'm not sure; if you have any ideas on how the AI should make a decision, tell me.

So then I created a genetic algorithm that mutates the pattern values, and if it beats the original version and the latest version 7/8 time each, it becomes the latest version. Over 100 successful mutations later, the values I have evolved can't beat me, in fact it's easier to beat than the original version.

I wanted to start learning C++ with this program; but seeing as I couldn't start writing it, my plan was to first write it in freebasic and then C++.
Thanks for any suggestions,
-Tusike

PS: the freebasic source code can be found here; it's easy to understand as it's mainly like pseudo-code: http://www.mediafire.com/?z7i1vj4ds9b3tq8

Recommended Answers

All 3 Replies

It's probably easier to beat because you wrote the algorithms yourself. Since you wrote them yourself, you know how they "think" and can exploit them.

If you want to start translating it to C++, I would recommend an online tutorial of some sort. This is one of the first ones I read, it will get you started.

I would consider investing in a quality book of some sort as well. C++ itself is pretty compact but its libraries are huge. You'll never learn everything from a single tutorial or reference volume.

No, I'm pretty sure that's not the reason:) The AI evolved into something that is awesome at exploiting the original version's weaknesses, but other than that is sucks. For example, it evolved in a way so that it basically doesn't think it's important to prevent the opponent from creating a 4-in a row. The AI probably didn't need it to beat the original version, and so it became less and less important...

I've started learning C++ by the way, read through a whole bunch of tutorials; my only problem is that with my current version (MS Visual C++ 2008) it's somewhat complicated / impossible me to test-run a simple file or a few files linked together... If I want to test it, it creates a whole bunch of files and an executable.

There's your answer, it devolved from thinking about all possibilities to only focusing on exploiting the weaknesses of its current opponent. Your testing method(s) also attest to this. You designed your algorithms to beat a particular opponent, not to analyze, and respond to, its current opponent. What you need to do is include improved versions of the "exploit" code from previous versions into the current version.


Sounds like you need to figure out how the project systems works. It's pretty typical of the compilation process to generate a lot of files. It just looks like a ton more files because FreeBASIC automatically deletes all that extra stuff when it's done, unless you explicitly tell it not to (don't ask me the correct switch, I don't remember it).

Just use the built-in debugger, it'll handle the execution for you.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.