Hi everyone, I want to make battleship in c++. At the starting Program should ask user for mode - Single Player with AI or Multi-player. So how to start writing code for both??
Printable View
Hi everyone, I want to make battleship in c++. At the starting Program should ask user for mode - Single Player with AI or Multi-player. So how to start writing code for both??
First of all, I guess this question is not really related to Visual C++. It's about design decisions, maybe you should try another forum?
Now, to try to answer your question... In an object oriented solution you can prepare a virtual base class for your opponent player with a GetNextMove() method. Then you derive different classes, one for AI player (where you write your search algorithms, neural networks, etc), and one for network player (where you write code for network communication). You then create a factory that at runtime creates the interface object for the player type that matches the selected mode.
Anyway, that's a start. You should try to write some overall design paper before starting.
Do you know anything about programming and C++? Anyway, have a look here http://mariusbancila.ro/blog/2007/05...a-write-games/.