Last active
January 3, 2016 00:59
-
-
Save tarynsauer/8385995 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public class AIPlayer implements Player { | |
| private String marker; | |
| private Player opponent; | |
| public AIPlayer(String marker) { | |
| this.marker = marker; | |
| } | |
| @Override | |
| public String getMarker() { | |
| return marker; | |
| } | |
| @Override | |
| public Player getOpponent() { | |
| return opponent; | |
| } | |
| @Override | |
| public void setOpponent(Player player) { | |
| this.opponent = player; | |
| } | |
| @Override | |
| public void addMarker(Board board, int move) { | |
| int cellIndex = move - 1; | |
| board.cells[cellIndex] = this.marker; | |
| } | |
| @Override | |
| public void makeMove(Board board) { | |
| String move = ai.getAIMove(); | |
| int moveIndex = Integer.parseInt(move); | |
| addMarker(board, moveIndex); | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment