Check my code

Started by
4 comments, last by Sync Views 16 years, 1 month ago
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
Advertisement
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
http://stowelly.co.uk/
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.
(Not looked at code)

For AI, Tic Tac Toe is solved. A reasonably simple algorithm to look into would be Minimax (and, whilst being somewhat less interesting than genetic programming, has the benefit of avoiding having to evolve an appropriate algorithm).
[TheUnbeliever]
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.
Ok I'll look at useing that ai method also I cut down the zip size...

The real thing I want to know is if any of the methods I'm using are generaly seen as bad practice.

This topic is closed to new replies.

Advertisement