Sign in to follow this  

Check my code

This topic is 3565 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Ive made a simple Naughts and Crosses game using C++ and DirectX. The problem is I pretty much complety self taught (Programming isn't done at school untill A-Level computing and even then not in depth so the teachers know very little :( ) and none of my family do c++ I havn't got anyone to show the code to and ask for advice. The main thing is I want to make sure that I'm not doing stuff that isn't really supported (And might not work with another compiler/comp) and that I'm going along the right lines. I know I made this run in real time(which it doesn't need to be) but it was just a practice before I make some actual real time games with the other stuff ive put together... ps:If anyone has any great ideas on how to make a better AI please tell me :) Download

Share this post


Link to post
Share on other sites
I havent looked at your code, but if you want to study ways to make good naughts and crosses gameplay lookinto genetic programming

http://www.google.co.uk/search?client=firefox-a&rls=org.mozilla%3Aen-GB%3Aofficial&channel=s&hl=en&q=tic+tac+toe+genetic+programming&meta=&btnG=Google+Search

Share this post


Link to post
Share on other sites
Rule 1 when distributing your code. Do not distribute the binary and user specific data files. I pruned out the debug folders, the user specific project files, and the massive 16MB intellisense database to reduce your folder down to 133KB uncompressed.

You probably should fix that right now if you want to encourage people to look at your code.

Share this post


Link to post
Share on other sites
Quote:
ps:If anyone has any great ideas on how to make a better AI please tell me :)


TTT AI is a reasonably small problem. For once, it's possible to pre-calculate all possible games. This way, your AI will know all possible results of any given game state.

After that, you parse the game state space, checking which next move will result in most winning conditions. After that (since you'll get several), you choose one of those moves randomly.

This is the most trivial brute force algorithm, which while not the most elegant or exotic, gives you perfect AI (or at very least a non-suboptimal), and performance is not even remotely an issue.

Share this post


Link to post
Share on other sites

This topic is 3565 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this