A Unix command-line battleship game that uses RTP to communicate with another client. The game code (with the exception of the AI strategy routine I wrote) were given to us by the professor and we simply had to implement the networking aspects of the game.
The "AI Shots" option will use a basic "artificial intelligence" algorithm for choosing where to shoot. It fires random shots until it hits a ship and then begins testing the 4 squares surrounding the square it hits until it hits a second time. At that point, it continues in the same direction until it misses. Then it goes back to the first place it hit the ship and reverses its direction. It will continue in that direction until it misses at which point it will return to random shooting. It could be improved by having it make a choice based on what kind of ship it is shooting at so that it did not keep shooting at a ship after it sunk. You could also have it shoot in an 'X' or checkerboard pattern to be more efficient at finding ships.
Instructions:
Files: