Part 1:
In this milestone you will create an Artificial Intelligence player for Battleship. You are to create a new class names AIPlayer_netid.java. The class definition appears below. As usual, you will change netid to your actual netid.
public class AIPlayer_netid implements Player{
}
Keep in mind, if you modified Player.java from MS3, you should use the modified version.
The AI player will not be asking the user for any input. This means that placeShips() and fire() should not ask the user for locations. The AI player should choose locations of ships and automatically place them, and should choose appropriate coordinates to fire. Just as in MS3, your method signatures in AIPlayer_netid must conform to those found in Player.java.
For 3/4 credit:
- You must create a Battleship game between a human user and the AI player
- Your AI player should be able to successfully place all of their ships
- Your AI player needs to be able to randomly fire at the human player
- Your AI player must follow the rules of Battleship.
- Math.random() may be helpful to you.
For full credit:
- You must create a Battleship game between a human user and the AI player
- Your AI player should place ships strategically. You should explain your strategy for placing ships in the comments above your placeShips() method
- Your AI player should not always haphazardly fire at the human player, but should use some form of strategy to win. Your AI player must follow the rules of Battleship. You should explain your strategy for firing in the comments above fire(). Look to your MS1's last task for inspiration
Part 2:
- Create both an easy (random) AI player AND and difficult (strategic) AI player, and allow the player to choose which one they want to play against.
(5 pts)
- Allow the player to either choose to play against either another human, the easy AI, or the difficult AI (5pts)
- Pit different AI strategies against each other, and determine which is the best algorithm, over hundreds of games. You must write up your results and explain them. You should put the code that calculates the wins in a file called BattleshipBattles.java (15 pts)
- Create a dynamic AI player that moves ships based on guesses. To keep things fair, ships cannot move to already guessed areas, and are cannot occupy the same space as other ships. Put this AI player in a file called ImpossiblePlayer.java. ImpossiblePlayer should implement the Player class