Created
January 20, 2014 03:49
-
-
Save tarynsauer/8514595 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
| package tictactoe; | |
| abstract class AbstractPlayer implements Player { | |
| private String marker; | |
| private Player opponent; | |
| public String getMarker() { | |
| return marker; | |
| } | |
| public Player getOpponent() { | |
| return opponent; | |
| } | |
| public void setOpponent(Player player) { | |
| this.opponent = player; | |
| } | |
| public AbstractPlayer(String marker) { | |
| this.marker = marker; | |
| } | |
| public void addMarker(Board board, String move) { | |
| int cellIndex = Integer.parseInt(move) - 1; | |
| board.getCells()[cellIndex] = this.marker; | |
| } | |
| public String makeMove(Board board) { | |
| UI ui = new UI(); | |
| return ui.getNextMove(); | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment